This patch refactors the MI lexer so that the lexing functions use the 'maybeLex...' pattern, where the lexing functions determine if they can lex the current token by themselves.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
LGTM with a nit.
lib/CodeGen/MIRParser/MILexer.cpp | ||
---|---|---|
182 ↗ | (On Diff #28716) | 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. |
Comment Actions
2015-06-29 18:36 GMT-07:00 Sean Silva <chisophugis@gmail.com>:
LGTM with a nit.
REPOSITORY
rL LLVMComment 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/