File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed
test/DebugInfo/KeyInstructions Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -846,11 +846,13 @@ void CodeGenFunction::EmitGotoStmt(const GotoStmt &S) {
846846 if (HaveInsertPoint ())
847847 EmitStopPoint (&S);
848848
849+ ApplyAtomGroup Grp (getDebugInfo ());
849850 EmitBranchThroughCleanup (getJumpDestForLabel (S.getLabel ()));
850851}
851852
852853
853854void CodeGenFunction::EmitIndirectGotoStmt (const IndirectGotoStmt &S) {
855+ ApplyAtomGroup Grp (getDebugInfo ());
854856 if (const LabelDecl *Target = S.getConstantTarget ()) {
855857 EmitBranchThroughCleanup (getJumpDestForLabel (Target));
856858 return ;
@@ -869,6 +871,8 @@ void CodeGenFunction::EmitIndirectGotoStmt(const IndirectGotoStmt &S) {
869871 cast<llvm::PHINode>(IndGotoBB->begin ())->addIncoming (V, CurBB);
870872
871873 EmitBranch (IndGotoBB);
874+ if (CurBB && CurBB->getTerminator ())
875+ addInstToCurrentSourceAtom (CurBB->getTerminator (), nullptr );
872876}
873877
874878void CodeGenFunction::EmitIfStmt (const IfStmt &S) {
Original file line number Diff line number Diff line change 1+ // RUN: %clang_cc1 -triple x86_64-linux-gnu -gkey-instructions -x c++ -std=c++17 %s -debug-info-kind=line-tables-only -emit-llvm -o - -gno-column-info \
2+ // RUN: | FileCheck %s
3+ // RUN: %clang_cc1 -triple x86_64-linux-gnu -gkey-instructions -x c %s -debug-info-kind=line-tables-only -emit-llvm -o - -gno-column-info \
4+ // RUN: | FileCheck %s
5+
6+ // Check the goto branches get Key Instructions metadata.
7+ void ext ();
8+ void test_goto (void ) {
9+ // CHECK: br label %dst1, !dbg [[G1R1:!.*]]
10+ goto dst1 ;
11+ dst1 :
12+ ext ();
13+
14+ void * ptr = & & dst2 ;
15+ // CHECK: br label %indirectgoto, !dbg [[G3R1:!.*]]
16+ goto * ptr ;
17+ dst2 :
18+ ext ();
19+
20+ // CHECK: br label %dst3, !dbg [[G4R1:!.*]]
21+ goto * & & dst3 ;
22+ dst3 :
23+ ext ();
24+
25+ return ;
26+ }
27+
28+ // CHECK: [[G1R1]] = !DILocation(line: 10, scope: ![[#]], atomGroup: 1, atomRank: 1)
29+ // CHECK: [[G3R1]] = !DILocation(line: 16, scope: ![[#]], atomGroup: 3, atomRank: 1)
30+ // CHECK: [[G4R1]] = !DILocation(line: 21, scope: ![[#]], atomGroup: 4, atomRank: 1)
You can’t perform that action at this time.
0 commit comments