From 1c7fef193f5d013e7e0e495c21122968273d0281 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Tue, 11 Mar 2014 23:35:06 +0000 Subject: [PATCH] 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 --- lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 3 +++ test/DebugInfo/empty.ll | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) 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}