[PATCH] MIR Lexer: adopt the 'maybeLex...' pattern.
Alex L
arphaman at gmail.com
Tue Jun 30 09:45:31 PDT 2015
2015-06-29 18:36 GMT-07:00 Sean Silva <chisophugis at gmail.com>:
> LGTM with a nit.
>
>
> REPOSITORY
> rL LLVM
>
> ================
> Comment at: lib/CodeGen/MIRParser/MILexer.cpp:182
> @@ -164,16 +181,3 @@
>
> - auto Char = C.peek();
> - if (isalpha(Char) || Char == '_')
> - return lexIdentifier(C, Token).remaining();
> - if (Char == '%') {
> - if (C.remaining().startswith("%bb."))
> - return lexMachineBasicBlock(C, Token, ErrorCallback).remaining();
> - return lexPercent(C, Token).remaining();
> - }
> - if (Char == '@')
> - return lexGlobalValue(C, Token).remaining();
> - if (isdigit(Char) || (Char == '-' && isdigit(C.peek(1))))
> - return lexIntegerLiteral(C, Token).remaining();
> - MIToken::TokenKind Kind = symbolToken(Char);
> - if (Kind != MIToken::Error)
> - return lexSymbol(C, Kind, Token).remaining();
> + if (auto R = maybeLexIdentifier(C, Token))
> + return R.remaining();
> ----------------
> Even though I know this pattern returns a cursor, I found myself looking
> around to confirm that the `auto` was hiding a cursor. I would prefer to
> just say `Cursor`.
>
Thanks, I will commit this patch with 'auto' replaced by 'Cursor'.
Alex
>
> http://reviews.llvm.org/D10817
>
> EMAIL PREFERENCES
> http://reviews.llvm.org/settings/panel/emailpreferences/
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150630/46688540/attachment.html>
More information about the llvm-commits
mailing list