DebugInfo: Remove redundant conditionals/checks from macro info emission
authorDavid Blaikie <dblaikie@gmail.com>
Fri, 8 Nov 2019 23:31:15 +0000 (15:31 -0800)
committerDavid Blaikie <dblaikie@gmail.com>
Fri, 8 Nov 2019 23:31:15 +0000 (15:31 -0800)
These checks fall out naturally from the current implementation without
needing to be explicitly considered anymore.

llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

index 56615584a186b9b13c527d10b096d399d9a3ce27..4b8a44da3e16ae8f4020b8c67508561b3079bb96 100644 (file)
@@ -2729,30 +2729,20 @@ void DwarfDebug::emitMacroFile(DIMacroFile &F, DwarfCompileUnit &U) {
 
 /// Emit macros into a debug macinfo section.
 void DwarfDebug::emitDebugMacinfo() {
-  if (CUMap.empty())
-    return;
-
-  if (llvm::all_of(CUMap, [](const decltype(CUMap)::value_type &Pair) {
-        return Pair.second->getCUNode()->isDebugDirectivesOnly();
-      }))
-    return;
-
   for (const auto &P : CUMap) {
     auto &TheCU = *P.second;
-    if (TheCU.getCUNode()->isDebugDirectivesOnly())
-      continue;
     auto *SkCU = TheCU.getSkeleton();
     DwarfCompileUnit &U = SkCU ? *SkCU : TheCU;
     auto *CUNode = cast<DICompileUnit>(P.first);
     DIMacroNodeArray Macros = CUNode->getMacros();
-    if (!Macros.empty()) {
-      Asm->OutStreamer->SwitchSection(
-          Asm->getObjFileLowering().getDwarfMacinfoSection());
-      Asm->OutStreamer->EmitLabel(U.getMacroLabelBegin());
-      handleMacroNodes(Macros, U);
-      Asm->OutStreamer->AddComment("End Of Macro List Mark");
-      Asm->emitInt8(0);
-    }
+    if (Macros.empty())
+      continue;
+    Asm->OutStreamer->SwitchSection(
+        Asm->getObjFileLowering().getDwarfMacinfoSection());
+    Asm->OutStreamer->EmitLabel(U.getMacroLabelBegin());
+    handleMacroNodes(Macros, U);
+    Asm->OutStreamer->AddComment("End Of Macro List Mark");
+    Asm->emitInt8(0);
   }
 }