From: David Blaikie Date: Tue, 11 Mar 2014 23:35:06 +0000 (+0000) Subject: DebugInfo: Do not emit pubnames/pubtypes sections if they are empty X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=1c7fef193f5d013e7e0e495c21122968273d0281;p=oota-llvm.git DebugInfo: Do not emit pubnames/pubtypes sections if they are empty git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203622 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 45a90dc12d7..401145d923c 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -2215,6 +2215,9 @@ void DwarfDebug::emitDebugPubSection( const auto &Globals = (TheU->*Accessor)(); + if (Globals.empty()) + continue; + if (auto Skeleton = static_cast(TheU->getSkeleton())) TheU = Skeleton; unsigned ID = TheU->getUniqueID(); diff --git a/test/DebugInfo/empty.ll b/test/DebugInfo/empty.ll index 2885eb51fcc..1fb18166146 100644 --- a/test/DebugInfo/empty.ll +++ b/test/DebugInfo/empty.ll @@ -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}