Don't emit .debug_line header data if there aren't any lines to put in it,
authorDan Gohman <gohman@apple.com>
Mon, 24 Sep 2007 21:43:52 +0000 (21:43 +0000)
committerDan Gohman <gohman@apple.com>
Mon, 24 Sep 2007 21:43:52 +0000 (21:43 +0000)
such as will happen when .loc directives are used.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42277 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/DwarfWriter.cpp

index 8250558b26780d687603f264b4c6ab648c7da7aa..f962e487340127df7f7b98d3c65d00786a4849c8 100644 (file)
@@ -2196,6 +2196,11 @@ private:
   /// EmitDebugLines - Emit source line information.
   ///
   void EmitDebugLines() {
+    // If there are no lines to emit (such as when we're using .loc directives
+    // to emit .debug_line information) don't emit a .debug_line header.
+    if (SectionSourceLines.empty())
+      return;
+
     // Minimum line delta, thus ranging from -10..(255-10).
     const int MinLineDelta = -(DW_LNS_fixed_advance_pc + 1);
     // Maximum line delta, thus ranging from -10..(255-10).