Skip to content

Commit 11a04a6

Browse files
committed
[DebugInfo] Change to constructor homing debug info mode: skip literal types
Summary: In constructor type homing mode sometimes complete debug info for constexpr types was missing, because there was not a constructor emitted. This change makes constructor type homing ignore constexpr types. Reviewers: rnk, dblaikie Subscribers: aprantl, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D77432
1 parent c1c679e commit 11a04a6

File tree

2 files changed

+16
-21
lines changed

2 files changed

+16
-21
lines changed

clang/lib/CodeGen/CGDebugInfo.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2261,12 +2261,11 @@ static bool shouldOmitDefinition(codegenoptions::DebugInfoKind DebugKind,
22612261
// constructor is emitted. Skip this optimization if the class or any of
22622262
// its methods are marked dllimport.
22632263
if (DebugKind == codegenoptions::DebugInfoConstructor &&
2264-
!CXXDecl->isLambda() && !isClassOrMethodDLLImport(CXXDecl)) {
2265-
for (const auto *Ctor : CXXDecl->ctors()) {
2264+
!CXXDecl->isLambda() && !CXXDecl->hasConstexprNonCopyMoveConstructor() &&
2265+
!isClassOrMethodDLLImport(CXXDecl))
2266+
for (const auto *Ctor : CXXDecl->ctors())
22662267
if (Ctor->isUserProvided())
22672268
return true;
2268-
}
2269-
}
22702269

22712270
TemplateSpecializationKind Spec = TSK_Undeclared;
22722271
if (const auto *SD = dyn_cast<ClassTemplateSpecializationDecl>(RD))
Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,26 @@
11
// RUN: %clang -cc1 -debug-info-kind=constructor -emit-llvm %s -o - | FileCheck %s
22

3-
// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "A"
4-
// CHECK-NOT: DIFlagFwdDecl
5-
// CHECK-SAME: ){{$}}
6-
struct A {};
7-
void TestA() { A a; }
3+
// CHECK-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: "A"{{.*}}DIFlagTypePassByValue
4+
struct A {
5+
} TestA;
86

9-
// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "B"
10-
// CHECK-SAME: flags: DIFlagFwdDecl
7+
// CHECK-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: "B"{{.*}}flags: DIFlagFwdDecl
118
struct B {
129
B();
13-
};
14-
void TestB() { B b; }
10+
} TestB;
1511

16-
// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "C"
17-
// CHECK-NOT: flags: DIFlagFwdDecl
18-
// CHECK-SAME: ){{$}}
12+
// CHECK-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: "C"{{.*}}DIFlagTypePassByValue
1913
struct C {
2014
C() {}
21-
};
22-
void TestC() { C c; }
15+
} TestC;
2316

24-
// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "D"
25-
// CHECK-NOT: flags: DIFlagFwdDecl
26-
// CHECK-SAME: ){{$}}
17+
// CHECK-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: "D"{{.*}}DIFlagTypePassByValue
2718
struct D {
2819
D();
2920
};
3021
D::D() {}
22+
23+
// CHECK-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: "E"{{.*}}DIFlagTypePassByValue
24+
struct E {
25+
constexpr E(){};
26+
} TestE;

0 commit comments

Comments
 (0)