[llvm-commits] [llvm] r80929 - in /llvm/trunk: include/llvm/MC/MCAsmLexer.h lib/Target/X86/AsmParser/X86AsmParser.cpp tools/llvm-mc/AsmLexer.cpp tools/llvm-mc/AsmLexer.h tools/llvm-mc/llvm-mc.cpp

Kevin Enderby enderby at apple.com
Tue Sep 15 16:52:11 PDT 2009


Yep that user error would assert currently.  I'll fix it up.

Thanks for the catch,
Kev

On Sep 15, 2009, at 4:45 PM, Daniel Dunbar wrote:

> Hi Kevin,
>
> One comment...
>
> On Thu, Sep 3, 2009 at 10:15 AM, Kevin Enderby <enderby at apple.com>  
> wrote:
>> Author: enderby
>> Date: Thu Sep  3 12:15:07 2009
>> New Revision: 80929
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=80929&view=rev
>> Log:
>> Removed the non-target independent AsmToken::Register enum constant
>> from MCAsmLexer.h in preparation of supporting other targets.   
>> Changed the
>> X86AsmParser code to reflect this by removing AsmLexer::LexPercent  
>> and looking
>> for AsmToken::Percent when parsing in places that used  
>> AsmToken::Register.
>> Then changed X86ATTAsmParser::ParseRegister to parse out registers  
>> as an
>> AsmToken::Percent followed by an AsmToken::Identifier.
>
>> ===================================================================== 
>> =========
>> --- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original)
>> +++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Thu Sep   
>> 3 12:15:07 2009
>> @@ -230,20 +230,23 @@
>>
>>
>>  bool X86ATTAsmParser::ParseRegister(X86Operand &Op) {
>> +  const AsmToken &TokPercent = getLexer().getTok();
>> +  assert(TokPercent.is(AsmToken::Percent) && "Invalid token kind!");
>> +  getLexer().Lex(); // Eat percent token.
>> +
>>   const AsmToken &Tok = getLexer().getTok();
>> -  assert(Tok.is(AsmToken::Register) && "Invalid token kind!");
>> +  assert(TokPercent.is(AsmToken::Identifier) && "Invalid token  
>> kind!");
>
> This should be a branch not an assert (so a user error is detected), I
> think code like 'mov $0, %%eax' will assert currently.
>
>  - Daniel




More information about the llvm-commits mailing list