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)
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]+]],
// 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)
union { int i; } GlobalUnion;
struct { int i; } GlobalStruct;
enum { e5 = 5 } GlobalEnum;
+
+namespace {
+ namespace {
+ struct InAnonymousNamespace { int i; };
+ }
+}
// 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"