summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2017-07-26 18:48:32 +0000
committerAdrian Prantl <aprantl@apple.com>2017-07-26 18:48:32 +0000
commit833ad37c9035baf52fb44e9300e142a756aaedfb (patch)
tree5ec09d7cebc341b19aa16a137adb32902703c32d /llvm/lib/CodeGen
parenta5e8dd35b00a12c36074e9a5f174e95817f3b273 (diff)
downloadbcm5719-llvm-833ad37c9035baf52fb44e9300e142a756aaedfb.tar.gz
bcm5719-llvm-833ad37c9035baf52fb44e9300e142a756aaedfb.zip
Do a better job at emitting prefrabricated skeleton CUs.
This is a better fix than r308708 for the problem introduced in r304020. It restores the skeleton CU testcases modified by that commit to their original form and most importantly ensures that frontend-generated skeleton CUs (such as used to point to Clang modules) come after the regular CUs. This broke for DICompileUnit nodes that don't have any immediate children because they are now constructed lazily instead of the order in which they are listed in !llvm.dbg.cu. After this commit we still don't guarantee that order, but we do guarantee that empty skeletons come last. Shipping versions of LLDB are very sensitive to the ordering of CUs. I'll track a fix for LLDB to be more permissive separately. This fixes a test failure in the LLDB testsuite. rdar://problem/33357252 llvm-svn: 309154
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 9533d61d08a..70fe1e233ba 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -520,6 +520,14 @@ sortGlobalExprs(SmallVectorImpl<DwarfCompileUnit::GlobalExpr> &GVEs) {
return GVEs;
}
+static bool isEmptyCU(DICompileUnit *CUNode) {
+ return CUNode->getEnumTypes().empty() &&
+ CUNode->getRetainedTypes().empty() &&
+ CUNode->getGlobalVariables().empty() &&
+ CUNode->getImportedEntities().empty() &&
+ CUNode->getMacros().empty();
+}
+
// Emit all Dwarf sections that should come prior to the content. Create
// global DIEs and emit initial debug info sections. This is invoked by
// the target AsmPrinter.
@@ -546,10 +554,7 @@ void DwarfDebug::beginModule() {
}
for (DICompileUnit *CUNode : M->debug_compile_units()) {
- if (CUNode->getEnumTypes().empty() && CUNode->getRetainedTypes().empty() &&
- CUNode->getGlobalVariables().empty() &&
- CUNode->getImportedEntities().empty() && CUNode->getMacros().empty() &&
- !CUNode->getDWOId())
+ if (isEmptyCU(CUNode))
continue;
DwarfCompileUnit &CU = getOrCreateDwarfCompileUnit(CUNode);
@@ -683,6 +688,11 @@ void DwarfDebug::finalizeModuleInfo() {
TLOF.getDwarfMacinfoSection()->getBeginSymbol());
}
+ // Emit all frontend-produced Skeleton CUs, i.e., Clang modules.
+ for (auto *CUNode : MMI->getModule()->debug_compile_units())
+ if (CUNode->getDWOId() && isEmptyCU(CUNode))
+ getOrCreateDwarfCompileUnit(CUNode);
+
// Compute DIE offsets and sizes.
InfoHolder.computeSizeAndOffsets();
if (useSplitDwarf())
OpenPOWER on IntegriCloud