summaryrefslogtreecommitdiff
path: root/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
commitf9ec8fe70c5084a15372cc0b126218f699794e24 (patch)
tree3ab65f3643ba87a0cee288e7105f2d1c8952a781 /lib/MC
parentd9b35435b89015d154b0e20f4d4796d936237f84 (diff)
downloadllvm-f9ec8fe70c5084a15372cc0b126218f699794e24.tar.gz
llvm-f9ec8fe70c5084a15372cc0b126218f699794e24.tar.bz2
llvm-f9ec8fe70c5084a15372cc0b126218f699794e24.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211249 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC')
-rw-r--r--lib/MC/MCParser/AsmParser.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/MC/MCParser/AsmParser.cpp b/lib/MC/MCParser/AsmParser.cpp
index 932d0f3318..1ba02d181d 100644
--- a/lib/MC/MCParser/AsmParser.cpp
+++ b/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;