[llvm] r352541 - [DWARF] Emit reasonable debug info for empty .s files.

Paul Robinson via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 29 12:53:52 PST 2019


Author: probinson
Date: Tue Jan 29 12:53:51 2019
New Revision: 352541

URL: http://llvm.org/viewvc/llvm-project?rev=352541&view=rev
Log:
[DWARF] Emit reasonable debug info for empty .s files.

Added:
    llvm/trunk/test/MC/AsmParser/debug-only-comments.s
Modified:
    llvm/trunk/lib/MC/MCParser/AsmParser.cpp

Modified: llvm/trunk/lib/MC/MCParser/AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/AsmParser.cpp?rev=352541&r1=352540&r2=352541&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/AsmParser.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/AsmParser.cpp Tue Jan 29 12:53:51 2019
@@ -900,6 +900,9 @@ bool AsmParser::Run(bool NoInitialTextSe
       eatToEndOfStatement();
   }
 
+  // Make sure we get proper DWARF even for empty files.
+  (void)enabledGenDwarfForAssembly();
+
   getTargetParser().onEndOfFile();
   printPendingErrors();
 

Added: llvm/trunk/test/MC/AsmParser/debug-only-comments.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/debug-only-comments.s?rev=352541&view=auto
==============================================================================
--- llvm/trunk/test/MC/AsmParser/debug-only-comments.s (added)
+++ llvm/trunk/test/MC/AsmParser/debug-only-comments.s Tue Jan 29 12:53:51 2019
@@ -0,0 +1,6 @@
+        # RUN: llvm-mc -triple i386-linux-gnu -g -dwarf-version 4 < %s | FileCheck %s
+        # RUN: llvm-mc -triple i386-linux-gnu -g -dwarf-version 5 < %s | FileCheck %s
+        # CHECK: .section .debug_info
+        # CHECK: .section .debug_info
+        # CHECK-NOT: .section
+        # CHECK: .ascii "<stdin>"




More information about the llvm-commits mailing list