diff options
-rw-r--r-- | llvm/lib/MC/MCParser/AsmParser.cpp | 3 | ||||
-rw-r--r-- | llvm/test/MC/AsmParser/debug-only-comments.s | 6 |
2 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp index ee9ed0d27c2..b2ff1e1dc47 100644 --- a/llvm/lib/MC/MCParser/AsmParser.cpp +++ b/llvm/lib/MC/MCParser/AsmParser.cpp @@ -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/llvm/test/MC/AsmParser/debug-only-comments.s b/llvm/test/MC/AsmParser/debug-only-comments.s new file mode 100644 index 00000000000..0330653498b --- /dev/null +++ b/llvm/test/MC/AsmParser/debug-only-comments.s @@ -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>" |