forked from OSchip/llvm-project
[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
This commit is contained in:
parent
c1c679e2d2
commit
11a04a64aa
|
@ -2261,12 +2261,11 @@ static bool shouldOmitDefinition(codegenoptions::DebugInfoKind DebugKind,
|
||||||
// constructor is emitted. Skip this optimization if the class or any of
|
// constructor is emitted. Skip this optimization if the class or any of
|
||||||
// its methods are marked dllimport.
|
// its methods are marked dllimport.
|
||||||
if (DebugKind == codegenoptions::DebugInfoConstructor &&
|
if (DebugKind == codegenoptions::DebugInfoConstructor &&
|
||||||
!CXXDecl->isLambda() && !isClassOrMethodDLLImport(CXXDecl)) {
|
!CXXDecl->isLambda() && !CXXDecl->hasConstexprNonCopyMoveConstructor() &&
|
||||||
for (const auto *Ctor : CXXDecl->ctors()) {
|
!isClassOrMethodDLLImport(CXXDecl))
|
||||||
|
for (const auto *Ctor : CXXDecl->ctors())
|
||||||
if (Ctor->isUserProvided())
|
if (Ctor->isUserProvided())
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TemplateSpecializationKind Spec = TSK_Undeclared;
|
TemplateSpecializationKind Spec = TSK_Undeclared;
|
||||||
if (const auto *SD = dyn_cast<ClassTemplateSpecializationDecl>(RD))
|
if (const auto *SD = dyn_cast<ClassTemplateSpecializationDecl>(RD))
|
||||||
|
|
|
@ -1,30 +1,26 @@
|
||||||
// RUN: %clang -cc1 -debug-info-kind=constructor -emit-llvm %s -o - | FileCheck %s
|
// RUN: %clang -cc1 -debug-info-kind=constructor -emit-llvm %s -o - | FileCheck %s
|
||||||
|
|
||||||
// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "A"
|
// CHECK-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: "A"{{.*}}DIFlagTypePassByValue
|
||||||
// CHECK-NOT: DIFlagFwdDecl
|
struct A {
|
||||||
// CHECK-SAME: ){{$}}
|
} TestA;
|
||||||
struct A {};
|
|
||||||
void TestA() { A a; }
|
|
||||||
|
|
||||||
// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "B"
|
// CHECK-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: "B"{{.*}}flags: DIFlagFwdDecl
|
||||||
// CHECK-SAME: flags: DIFlagFwdDecl
|
|
||||||
struct B {
|
struct B {
|
||||||
B();
|
B();
|
||||||
};
|
} TestB;
|
||||||
void TestB() { B b; }
|
|
||||||
|
|
||||||
// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "C"
|
// CHECK-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: "C"{{.*}}DIFlagTypePassByValue
|
||||||
// CHECK-NOT: flags: DIFlagFwdDecl
|
|
||||||
// CHECK-SAME: ){{$}}
|
|
||||||
struct C {
|
struct C {
|
||||||
C() {}
|
C() {}
|
||||||
};
|
} TestC;
|
||||||
void TestC() { C c; }
|
|
||||||
|
|
||||||
// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "D"
|
// CHECK-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: "D"{{.*}}DIFlagTypePassByValue
|
||||||
// CHECK-NOT: flags: DIFlagFwdDecl
|
|
||||||
// CHECK-SAME: ){{$}}
|
|
||||||
struct D {
|
struct D {
|
||||||
D();
|
D();
|
||||||
};
|
};
|
||||||
D::D() {}
|
D::D() {}
|
||||||
|
|
||||||
|
// CHECK-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: "E"{{.*}}DIFlagTypePassByValue
|
||||||
|
struct E {
|
||||||
|
constexpr E(){};
|
||||||
|
} TestE;
|
||||||
|
|
Loading…
Reference in New Issue