summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm/MC/MCParser/AsmLexer.h1
-rw-r--r--lib/MC/MCParser/AsmLexer.cpp2
2 files changed, 2 insertions, 1 deletions
diff --git a/include/llvm/MC/MCParser/AsmLexer.h b/include/llvm/MC/MCParser/AsmLexer.h
index 1b3ab57751..a97b450a46 100644
--- a/include/llvm/MC/MCParser/AsmLexer.h
+++ b/include/llvm/MC/MCParser/AsmLexer.h
@@ -30,6 +30,7 @@ class AsmLexer : public MCAsmLexer {
const char *CurPtr;
const MemoryBuffer *CurBuf;
bool isAtStartOfLine;
+ bool AllowAtInIdentifier; // Cached here to avoid repeated MAI query.
void operator=(const AsmLexer&) LLVM_DELETED_FUNCTION;
AsmLexer(const AsmLexer&) LLVM_DELETED_FUNCTION;
diff --git a/lib/MC/MCParser/AsmLexer.cpp b/lib/MC/MCParser/AsmLexer.cpp
index a066e64830..ed98f93758 100644
--- a/lib/MC/MCParser/AsmLexer.cpp
+++ b/lib/MC/MCParser/AsmLexer.cpp
@@ -25,6 +25,7 @@ AsmLexer::AsmLexer(const MCAsmInfo &_MAI) : MAI(_MAI) {
CurBuf = NULL;
CurPtr = NULL;
isAtStartOfLine = true;
+ AllowAtInIdentifier = !StringRef(MAI.getCommentString()).startswith("@");
}
AsmLexer::~AsmLexer() {
@@ -144,7 +145,6 @@ static bool IsIdentifierChar(char c, bool AllowAt) {
(c == '@' && AllowAt) || c == '?';
}
AsmToken AsmLexer::LexIdentifier() {
- bool AllowAtInIdentifier = !StringRef(MAI.getCommentString()).startswith("@");
// Check for floating point literals.
if (CurPtr[-1] == '.' && isdigit(*CurPtr)) {
// Disambiguate a .1243foo identifier from a floating literal.