[llvm-commits] [llvm] r147951 - in /llvm/trunk: lib/MC/MCParser/AsmParser.cpp test/MC/AsmParser/directive_file-errors.s
Kevin Enderby
enderby at apple.com
Wed Jan 11 10:04:47 PST 2012
Author: enderby
Date: Wed Jan 11 12:04:47 2012
New Revision: 147951
URL: http://llvm.org/viewvc/llvm-project?rev=147951&view=rev
Log:
The error check for using -g with a .s file already containing dwarf .file
directives was in the wrong place and getting triggered incorectly with a
cpp .file directive. This change fixes that and adds a test case.
Added:
llvm/trunk/test/MC/AsmParser/directive_file-errors.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=147951&r1=147950&r2=147951&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/AsmParser.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/AsmParser.cpp Wed Jan 11 12:04:47 2012
@@ -2424,13 +2424,13 @@
if (getLexer().isNot(AsmToken::EndOfStatement))
return TokError("unexpected token in '.file' directive");
- if (getContext().getGenDwarfForAssembly() == true)
- Error(DirectiveLoc, "input can't have .file dwarf directives when -g is "
- "used to generate dwarf debug info for assembly code");
-
if (FileNumber == -1)
getStreamer().EmitFileDirective(Filename);
else {
+ if (getContext().getGenDwarfForAssembly() == true)
+ Error(DirectiveLoc, "input can't have .file dwarf directives when -g is "
+ "used to generate dwarf debug info for assembly code");
+
if (getStreamer().EmitDwarfFileDirective(FileNumber, Directory, Filename))
Error(FileNumberLoc, "file number already allocated");
}
Added: llvm/trunk/test/MC/AsmParser/directive_file-errors.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/directive_file-errors.s?rev=147951&view=auto
==============================================================================
--- llvm/trunk/test/MC/AsmParser/directive_file-errors.s (added)
+++ llvm/trunk/test/MC/AsmParser/directive_file-errors.s Wed Jan 11 12:04:47 2012
@@ -0,0 +1,9 @@
+// RUN: not llvm-mc -g -triple i386-unknown-unknown %s 2> %t.err | FileCheck %s
+// RUN: FileCheck --check-prefix=CHECK-ERRORS %s < %t.err
+// Test for Bug 11740
+
+ .file "hello"
+ .file 1 "world"
+
+// CHECK: .file "hello"
+// CHECK-ERRORS:6:9: error: input can't have .file dwarf directives when -g is used to generate dwarf debug info for assembly code
More information about the llvm-commits
mailing list