summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp2
-rw-r--r--clang/test/Modules/ExtDebugInfo.cpp10
-rw-r--r--clang/test/Modules/Inputs/DebugCXX.h6
-rw-r--r--clang/test/Modules/ModuleDebugInfo.cpp4
4 files changed, 20 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index fa501fce756..28e28489681 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -1537,7 +1537,7 @@ static bool shouldOmitDefinition(CodeGenOptions::DebugInfoKind DebugKind,
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)
diff --git a/clang/test/Modules/ExtDebugInfo.cpp b/clang/test/Modules/ExtDebugInfo.cpp
index 101b0f1e16b..b9eae12deda 100644
--- a/clang/test/Modules/ExtDebugInfo.cpp
+++ b/clang/test/Modules/ExtDebugInfo.cpp
@@ -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)
diff --git a/clang/test/Modules/Inputs/DebugCXX.h b/clang/test/Modules/Inputs/DebugCXX.h
index cd2b7a67498..39dda959ce2 100644
--- a/clang/test/Modules/Inputs/DebugCXX.h
+++ b/clang/test/Modules/Inputs/DebugCXX.h
@@ -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; };
+ }
+}
diff --git a/clang/test/Modules/ModuleDebugInfo.cpp b/clang/test/Modules/ModuleDebugInfo.cpp
index 1f574568b6f..a2b735b3b70 100644
--- a/clang/test/Modules/ModuleDebugInfo.cpp
+++ b/clang/test/Modules/ModuleDebugInfo.cpp
@@ -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"
OpenPOWER on IntegriCloud