MC: do not add comment string to the AsmToken in AsmLexer::LexLineComment
authorSaleem Abdulrasool <compnerd@compnerd.org>
Wed, 18 Jun 2014 20:57:32 +0000 (20:57 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Wed, 18 Jun 2014 20:57:32 +0000 (20:57 +0000)
Fixes macros with varargs if the macro instantiation has a trailing comment.

Patch by Janne Grunau!

llvm-svn: 211219

llvm/lib/MC/MCParser/AsmLexer.cpp
llvm/test/MC/AsmParser/vararg.s

index bca516e..7991ef5 100644 (file)
@@ -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) {
index b27668e..e3236b0 100644 (file)
 .endif
 .endm
 
+.macro ifcc4 arg0, arg1:vararg
+.if cc
+            movl \arg1, \arg0
+.endif
+.endm
+
 .text
 
 // CHECK: movl %esp, %ebp
@@ -25,6 +31,8 @@
 // CHECK: movl %ecx, %ebx
 // CHECK: movl %ecx, %eax
 // CHECK: movl %eax, %ecx
+// CHECK: movl %ecx, %eax
+// CHECK: movl %eax, %ecx
 .set cc,1
   ifcc  movl    %esp, %ebp
         subl $0, %esp
@@ -33,6 +41,8 @@
   ifcc2 %ecx, %ebx
   ifcc3 %ecx %eax
   ifcc3 %eax, %ecx
+  ifcc4 %eax %ecx  ## test
+  ifcc4 %ecx, %eax ## test
 
 // CHECK-NOT movl
 // CHECK: subl $1, %esp