Skip to content

Commit c25359b

Browse files
committed
[KeyInstr][Clang] Member initalization atom
This patch is part of a stack that teaches Clang to generate Key Instructions metadata for C and C++. The Key Instructions project is introduced, including a "quick summary" section at the top which adds context for this PR, here: 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. The Clang-side work is demoed here: #130943
1 parent 77f91f5 commit c25359b

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 -gkey-instructions %s -gmlt -S -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)