From 4629ccd94733abff39537e17a46f6564d74c43ec 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 llvm-svn: 203622 --- 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}