summaryrefslogtreecommitdiff
path: root/llvm/lib/MC/MCParser/DarwinAsmParser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/MC/MCParser/DarwinAsmParser.cpp')
-rw-r--r--llvm/lib/MC/MCParser/DarwinAsmParser.cpp44
1 files changed, 14 insertions, 30 deletions
diff --git a/llvm/lib/MC/MCParser/DarwinAsmParser.cpp b/llvm/lib/MC/MCParser/DarwinAsmParser.cpp
index a9095b3298f5..fceb718d091c 100644
--- a/llvm/lib/MC/MCParser/DarwinAsmParser.cpp
+++ b/llvm/lib/MC/MCParser/DarwinAsmParser.cpp
@@ -501,13 +501,10 @@ bool DarwinAsmParser::parseSectionSwitch(StringRef Segment, StringRef Section,
/// parseDirectiveAltEntry
/// ::= .alt_entry identifier
bool DarwinAsmParser::parseDirectiveAltEntry(StringRef, SMLoc) {
- StringRef Name;
- if (getParser().parseIdentifier(Name))
+ MCSymbol *Sym;
+ if (getParser().parseSymbol(Sym))
return TokError("expected identifier in directive");
- // Look up symbol.
- MCSymbol *Sym = getContext().getOrCreateSymbol(Name);
-
if (Sym->isDefined())
return TokError(".alt_entry must preceed symbol definition");
@@ -521,13 +518,10 @@ bool DarwinAsmParser::parseDirectiveAltEntry(StringRef, SMLoc) {
/// parseDirectiveDesc
/// ::= .desc identifier , expression
bool DarwinAsmParser::parseDirectiveDesc(StringRef, SMLoc) {
- StringRef Name;
- if (getParser().parseIdentifier(Name))
+ MCSymbol *Sym;
+ if (getParser().parseSymbol(Sym))
return TokError("expected identifier in directive");
- // Handle the identifier as the key symbol.
- MCSymbol *Sym = getContext().getOrCreateSymbol(Name);
-
if (getLexer().isNot(AsmToken::Comma))
return TokError("unexpected token in '.desc' directive");
Lex();
@@ -560,18 +554,17 @@ bool DarwinAsmParser::parseDirectiveIndirectSymbol(StringRef, SMLoc Loc) {
return Error(Loc, "indirect symbol not in a symbol pointer or stub "
"section");
- StringRef Name;
- if (getParser().parseIdentifier(Name))
+ MCSymbol *Sym;
+ if (getParser().parseSymbol(Sym))
return TokError("expected identifier in .indirect_symbol directive");
- MCSymbol *Sym = getContext().getOrCreateSymbol(Name);
-
// Assembler local symbols don't make any sense here. Complain loudly.
if (Sym->isTemporary())
return TokError("non-local symbol required in directive");
if (!getStreamer().emitSymbolAttribute(Sym, MCSA_IndirectSymbol))
- return TokError("unable to emit indirect symbol attribute for: " + Name);
+ return TokError("unable to emit indirect symbol attribute for: " +
+ Sym->getName());
if (getLexer().isNot(AsmToken::EndOfStatement))
return TokError("unexpected token in '.indirect_symbol' directive");
@@ -633,13 +626,10 @@ bool DarwinAsmParser::parseDirectiveLinkerOption(StringRef IDVal, SMLoc) {
/// parseDirectiveLsym
/// ::= .lsym identifier , expression
bool DarwinAsmParser::parseDirectiveLsym(StringRef, SMLoc) {
- StringRef Name;
- if (getParser().parseIdentifier(Name))
+ MCSymbol *Sym;
+ if (getParser().parseSymbol(Sym))
return TokError("expected identifier in directive");
- // Handle the identifier as the key symbol.
- MCSymbol *Sym = getContext().getOrCreateSymbol(Name);
-
if (getLexer().isNot(AsmToken::Comma))
return TokError("unexpected token in '.lsym' directive");
Lex();
@@ -826,13 +816,10 @@ bool DarwinAsmParser::parseDirectiveSubsectionsViaSymbols(StringRef, SMLoc) {
/// ::= .tbss identifier, size, align
bool DarwinAsmParser::parseDirectiveTBSS(StringRef, SMLoc) {
SMLoc IDLoc = getLexer().getLoc();
- StringRef Name;
- if (getParser().parseIdentifier(Name))
+ MCSymbol *Sym;
+ if (getParser().parseSymbol(Sym))
return TokError("expected identifier in directive");
- // Handle the identifier as the key symbol.
- MCSymbol *Sym = getContext().getOrCreateSymbol(Name);
-
if (getLexer().isNot(AsmToken::Comma))
return TokError("unexpected token in directive");
Lex();
@@ -911,13 +898,10 @@ bool DarwinAsmParser::parseDirectiveZerofill(StringRef, SMLoc) {
Lex();
SMLoc IDLoc = getLexer().getLoc();
- StringRef IDStr;
- if (getParser().parseIdentifier(IDStr))
+ MCSymbol *Sym;
+ if (getParser().parseSymbol(Sym))
return TokError("expected identifier in directive");
- // handle the identifier as the key symbol.
- MCSymbol *Sym = getContext().getOrCreateSymbol(IDStr);
-
if (getLexer().isNot(AsmToken::Comma))
return TokError("unexpected token in directive");
Lex();