From bdf90d679befafe70b93082042266ba58a9ad0b2 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Mon, 25 Oct 2010 20:18:53 +0000 Subject: [PATCH] MC/AsmLexer: Fix bug in source location for Slash token. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117298 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/MC/MCParser/AsmLexer.cpp | 2 +- test/MC/AsmParser/exprs.s | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/MC/MCParser/AsmLexer.cpp b/lib/MC/MCParser/AsmLexer.cpp index 7ca1cccc98c..867cb208cec 100644 --- a/lib/MC/MCParser/AsmLexer.cpp +++ b/lib/MC/MCParser/AsmLexer.cpp @@ -119,7 +119,7 @@ AsmToken AsmLexer::LexSlash() { switch (*CurPtr) { case '*': break; // C style comment. case '/': return ++CurPtr, LexLineComment(); - default: return AsmToken(AsmToken::Slash, StringRef(CurPtr, 1)); + default: return AsmToken(AsmToken::Slash, StringRef(CurPtr-1, 1)); } // C Style comment. diff --git a/test/MC/AsmParser/exprs.s b/test/MC/AsmParser/exprs.s index 4e514032b6c..1cc96a3f418 100644 --- a/test/MC/AsmParser/exprs.s +++ b/test/MC/AsmParser/exprs.s @@ -19,9 +19,8 @@ k: check_expr +1, 1 check_expr 1 + 2, 3 check_expr 1 & 3, 1 - // FIXME: There is a bug here in macro expansion. - .byte 4 / 2 - .byte 4 / -2 + check_expr 4 / 2, 2 + check_expr 4 / -2, -2 check_expr 1 == 1, 1 check_expr 1 == 0, 0 check_expr 1 > 0, 1