mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 04:30:12 +00:00
Cache AllowAtInIdentifier as class variable in AsmLexer
This commit caches the value of the AllowAtInIdentifier variable as a class variable in AsmLexer. We do this to avoid repeated MAI queries and string comparisons each time we lex an identifier. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196622 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
74999cfe0c
commit
7db4f8d9d8
@ -30,6 +30,7 @@ class AsmLexer : public MCAsmLexer {
|
|||||||
const char *CurPtr;
|
const char *CurPtr;
|
||||||
const MemoryBuffer *CurBuf;
|
const MemoryBuffer *CurBuf;
|
||||||
bool isAtStartOfLine;
|
bool isAtStartOfLine;
|
||||||
|
bool AllowAtInIdentifier; // Cached here to avoid repeated MAI query.
|
||||||
|
|
||||||
void operator=(const AsmLexer&) LLVM_DELETED_FUNCTION;
|
void operator=(const AsmLexer&) LLVM_DELETED_FUNCTION;
|
||||||
AsmLexer(const AsmLexer&) LLVM_DELETED_FUNCTION;
|
AsmLexer(const AsmLexer&) LLVM_DELETED_FUNCTION;
|
||||||
|
@ -25,6 +25,7 @@ AsmLexer::AsmLexer(const MCAsmInfo &_MAI) : MAI(_MAI) {
|
|||||||
CurBuf = NULL;
|
CurBuf = NULL;
|
||||||
CurPtr = NULL;
|
CurPtr = NULL;
|
||||||
isAtStartOfLine = true;
|
isAtStartOfLine = true;
|
||||||
|
AllowAtInIdentifier = !StringRef(MAI.getCommentString()).startswith("@");
|
||||||
}
|
}
|
||||||
|
|
||||||
AsmLexer::~AsmLexer() {
|
AsmLexer::~AsmLexer() {
|
||||||
@ -144,7 +145,6 @@ static bool IsIdentifierChar(char c, bool AllowAt) {
|
|||||||
(c == '@' && AllowAt) || c == '?';
|
(c == '@' && AllowAt) || c == '?';
|
||||||
}
|
}
|
||||||
AsmToken AsmLexer::LexIdentifier() {
|
AsmToken AsmLexer::LexIdentifier() {
|
||||||
bool AllowAtInIdentifier = !StringRef(MAI.getCommentString()).startswith("@");
|
|
||||||
// Check for floating point literals.
|
// Check for floating point literals.
|
||||||
if (CurPtr[-1] == '.' && isdigit(*CurPtr)) {
|
if (CurPtr[-1] == '.' && isdigit(*CurPtr)) {
|
||||||
// Disambiguate a .1243foo identifier from a floating literal.
|
// Disambiguate a .1243foo identifier from a floating literal.
|
||||||
|
Loading…
Reference in New Issue
Block a user