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

Saleem Abdulrasool compnerd at compnerd.org
Wed Jun 11 10:09:58 PDT 2014


On Thu, May 29, 2014 at 3:05 PM, Janne Grunau <j at jannau.net> wrote:

> 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
>

Might be nicer to actually create a second macro and use that to keep the
coverage for in order and out of order parameters to variadic macros.


> --
> 1.9.3
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>



-- 
Saleem Abdulrasool
compnerd (at) compnerd (dot) org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140611/5ef78b73/attachment.html>


More information about the llvm-commits mailing list