llvm.org GIT mirror llvm / f9ec8fe
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 David Majnemer 6 years ago
3 changed file(s) with 25 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
811811 // Parse symbol variant
812812 std::pair Split;
813813 if (!MAI.useParensForSymbolVariant()) {
814 Split = Identifier.split('@');
814 if (FirstTokenKind == AsmToken::String) {
815 if (Lexer.is(AsmToken::At)) {
816 Lexer.Lex(); // eat @
817 SMLoc AtLoc = getLexer().getLoc();
818 StringRef VName;
819 if (parseIdentifier(VName))
820 return Error(AtLoc, "expected symbol variant after '@'");
821
822 Split = std::make_pair(Identifier, VName);
823 }
824 } else {
825 Split = Identifier.split('@');
826 }
815827 } else if (Lexer.is(AsmToken::LParen)) {
816828 Lexer.Lex(); // eat (
817829 StringRef VName;
10601060 if (SM.getStopOnLBrac() && getLexer().getKind() == AsmToken::LBrac)
10611061 break;
10621062
1063 switch (getLexer().getKind()) {
1063 AsmToken::TokenKind TK = getLexer().getKind();
1064 switch (TK) {
10641065 default: {
10651066 if (SM.isValidEndState()) {
10661067 Done = true;
10721073 Done = true;
10731074 break;
10741075 }
1076 case AsmToken::String:
10751077 case AsmToken::Identifier: {
10761078 // This could be a register or a symbolic displacement.
10771079 unsigned TmpReg;
10781080 const MCExpr *Val;
10791081 SMLoc IdentLoc = Tok.getLoc();
10801082 StringRef Identifier = Tok.getString();
1081 if(!ParseRegister(TmpReg, IdentLoc, End)) {
1083 if (TK != AsmToken::String && !ParseRegister(TmpReg, IdentLoc, End)) {
10821084 SM.onRegister(TmpReg);
10831085 UpdateLocLex = false;
10841086 break;
598598 // CHECK: movq _g0+8, %rcx
599599 mov rbx, qword ptr [_g0]
600600 mov rcx, qword ptr [_g0 + 8]
601
602 "?half@?0??bar@@YAXXZ@4NA":
603 .quad 4602678819172646912
604
605 fadd "?half@?0??bar@@YAXXZ@4NA"
606 fadd "?half@?0??bar@@YAXXZ@4NA"@IMGREL
607 // CHECK: fadds "?half@?0??bar@@YAXXZ@4NA"
608 // CHECK: fadds "?half@?0??bar@@YAXXZ@4NA"@IMGREL32