diff options
author | Alex Lorenz <arphaman@gmail.com> | 2015-07-28 17:03:40 +0000 |
---|---|---|
committer | Alex Lorenz <arphaman@gmail.com> | 2015-07-28 17:03:40 +0000 |
commit | 82a1cfdca26afd5c9278b4640250e27369f9dd80 (patch) | |
tree | bb2cc8d7672fa03d5282a4fb0f3e03285783d170 /llvm/lib/CodeGen/MIRParser/MILexer.cpp | |
parent | 63c9fa01eb04c02b294535fc53a269d7f993f895 (diff) | |
download | bcm5719-llvm-82a1cfdca26afd5c9278b4640250e27369f9dd80.tar.gz bcm5719-llvm-82a1cfdca26afd5c9278b4640250e27369f9dd80.zip |
MIR Parser: Move the function 'lexName'. NFC.
This commit moves the function 'lexName' to the start of the file so it can
be reused by the function which will lex the named LLVM IR block references.
llvm-svn: 243449
Diffstat (limited to 'llvm/lib/CodeGen/MIRParser/MILexer.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MIRParser/MILexer.cpp | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/llvm/lib/CodeGen/MIRParser/MILexer.cpp b/llvm/lib/CodeGen/MIRParser/MILexer.cpp index d730dce6c75..5cdf9cfb7a7 100644 --- a/llvm/lib/CodeGen/MIRParser/MILexer.cpp +++ b/llvm/lib/CodeGen/MIRParser/MILexer.cpp @@ -114,6 +114,26 @@ static Cursor lexStringConstant( return C; } +static Cursor lexName( + Cursor C, MIToken &Token, MIToken::TokenKind Type, + MIToken::TokenKind QuotedType, unsigned PrefixLength, + function_ref<void(StringRef::iterator Loc, const Twine &)> ErrorCallback) { + auto Range = C; + C.advance(PrefixLength); + if (C.peek() == '"') { + if (Cursor R = lexStringConstant(C, ErrorCallback)) { + Token = MIToken(QuotedType, Range.upto(R), PrefixLength); + return R; + } + Token = MIToken(MIToken::Error, Range.remaining()); + return Range; + } + while (isIdentifierChar(C.peek())) + C.advance(); + Token = MIToken(Type, Range.upto(C), PrefixLength); + return C; +} + static MIToken::TokenKind getIdentifierKind(StringRef Identifier) { return StringSwitch<MIToken::TokenKind>(Identifier) .Case("_", MIToken::underscore) @@ -248,26 +268,6 @@ static Cursor maybeLexRegister(Cursor C, MIToken &Token) { return C; } -static Cursor lexName( - Cursor C, MIToken &Token, MIToken::TokenKind Type, - MIToken::TokenKind QuotedType, unsigned PrefixLength, - function_ref<void(StringRef::iterator Loc, const Twine &)> ErrorCallback) { - auto Range = C; - C.advance(PrefixLength); - if (C.peek() == '"') { - if (Cursor R = lexStringConstant(C, ErrorCallback)) { - Token = MIToken(QuotedType, Range.upto(R), PrefixLength); - return R; - } - Token = MIToken(MIToken::Error, Range.remaining()); - return Range; - } - while (isIdentifierChar(C.peek())) - C.advance(); - Token = MIToken(Type, Range.upto(C), PrefixLength); - return C; -} - static Cursor maybeLexGlobalValue( Cursor C, MIToken &Token, function_ref<void(StringRef::iterator Loc, const Twine &)> ErrorCallback) { |