File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -515,9 +515,20 @@ class LLVM_LIBRARY_VISIBILITY SILGenFunction
515
515
// / Set the debug scope for all SILInstructions that where emitted
516
516
// / from when we entered the last scope up to the current one.
517
517
void setDebugScopeForInsertedInstrs (SILDebugScope *DS) {
518
- while (LastInsnWithoutScope < InsertedInstrs.size ()) {
519
- InsertedInstrs[LastInsnWithoutScope++]->setDebugScope (DS);
518
+ // This is just a workaround.
519
+ // Check that instruction really belongs to a function being processed.
520
+ unsigned LastIdx = LastInsnWithoutScope, EndIdx = InsertedInstrs.size ();
521
+ for (auto &BB: F) {
522
+ for (auto &I: BB) {
523
+ for (unsigned i = LastIdx; i < EndIdx; ++i) {
524
+ if (&I == InsertedInstrs[i]) {
525
+ InsertedInstrs[i]->setDebugScope (DS);
526
+ break ;
527
+ }
528
+ }
529
+ }
520
530
}
531
+ LastInsnWithoutScope = EndIdx;
521
532
}
522
533
523
534
// ===--------------------------------------------------------------------===//
You can’t perform that action at this time.
0 commit comments