[PATCH 2/2] MC: do not add comment string to the AsmToken in AsmLexer::LexLineComment

Janne Grunau j at jannau.net
Thu May 29 15:05:43 PDT 2014


Fixes macros with varargs if the macro instantiation has a trailing comment.
---
 lib/MC/MCParser/AsmLexer.cpp | 4 ++--
 test/MC/AsmParser/vararg.s   | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/MC/MCParser/AsmLexer.cpp b/lib/MC/MCParser/AsmLexer.cpp
index bca516e..7991ef5 100644
--- a/lib/MC/MCParser/AsmLexer.cpp
+++ b/lib/MC/MCParser/AsmLexer.cpp
@@ -201,8 +201,8 @@ AsmToken AsmLexer::LexLineComment() {
     CurChar = getNextChar();
 
   if (CurChar == EOF)
-    return AsmToken(AsmToken::Eof, StringRef(CurPtr, 0));
-  return AsmToken(AsmToken::EndOfStatement, StringRef(CurPtr, 0));
+    return AsmToken(AsmToken::Eof, StringRef(TokStart, 0));
+  return AsmToken(AsmToken::EndOfStatement, StringRef(TokStart, 0));
 }
 
 static void SkipIgnoredIntegerSuffix(const char *&CurPtr) {
diff --git a/test/MC/AsmParser/vararg.s b/test/MC/AsmParser/vararg.s
index b27668e..4b145f7 100644
--- a/test/MC/AsmParser/vararg.s
+++ b/test/MC/AsmParser/vararg.s
@@ -13,7 +13,7 @@
 
 .macro ifcc3 arg0, arg1:vararg
 .if cc
-            movl \arg0, \arg1
+            movl \arg1, \arg0
 .endif
 .endm
 
@@ -31,8 +31,8 @@
 
   ifcc2 %eax %ebx
   ifcc2 %ecx, %ebx
-  ifcc3 %ecx %eax
-  ifcc3 %eax, %ecx
+  ifcc3 %eax %ecx  ## test
+  ifcc3 %ecx, %eax ## test
 
 // CHECK-NOT movl
 // CHECK: subl $1, %esp
-- 
1.9.3




More information about the llvm-commits mailing list