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) {
846
846
if (HaveInsertPoint ())
847
847
EmitStopPoint (&S);
848
848
849
+ ApplyAtomGroup Grp (getDebugInfo ());
849
850
EmitBranchThroughCleanup (getJumpDestForLabel (S.getLabel ()));
850
851
}
851
852
852
853
853
854
void CodeGenFunction::EmitIndirectGotoStmt (const IndirectGotoStmt &S) {
855
+ ApplyAtomGroup Grp (getDebugInfo ());
854
856
if (const LabelDecl *Target = S.getConstantTarget ()) {
855
857
EmitBranchThroughCleanup (getJumpDestForLabel (Target));
856
858
return ;
@@ -869,6 +871,8 @@ void CodeGenFunction::EmitIndirectGotoStmt(const IndirectGotoStmt &S) {
869
871
cast<llvm::PHINode>(IndGotoBB->begin ())->addIncoming (V, CurBB);
870
872
871
873
EmitBranch (IndGotoBB);
874
+ if (CurBB && CurBB->getTerminator ())
875
+ addInstToCurrentSourceAtom (CurBB->getTerminator (), nullptr );
872
876
}
873
877
874
878
void 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