diff options
author | Bill Wendling <isanbard@gmail.com> | 2011-10-19 19:48:46 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2011-10-19 19:48:46 +0000 |
commit | 06bf8ff3f65d105501338517f3b67a3907152ca8 (patch) | |
tree | 9a6406ad0f6fdacb69fa18aeb5ec024d1e69b4b8 | |
parent | d3ada9824f99e2929340a80380984fb0a6a2ea05 (diff) |
Merging r142537:
------------------------------------------------------------------------
r142537 | rafael | 2011-10-19 11:48:52 -0700 (Wed, 19 Oct 2011) | 1 line
Fix parsing of a line with only a # in it.
------------------------------------------------------------------------
git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_30@142539 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/MC/MCParser/AsmParser.cpp | 3 | ||||
-rw-r--r-- | test/MC/AsmParser/line_with_hash.s | 15 |
2 files changed, 17 insertions, 1 deletions
diff --git a/lib/MC/MCParser/AsmParser.cpp b/lib/MC/MCParser/AsmParser.cpp index 4cb4290d82..16487579ab 100644 --- a/lib/MC/MCParser/AsmParser.cpp +++ b/lib/MC/MCParser/AsmParser.cpp @@ -1225,7 +1225,8 @@ bool AsmParser::ParseStatement() { /// EatToEndOfLine uses the Lexer to eat the characters to the end of the line /// since they may not be able to be tokenized to get to the end of line token. void AsmParser::EatToEndOfLine() { - Lexer.LexUntilEndOfLine(); + if (!Lexer.is(AsmToken::EndOfStatement)) + Lexer.LexUntilEndOfLine(); // Eat EOL. Lex(); } diff --git a/test/MC/AsmParser/line_with_hash.s b/test/MC/AsmParser/line_with_hash.s new file mode 100644 index 0000000000..6fdab400f3 --- /dev/null +++ b/test/MC/AsmParser/line_with_hash.s @@ -0,0 +1,15 @@ +# RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s + +// We used to incorrectly parse a line with only a # in it + +.zero 42 +# +.ifndef FOO +.zero 2 +.else +.endif +.zero 24 + +// CHECK: .zero 42 +// CHECK-NEXT: .zero 2 +// CHECK-NEXT: .zero 24 |