]> granicus.if.org Git - llvm/commitdiff
[DWARF] Emit reasonable debug info for empty .s files.
authorPaul Robinson <paul.robinson@sony.com>
Tue, 29 Jan 2019 20:53:51 +0000 (20:53 +0000)
committerPaul Robinson <paul.robinson@sony.com>
Tue, 29 Jan 2019 20:53:51 +0000 (20:53 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352541 91177308-0d34-0410-b5e6-96231b3b80d8

lib/MC/MCParser/AsmParser.cpp
test/MC/AsmParser/debug-only-comments.s [new file with mode: 0644]

index ee9ed0d27c263e5a91f0fee116678af1df1e44db..b2ff1e1dc472c057d67a242f063c33db1d9e457e 100644 (file)
@@ -900,6 +900,9 @@ bool AsmParser::Run(bool NoInitialTextSection, bool NoFinalize) {
       eatToEndOfStatement();
   }
 
+  // Make sure we get proper DWARF even for empty files.
+  (void)enabledGenDwarfForAssembly();
+
   getTargetParser().onEndOfFile();
   printPendingErrors();
 
diff --git a/test/MC/AsmParser/debug-only-comments.s b/test/MC/AsmParser/debug-only-comments.s
new file mode 100644 (file)
index 0000000..0330653
--- /dev/null
@@ -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>"