mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-01 07:30:33 +00:00
MC/AsmParser: Change ParseExpression to use ParseIdentifier(), to support
dollars in identifiers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111946 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ee9102587e
commit
e17edff28f
@ -449,10 +449,17 @@ bool AsmParser::ParsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc) {
|
||||
return true;
|
||||
Res = MCUnaryExpr::CreateLNot(Res, getContext());
|
||||
return false;
|
||||
case AsmToken::Dollar:
|
||||
case AsmToken::String:
|
||||
case AsmToken::Identifier: {
|
||||
EndLoc = Lexer.getLoc();
|
||||
|
||||
StringRef Identifier;
|
||||
if (ParseIdentifier(Identifier))
|
||||
return false;
|
||||
|
||||
// This is a symbol reference.
|
||||
std::pair<StringRef, StringRef> Split = getTok().getIdentifier().split('@');
|
||||
std::pair<StringRef, StringRef> Split = Identifier.split('@');
|
||||
MCSymbol *Sym = getContext().GetOrCreateSymbol(Split.first);
|
||||
|
||||
// Mark the symbol as used in an expression.
|
||||
@ -460,12 +467,9 @@ bool AsmParser::ParsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc) {
|
||||
|
||||
// Lookup the symbol variant if used.
|
||||
MCSymbolRefExpr::VariantKind Variant = MCSymbolRefExpr::VK_None;
|
||||
if (Split.first.size() != getTok().getIdentifier().size())
|
||||
if (Split.first.size() != Identifier.size())
|
||||
Variant = MCSymbolRefExpr::getVariantKindForName(Split.second);
|
||||
|
||||
EndLoc = Lexer.getLoc();
|
||||
Lex(); // Eat identifier.
|
||||
|
||||
// If this is an absolute variable reference, substitute it now to preserve
|
||||
// semantics in the face of reassignment.
|
||||
if (Sym->isVariable() && isa<MCConstantExpr>(Sym->getVariableValue())) {
|
||||
|
@ -3,3 +3,5 @@
|
||||
|
||||
// CHECK: .globl $foo
|
||||
.globl $foo
|
||||
// CHECK: .long ($foo)
|
||||
.long ($foo)
|
||||
|
Loading…
Reference in New Issue
Block a user