[llvm] r211219 - MC: do not add comment string to the AsmToken in AsmLexer::LexLineComment

Saleem Abdulrasool compnerd at compnerd.org
Wed Jun 18 13:57:32 PDT 2014


Author: compnerd
Date: Wed Jun 18 15:57:32 2014
New Revision: 211219

URL: http://llvm.org/viewvc/llvm-project?rev=211219&view=rev
Log:
MC: do not add comment string to the AsmToken in AsmLexer::LexLineComment

Fixes macros with varargs if the macro instantiation has a trailing comment.

Patch by Janne Grunau!

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

Modified: llvm/trunk/lib/MC/MCParser/AsmLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/AsmLexer.cpp?rev=211219&r1=211218&r2=211219&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/AsmLexer.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/AsmLexer.cpp Wed Jun 18 15:57:32 2014
@@ -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) {

Modified: llvm/trunk/test/MC/AsmParser/vararg.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/vararg.s?rev=211219&r1=211218&r2=211219&view=diff
==============================================================================
--- llvm/trunk/test/MC/AsmParser/vararg.s (original)
+++ llvm/trunk/test/MC/AsmParser/vararg.s Wed Jun 18 15:57:32 2014
@@ -17,6 +17,12 @@
 .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





More information about the llvm-commits mailing list