diff options
author | Adrian Prantl <aprantl@apple.com> | 2017-08-22 01:10:48 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2017-08-22 01:10:48 +0000 |
commit | acdc3a7bffca08e9738b5ed119793b1121514876 (patch) | |
tree | 25faaebe29ba1987dbaa37389083f6d8a35ceea5 | |
parent | 92d800048743612e4bfd6b3215254d459fb90758 (diff) | |
download | bcm5719-llvm-acdc3a7bffca08e9738b5ed119793b1121514876.tar.gz bcm5719-llvm-acdc3a7bffca08e9738b5ed119793b1121514876.zip |
dsymutil: don't copy compile units without children from PCM files
rdar://problem/33830532
llvm-svn: 311416
-rw-r--r-- | llvm/test/tools/dsymutil/Inputs/modules-empty/1.o | bin | 0 -> 2176 bytes | |||
-rw-r--r-- | llvm/test/tools/dsymutil/Inputs/modules-empty/Empty.pcm | bin | 0 -> 1304 bytes | |||
-rw-r--r-- | llvm/test/tools/dsymutil/X86/modules-empty.m | 28 | ||||
-rw-r--r-- | llvm/tools/dsymutil/DwarfLinker.cpp | 2 |
4 files changed, 30 insertions, 0 deletions
diff --git a/llvm/test/tools/dsymutil/Inputs/modules-empty/1.o b/llvm/test/tools/dsymutil/Inputs/modules-empty/1.o Binary files differnew file mode 100644 index 00000000000..19588357e77 --- /dev/null +++ b/llvm/test/tools/dsymutil/Inputs/modules-empty/1.o diff --git a/llvm/test/tools/dsymutil/Inputs/modules-empty/Empty.pcm b/llvm/test/tools/dsymutil/Inputs/modules-empty/Empty.pcm Binary files differnew file mode 100644 index 00000000000..a1de19eae74 --- /dev/null +++ b/llvm/test/tools/dsymutil/Inputs/modules-empty/Empty.pcm diff --git a/llvm/test/tools/dsymutil/X86/modules-empty.m b/llvm/test/tools/dsymutil/X86/modules-empty.m new file mode 100644 index 00000000000..3d95aa16880 --- /dev/null +++ b/llvm/test/tools/dsymutil/X86/modules-empty.m @@ -0,0 +1,28 @@ +/* Compile with: + cat >modules.modulemap <<EOF + module Empty { + header "Empty.h" + } +EOF + touch Empty.h + clang -c -fmodules -fmodule-map-file=modules.modulemap \ + -g -gmodules -fmodules-cache-path=. \ + -Xclang -fdisable-module-hash modules-empty.m -o 1.o +*/ + +// RUN: rm -rf %t.dir +// RUN: mkdir %t.dir +// RUN: cp %p/../Inputs/modules-empty/1.o %p/../Inputs/modules-empty/Empty.pcm %t.dir +// RUN: llvm-dsymutil -f -oso-prepend-path=%t.dir \ +// RUN: -y %p/dummy-debug-map.map -o - \ +// RUN: | llvm-dwarfdump --debug-dump=info - | FileCheck %s + +#include "Empty.h" +int main() { + return 0; +} + +// The empty CU from the pcm should not get copied into the dSYM. +// CHECK: DW_TAG_compile_unit +// CHECK-NOT: DW_TAG_compile_unit + diff --git a/llvm/tools/dsymutil/DwarfLinker.cpp b/llvm/tools/dsymutil/DwarfLinker.cpp index f9328e42fd0..6b5415a0795 100644 --- a/llvm/tools/dsymutil/DwarfLinker.cpp +++ b/llvm/tools/dsymutil/DwarfLinker.cpp @@ -3358,6 +3358,8 @@ void DwarfLinker::loadClangModule(StringRef Filename, StringRef ModulePath, Unit->markEverythingAsKept(); } } + if (!Unit->getOrigUnit().getUnitDIE().hasChildren()) + return; if (Options.Verbose) { outs().indent(Indent); outs() << "cloning .debug_info from " << Filename << "\n"; |