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

Saleem Abdulrasool compnerd at compnerd.org
Wed Jun 18 14:06:43 PDT 2014


On Wed, Jun 11, 2014 at 6:15 PM, Saleem Abdulrasool <compnerd at compnerd.org>
wrote:

> On Wed, Jun 11, 2014 at 12:25 PM, Janne Grunau <j at jannau.net> wrote:
>
>> Fixes macros with varargs if the macro instantiation has a trailing
>> comment.
>>
>
> LGTM
>

Committed as SVN r211219.


>
>
>>  ---
>> adds a macro to test out of order arguments with varargs and trailing
>> trailing comment
>>
>> I missed the comma between the macro arguments in ifcc2 and ifcc3 so it
>> looked as if they testing exactly the same
>>
>>
>>  lib/MC/MCParser/AsmLexer.cpp |  4 ++--
>>  test/MC/AsmParser/vararg.s   | 10 ++++++++++
>>  2 files changed, 12 insertions(+), 2 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..e3236b0 100644
>> --- a/test/MC/AsmParser/vararg.s
>> +++ b/test/MC/AsmParser/vararg.s
>> @@ -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
>> --
>> 2.0.0
>>
>>
>
>
> --
> Saleem Abdulrasool
> compnerd (at) compnerd (dot) org
>



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


More information about the llvm-commits mailing list