Răsfoiți Sursa

John's PR feedback: Move counter out of loop!

Jeff Noyle 5 ani în urmă
părinte
comite
2dcb1efd6b
1 a modificat fișierele cu 3 adăugiri și 1 ștergeri
  1. 3 1
      lib/DxilPIXPasses/DxilDebugInstrumentation.cpp

+ 3 - 1
lib/DxilPIXPasses/DxilDebugInstrumentation.cpp

@@ -948,6 +948,9 @@ bool DxilDebugInstrumentation::runOnModule(Module &M) {
   addInvocationSelectionProlog(BC, SystemValues);
   addInvocationStartMarker(BC);
 
+  // Explicitly name new blocks in order to provide stable names for testing purposes
+  int NewBlockCounter = 0;
+
   auto Fn = DM.GetEntryFunction();
   auto &Blocks = Fn->getBasicBlockList();
   for (auto &CurrentBlock : Blocks) {
@@ -972,7 +975,6 @@ bool DxilDebugInstrumentation::runOnModule(Module &M) {
       }
     }
 
-    int NewBlockCounter = 0;
     for (auto &InsertableEdge : InsertableEdges) {
       auto *NewBlock = BasicBlock::Create(Ctx, "PIXDebug" + std::to_string(NewBlockCounter++),
                                           InsertableEdge.first->getParent());