forked from OSchip/llvm-project
Module Debugging: Fine-tune the condition that determines whether a type
can be found in a module. There are externally visible anonymous types that can be found: typedef struct { } s; // I can be found via the typedef. There are anonymous internal types that can be found: namespace { struct s {}; } // I can be found by name. rdar://problem/24199640 llvm-svn: 258272
This commit is contained in:
parent
59411db520
commit
8f55b66a53
|
@ -1537,7 +1537,7 @@ static bool shouldOmitDefinition(CodeGenOptions::DebugInfoKind DebugKind,
|
||||||
const LangOptions &LangOpts) {
|
const LangOptions &LangOpts) {
|
||||||
// Does the type exist in an imported clang module?
|
// Does the type exist in an imported clang module?
|
||||||
if (DebugTypeExtRefs && RD->isFromASTFile() && RD->getDefinition() &&
|
if (DebugTypeExtRefs && RD->isFromASTFile() && RD->getDefinition() &&
|
||||||
RD->isExternallyVisible())
|
(RD->isExternallyVisible() || !RD->getName().empty()))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (DebugKind > CodeGenOptions::LimitedDebugInfo)
|
if (DebugKind > CodeGenOptions::LimitedDebugInfo)
|
||||||
|
|
|
@ -39,8 +39,10 @@ TypedefUnion tdu;
|
||||||
TypedefEnum tde;
|
TypedefEnum tde;
|
||||||
TypedefStruct tds;
|
TypedefStruct tds;
|
||||||
|
|
||||||
|
InAnonymousNamespace anon;
|
||||||
|
|
||||||
void foo() {
|
void foo() {
|
||||||
GlobalStruct.i = GlobalUnion.i = GlobalEnum;
|
anon.i = GlobalStruct.i = GlobalUnion.i = GlobalEnum;
|
||||||
}
|
}
|
||||||
|
|
||||||
// CHECK: ![[NS:.*]] = !DINamespace(name: "DebugCXX", scope: ![[MOD:[0-9]+]],
|
// CHECK: ![[NS:.*]] = !DINamespace(name: "DebugCXX", scope: ![[MOD:[0-9]+]],
|
||||||
|
@ -93,4 +95,10 @@ void foo() {
|
||||||
// CHECK: ![[GLOBAL_STRUCT]] = !DICompositeType(tag: DW_TAG_structure_type,
|
// CHECK: ![[GLOBAL_STRUCT]] = !DICompositeType(tag: DW_TAG_structure_type,
|
||||||
// CHECK-SAME: elements: !{{[0-9]+}})
|
// CHECK-SAME: elements: !{{[0-9]+}})
|
||||||
|
|
||||||
|
// CHECK: !DIGlobalVariable(name: "anon",
|
||||||
|
// CHECK-SAME: type: ![[GLOBAL_ANON:[0-9]+]]
|
||||||
|
// CHECK: ![[GLOBAL_ANON]] = !DICompositeType(tag: DW_TAG_structure_type,
|
||||||
|
// CHECK-SAME: name: "InAnonymousNamespace", {{.*}}DIFlagFwdDecl)
|
||||||
|
|
||||||
|
|
||||||
// CHECK: !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !0, entity: !"_ZTSN8DebugCXX6StructE", line: 24)
|
// CHECK: !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !0, entity: !"_ZTSN8DebugCXX6StructE", line: 24)
|
||||||
|
|
|
@ -66,3 +66,9 @@ typedef struct { int i; } TypedefStruct;
|
||||||
union { int i; } GlobalUnion;
|
union { int i; } GlobalUnion;
|
||||||
struct { int i; } GlobalStruct;
|
struct { int i; } GlobalStruct;
|
||||||
enum { e5 = 5 } GlobalEnum;
|
enum { e5 = 5 } GlobalEnum;
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
namespace {
|
||||||
|
struct InAnonymousNamespace { int i; };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -81,4 +81,8 @@
|
||||||
// CHECK: !DICompositeType(tag: DW_TAG_structure_type,
|
// CHECK: !DICompositeType(tag: DW_TAG_structure_type,
|
||||||
// CHECK-SAME-NOT: name:
|
// CHECK-SAME-NOT: name:
|
||||||
|
|
||||||
|
// CHECK: !DICompositeType(tag: DW_TAG_structure_type,
|
||||||
|
// CHECK-SAME: name: "InAnonymousNamespace",
|
||||||
|
// CHECK-SAME: elements: !{{[0-9]+}})
|
||||||
|
|
||||||
// CHECK-NEG-NOT: !DICompositeType(tag: DW_TAG_structure_type, name: "PureForwardDecl"
|
// CHECK-NEG-NOT: !DICompositeType(tag: DW_TAG_structure_type, name: "PureForwardDecl"
|
||||||
|
|
Loading…
Reference in New Issue