export *
}
EOF
- clang -D BAR_H -E -o Bar.h
- clang -D FOO_H -E -o Foo.h
+ clang -D BAR_H -E -o Bar.h modules.m
+ clang -D FOO_H -E -o Foo.h modules.m
clang -cc1 -emit-obj -fmodules -fmodule-map-file=modules.modulemap \
-fmodule-format=obj -g -dwarf-ext-refs -fmodules-cache-path=. \
-fdisable-module-hash modules.m -o 1.o
// CHECK-NOT: DW_TAG
// CHECK: DW_TAG_module
// CHECK-NEXT: DW_AT_name{{.*}}"Bar"
-// CHECK-NOT: DW_TAG
// CHECK: 0x0[[BAR:.*]]: DW_TAG_structure_type
+// CHECK-NOT: DW_TAG
// CHECK: DW_AT_name {{.*}}"Bar"
// CHECK-NOT: DW_TAG
// CHECK: DW_TAG_member
// CHECK: DW_AT_name {{.*}}"value"
+// CHECK: DW_TAG_structure_type
+// CHECK-NOT: DW_TAG
+// CHECK: DW_AT_name {{.*}}"PruneMeNot"
struct Bar {
int value;
};
+struct PruneMeNot;
+
#else
// ---------------------------------------------------------------------
#ifdef FOO_H
DeclContext *CurrentDeclContext,
NonRelocatableStringpool &StringPool,
DeclContextTree &Contexts,
- bool InTagModule = false) {
+ bool InImportedModule = false) {
unsigned MyIdx = CU.getOrigUnit().getDIEIndex(DIE);
CompileUnit::DIEInfo &Info = CU.getInfo(MyIdx);
// definitions match)."
//
// We treat non-C++ modules like namespaces for this reason.
- if (DIE->getTag() == dwarf::DW_TAG_module)
- InTagModule = true;
+ if (DIE->getTag() == dwarf::DW_TAG_module &&
+ DIE->getAttributeValueAsString(&CU.getOrigUnit(), dwarf::DW_AT_name,
+ "") != CU.getClangModuleName()) {
+ InImportedModule = true;
+ }
Info.ParentIdx = ParentIdx;
- if (CU.hasODR() || CU.isClangModule() || InTagModule) {
+ if (CU.hasODR() || CU.isClangModule() || InImportedModule) {
if (CurrentDeclContext) {
auto PtrInvalidPair = Contexts.getChildDeclContext(*CurrentDeclContext,
DIE, CU, StringPool);
Info.Ctxt = CurrentDeclContext = nullptr;
}
- Info.Prune = InTagModule;
+ Info.Prune = InImportedModule;
if (DIE->hasChildren())
for (auto *Child = DIE->getFirstChild(); Child && !Child->isNULL();
Child = Child->getSibling())
Info.Prune &= analyzeContextInfo(Child, MyIdx, CU, CurrentDeclContext,
- StringPool, Contexts, InTagModule);
+ StringPool, Contexts, InImportedModule);
// Prune this DIE if it is either a forward declaration inside a
// DW_TAG_module or a DW_TAG_module that contains nothing but