diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp index 6beb2bccfeae0..251b059c256f6 100644 --- a/clang/lib/CodeGen/CGClass.cpp +++ b/clang/lib/CodeGen/CGClass.cpp @@ -1338,6 +1338,7 @@ void CodeGenFunction::EmitCtorPrologue(const CXXConstructorDecl *CD, assert(!Member->isBaseInitializer()); assert(Member->isAnyMemberInitializer() && "Delegating initializer on non-delegating constructor"); + ApplyAtomGroup Grp(getDebugInfo()); CM.addMemberInitializer(Member); } CM.finish(); diff --git a/clang/test/DebugInfo/KeyInstructions/init-member.cpp b/clang/test/DebugInfo/KeyInstructions/init-member.cpp new file mode 100644 index 0000000000000..5ccefd4064421 --- /dev/null +++ b/clang/test/DebugInfo/KeyInstructions/init-member.cpp @@ -0,0 +1,22 @@ +// RUN: %clang_cc1 -gkey-instructions %s -debug-info-kind=line-tables-only -emit-llvm -o - \ +// RUN: | FileCheck %s + +struct B { + float y; +}; + +class Cls { + public: + int x = 1; + B b = {5.f}; +}; + +void fun() { + Cls c; +} + +// CHECK: store i32 1, ptr %x{{.*}}, !dbg [[G1R1:!.*]] +// CHECK: store float 5.000000e+00, ptr %y{{.*}}, !dbg [[G2R1:!.*]] + +// CHECK: [[G1R1]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 1) +// CHECK: [[G2R1]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 1)