Skip to content

Commit 5c3a997

Browse files
authored
[KeyInstr][Clang] Member initalization atom (#134640)
This patch is part of a stack that teaches Clang to generate Key Instructions metadata for C and C++. RFC: https://discourse.llvm.org/t/rfc-improving-is-stmt-placement-for-better-interactive-debugging/82668 The feature is only functional in LLVM if LLVM is built with CMake flag LLVM_EXPERIMENTAL_KEY_INSTRUCTIONs. Eventually that flag will be removed.
1 parent bb7e559 commit 5c3a997

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

clang/lib/CodeGen/CGClass.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,6 +1338,7 @@ void CodeGenFunction::EmitCtorPrologue(const CXXConstructorDecl *CD,
13381338
assert(!Member->isBaseInitializer());
13391339
assert(Member->isAnyMemberInitializer() &&
13401340
"Delegating initializer on non-delegating constructor");
1341+
ApplyAtomGroup Grp(getDebugInfo());
13411342
CM.addMemberInitializer(Member);
13421343
}
13431344
CM.finish();
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// RUN: %clang_cc1 -gkey-instructions %s -debug-info-kind=line-tables-only -emit-llvm -o - \
2+
// RUN: | FileCheck %s
3+
4+
struct B {
5+
float y;
6+
};
7+
8+
class Cls {
9+
public:
10+
int x = 1;
11+
B b = {5.f};
12+
};
13+
14+
void fun() {
15+
Cls c;
16+
}
17+
18+
// CHECK: store i32 1, ptr %x{{.*}}, !dbg [[G1R1:!.*]]
19+
// CHECK: store float 5.000000e+00, ptr %y{{.*}}, !dbg [[G2R1:!.*]]
20+
21+
// CHECK: [[G1R1]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 1)
22+
// CHECK: [[G2R1]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 1)

0 commit comments

Comments
 (0)