llvm.org GIT mirror llvm / 7db4f8d
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 David Peixotto 6 years ago
2 changed file(s) with 2 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
2929 const char *CurPtr;
3030 const MemoryBuffer *CurBuf;
3131 bool isAtStartOfLine;
32 bool AllowAtInIdentifier; // Cached here to avoid repeated MAI query.
3233
3334 void operator=(const AsmLexer&) LLVM_DELETED_FUNCTION;
3435 AsmLexer(const AsmLexer&) LLVM_DELETED_FUNCTION;
2424 CurBuf = NULL;
2525 CurPtr = NULL;
2626 isAtStartOfLine = true;
27 AllowAtInIdentifier = !StringRef(MAI.getCommentString()).startswith("@");
2728 }
2829
2930 AsmLexer::~AsmLexer() {
143144 (c == '@' && AllowAt) || c == '?';
144145 }
145146 AsmToken AsmLexer::LexIdentifier() {
146 bool AllowAtInIdentifier = !StringRef(MAI.getCommentString()).startswith("@");
147147 // Check for floating point literals.
148148 if (CurPtr[-1] == '.' && isdigit(*CurPtr)) {
149149 // Disambiguate a .1243foo identifier from a floating literal.