DebugInfo: Do not emit pubnames/pubtypes sections if they are empty
authorDavid Blaikie <dblaikie@gmail.com>
Tue, 11 Mar 2014 23:35:06 +0000 (23:35 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Tue, 11 Mar 2014 23:35:06 +0000 (23:35 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203622 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter/DwarfDebug.cpp
test/DebugInfo/empty.ll

index 45a90dc12d7b61add8dfb3a8f0ec1e508520168e..401145d923cad6ced9a3fde79cb93cc42a1db19a 100644 (file)
@@ -2215,6 +2215,9 @@ void DwarfDebug::emitDebugPubSection(
 
     const auto &Globals = (TheU->*Accessor)();
 
+    if (Globals.empty())
+      continue;
+
     if (auto Skeleton = static_cast<DwarfCompileUnit *>(TheU->getSkeleton()))
       TheU = Skeleton;
     unsigned ID = TheU->getUniqueID();
index 2885eb51fcc9b5f3ce9a610bd78810019fd15462..1fb181661462ff40ee1ecf10ed8de9bce8979dcf 100644 (file)
 ; CHECK-NOT: file_names[
 
 ; CHECK: .debug_pubnames contents:
-; CHECK-NEXT: {{^$}}
+; CHECK-NOT: Offset
 
 ; CHECK: .debug_pubtypes contents:
-; CHECK-NEXT: {{^$}}
+; CHECK-NOT: Offset
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!5}