[llvm] r203622 - DebugInfo: Do not emit pubnames/pubtypes sections if they are empty

David Blaikie dblaikie at gmail.com
Tue Mar 11 16:35:06 PDT 2014


Author: dblaikie
Date: Tue Mar 11 18:35:06 2014
New Revision: 203622

URL: http://llvm.org/viewvc/llvm-project?rev=203622&view=rev
Log:
DebugInfo: Do not emit pubnames/pubtypes sections if they are empty

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
    llvm/trunk/test/DebugInfo/empty.ll

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=203622&r1=203621&r2=203622&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Tue Mar 11 18:35:06 2014
@@ -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();

Modified: llvm/trunk/test/DebugInfo/empty.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/empty.ll?rev=203622&r1=203621&r2=203622&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/empty.ll (original)
+++ llvm/trunk/test/DebugInfo/empty.ll Tue Mar 11 18:35:06 2014
@@ -12,10 +12,10 @@
 ; 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}





More information about the llvm-commits mailing list