llvm.org GIT mirror llvm / fce2219
dsymutil: Don't prune forward declarations inside of an imported TAG_module if there exists not definition for the type. For this to work, we need to clone the imported modules before building the decl context chains of the DIEs in the non-skeleton CUs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249362 91177308-0d34-0410-b5e6-96231b3b80d8 Adrian Prantl 4 years ago
4 changed file(s) with 26 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
33 module Child {
44 header "Child.h"
55 }
6 module Empty {
7 header "Empty.h"
8 }
69 }
710 EOF
811 clang -D CHILD_H -E -o Child.h submodules.m
12 touch empty.h
913 clang -cc1 -emit-obj -fmodules -fmodule-map-file=modules.modulemap \
1014 -fmodule-format=obj -g -dwarf-ext-refs -fmodules-cache-path=. \
1115 -fdisable-module-hash submodules.m -o 1.o
1822 // ---------------------------------------------------------------------
1923 #ifdef CHILD_H
2024 // ---------------------------------------------------------------------
25
2126 // CHECK: DW_TAG_compile_unit
2227 // CHECK-NOT: DW_TAG
2328 // CHECK: DW_TAG_module
2732 // CHECK: DW_TAG_structure_type
2833 // CHECK-NOT: DW_TAG
2934 // CHECK: DW_AT_name {{.*}}"PruneMeNot"
30
3135 struct PruneMeNot;
3236
3337 // ---------------------------------------------------------------------
3438 #else
3539 // ---------------------------------------------------------------------
3640
41 // CHECK: DW_TAG_compile_unit
42 // CHECK: DW_TAG_module
43 // CHECK-NEXT: DW_AT_name{{.*}}"Parent"
44 // CHECK: DW_TAG_module
45 // CHECK-NEXT: DW_AT_name{{.*}}"Child"
46 // CHECK: 0x0[[EMPTY:.*]]: DW_TAG_module
47 // CHECK-NEXT: DW_AT_name{{.*}}"Empty"
48
49 // CHECK: DW_AT_import {{.*}}0x{{0*}}[[EMPTY]]
3750 @import Parent.Child;
51 @import Parent.Empty;
3852 int main(int argc, char **argv) { return 0; }
3953 #endif
18061806 DIE->getAttributeValueAsUnsignedConstant(
18071807 &CU.getOrigUnit(), dwarf::DW_AT_declaration, 0);
18081808
1809 // Don't prune it if there is no definition for the DIE.
1810 Info.Prune &= Info.Ctxt && Info.Ctxt->getCanonicalDIEOffset();
1811
18091812 return Info.Prune;
18101813 }
18111814
33373340 DWARFContextInMemory DwarfContext(*ErrOrObj);
33383341 startDebugObject(DwarfContext, *Obj);
33393342
3340 // In a first phase, just read in the debug info and store the DIE
3341 // parent links that we will use during the next phase.
3343 // In a first phase, just read in the debug info and load all clang modules.
33423344 for (const auto &CU : DwarfContext.compile_units()) {
33433345 auto *CUDie = CU->getUnitDIE(false);
33443346 if (Options.Verbose) {
33453347 outs() << "Input compilation unit:";
33463348 CUDie->dump(outs(), CU.get(), 0);
33473349 }
3348 if (!registerModuleReference(*CUDie, *CU, ModuleMap)) {
3350
3351 if (!registerModuleReference(*CUDie, *CU, ModuleMap))
33493352 Units.emplace_back(*CU, UnitID++, !Options.NoODR, "");
3350 analyzeContextInfo(CUDie, 0, Units.back(), &ODRContexts.getRoot(),
3351 StringPool, ODRContexts);
3352 }
33533353 }
3354
3355 // Now build the DIE parent links that we will use during the next phase.
3356 for (auto &CurrentUnit : Units)
3357 analyzeContextInfo(CurrentUnit.getOrigUnit().getUnitDIE(), 0, CurrentUnit,
3358 &ODRContexts.getRoot(), StringPool, ODRContexts);
33543359
33553360 // Then mark all the DIEs that need to be present in the linked
33563361 // output and collect some information about them. Note that this