summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2014-06-19 01:25:43 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2014-06-19 01:25:43 +0000
commit6a5b812c7b8ae96f7e07ca8512c7e3e0a4eee636 (patch)
tree9ff05290792fc1afe15b929d74accc77bec34345 /llvm/lib/MC
parentc05ca5e40c7eee09a12fe5fff81e7ca1b3450aba (diff)
downloadbcm5719-llvm-6a5b812c7b8ae96f7e07ca8512c7e3e0a4eee636.tar.gz
bcm5719-llvm-6a5b812c7b8ae96f7e07ca8512c7e3e0a4eee636.zip
MS asm: Properly handle quoted symbol names
We would get confused by '@' characters in symbol names, we would mistake the text following them for the variant kind. When an identifier a string, the variant kind will never show up inside of it. Instead, check to see if there is a variant following the string. This fixes PR19965. llvm-svn: 211249
Diffstat (limited to 'llvm/lib/MC')
-rw-r--r--llvm/lib/MC/MCParser/AsmParser.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp
index 932d0f3318e..1ba02d181db 100644
--- a/llvm/lib/MC/MCParser/AsmParser.cpp
+++ b/llvm/lib/MC/MCParser/AsmParser.cpp
@@ -812,7 +812,19 @@ bool AsmParser::parsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc) {
// Parse symbol variant
std::pair<StringRef, StringRef> Split;
if (!MAI.useParensForSymbolVariant()) {
- Split = Identifier.split('@');
+ if (FirstTokenKind == AsmToken::String) {
+ if (Lexer.is(AsmToken::At)) {
+ Lexer.Lex(); // eat @
+ SMLoc AtLoc = getLexer().getLoc();
+ StringRef VName;
+ if (parseIdentifier(VName))
+ return Error(AtLoc, "expected symbol variant after '@'");
+
+ Split = std::make_pair(Identifier, VName);
+ }
+ } else {
+ Split = Identifier.split('@');
+ }
} else if (Lexer.is(AsmToken::LParen)) {
Lexer.Lex(); // eat (
StringRef VName;
OpenPOWER on IntegriCloud