r258272 - Module Debugging: Fine-tune the condition that determines whether a type
Adrian Prantl via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 19 17:29:34 PST 2016
Author: adrian
Date: Tue Jan 19 19:29:34 2016
New Revision: 258272
URL: http://llvm.org/viewvc/llvm-project?rev=258272&view=rev
Log:
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
Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/test/Modules/ExtDebugInfo.cpp
cfe/trunk/test/Modules/Inputs/DebugCXX.h
cfe/trunk/test/Modules/ModuleDebugInfo.cpp
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=258272&r1=258271&r2=258272&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Tue Jan 19 19:29:34 2016
@@ -1537,7 +1537,7 @@ static bool shouldOmitDefinition(CodeGen
const LangOptions &LangOpts) {
// Does the type exist in an imported clang module?
if (DebugTypeExtRefs && RD->isFromASTFile() && RD->getDefinition() &&
- RD->isExternallyVisible())
+ (RD->isExternallyVisible() || !RD->getName().empty()))
return true;
if (DebugKind > CodeGenOptions::LimitedDebugInfo)
Modified: cfe/trunk/test/Modules/ExtDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/ExtDebugInfo.cpp?rev=258272&r1=258271&r2=258272&view=diff
==============================================================================
--- cfe/trunk/test/Modules/ExtDebugInfo.cpp (original)
+++ cfe/trunk/test/Modules/ExtDebugInfo.cpp Tue Jan 19 19:29:34 2016
@@ -39,8 +39,10 @@ TypedefUnion tdu;
TypedefEnum tde;
TypedefStruct tds;
+InAnonymousNamespace anon;
+
void foo() {
- GlobalStruct.i = GlobalUnion.i = GlobalEnum;
+ anon.i = GlobalStruct.i = GlobalUnion.i = GlobalEnum;
}
// 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-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)
Modified: cfe/trunk/test/Modules/Inputs/DebugCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/DebugCXX.h?rev=258272&r1=258271&r2=258272&view=diff
==============================================================================
--- cfe/trunk/test/Modules/Inputs/DebugCXX.h (original)
+++ cfe/trunk/test/Modules/Inputs/DebugCXX.h Tue Jan 19 19:29:34 2016
@@ -66,3 +66,9 @@ typedef struct { int i; } TypedefStruct;
union { int i; } GlobalUnion;
struct { int i; } GlobalStruct;
enum { e5 = 5 } GlobalEnum;
+
+namespace {
+ namespace {
+ struct InAnonymousNamespace { int i; };
+ }
+}
Modified: cfe/trunk/test/Modules/ModuleDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/ModuleDebugInfo.cpp?rev=258272&r1=258271&r2=258272&view=diff
==============================================================================
--- cfe/trunk/test/Modules/ModuleDebugInfo.cpp (original)
+++ cfe/trunk/test/Modules/ModuleDebugInfo.cpp Tue Jan 19 19:29:34 2016
@@ -81,4 +81,8 @@
// CHECK: !DICompositeType(tag: DW_TAG_structure_type,
// 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"
More information about the cfe-commits
mailing list