Skip to content

Commit 4ca2947

Browse files
committed
[DWARF] Emit reasonable debug info for empty .s files.
llvm-svn: 352541
1 parent 58fc808 commit 4ca2947

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

llvm/lib/MC/MCParser/AsmParser.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -900,6 +900,9 @@ bool AsmParser::Run(bool NoInitialTextSection, bool NoFinalize) {
900900
eatToEndOfStatement();
901901
}
902902

903+
// Make sure we get proper DWARF even for empty files.
904+
(void)enabledGenDwarfForAssembly();
905+
903906
getTargetParser().onEndOfFile();
904907
printPendingErrors();
905908

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# RUN: llvm-mc -triple i386-linux-gnu -g -dwarf-version 4 < %s | FileCheck %s
2+
# RUN: llvm-mc -triple i386-linux-gnu -g -dwarf-version 5 < %s | FileCheck %s
3+
# CHECK: .section .debug_info
4+
# CHECK: .section .debug_info
5+
# CHECK-NOT: .section
6+
# CHECK: .ascii "<stdin>"

0 commit comments

Comments
 (0)