StringRef Name;
if (getParser().parseIdentifier(Name))
- return TokError("expected identifier in directive");
+ return TokError("expected identifier");
if (getParser().discardLTOSymbol(Name)) {
if (getLexer().is(AsmToken::EndOfStatement))
break;
if (getLexer().isNot(AsmToken::Comma))
- return TokError("unexpected token in directive");
+ return TokError("expected comma");
Lex();
}
}
bool ELFAsmParser::ParseDirectiveSize(StringRef, SMLoc) {
StringRef Name;
if (getParser().parseIdentifier(Name))
- return TokError("expected identifier in directive");
+ return TokError("expected identifier");
MCSymbolELF *Sym = cast<MCSymbolELF>(getContext().getOrCreateSymbol(Name));
if (getLexer().isNot(AsmToken::Comma))
- return TokError("unexpected token in directive");
+ return TokError("expected comma");
Lex();
const MCExpr *Expr;
return true;
if (getLexer().isNot(AsmToken::EndOfStatement))
- return TokError("unexpected token in directive");
+ return TokError("unexpected token");
Lex();
getStreamer().emitELFSize(Sym, Expr);
TypeName = getTok().getString();
Lex();
} else if (getParser().parseIdentifier(TypeName))
- return TokError("expected identifier in directive");
+ return TokError("expected identifier");
return false;
}
Lex();
StringRef UniqueStr;
if (getParser().parseIdentifier(UniqueStr))
- return TokError("expected identifier in directive");
+ return TokError("expected identifier");
if (UniqueStr != "unique")
return TokError("expected 'unique'");
if (L.isNot(AsmToken::Comma))
StringRef SectionName;
if (ParseSectionName(SectionName))
- return TokError("expected identifier in directive");
+ return TokError("expected identifier");
StringRef TypeName;
int64_t Size = 0;
if (getLexer().isNot(AsmToken::String)) {
if (getLexer().isNot(AsmToken::Hash))
- return TokError("expected string in directive");
+ return TokError("expected string");
extraFlags = parseSunStyleSectionFlags();
} else {
StringRef FlagsStr = getTok().getStringContents();
if (Group)
return TokError("Group section must specify the type");
if (L.isNot(AsmToken::EndOfStatement))
- return TokError("unexpected token in directive");
+ return TokError("expected end of directive");
}
if (Mergeable)
EndStmt:
if (getLexer().isNot(AsmToken::EndOfStatement))
- return TokError("unexpected token in directive");
+ return TokError("expected end of directive");
Lex();
unsigned Type = ELF::SHT_PROGBITS;
bool ELFAsmParser::ParseDirectiveType(StringRef, SMLoc) {
StringRef Name;
if (getParser().parseIdentifier(Name))
- return TokError("expected identifier in directive");
+ return TokError("expected identifier");
// Handle the identifier as the key symbol.
MCSymbol *Sym = getContext().getOrCreateSymbol(Name);
StringRef Type;
if (getParser().parseIdentifier(Type))
- return TokError("expected symbol type in directive");
+ return TokError("expected symbol type");
MCSymbolAttr Attr = MCAttrForString(Type);
if (Attr == MCSA_Invalid)
- return Error(TypeLoc, "unsupported attribute in '.type' directive");
+ return Error(TypeLoc, "unsupported attribute");
if (getLexer().isNot(AsmToken::EndOfStatement))
- return TokError("unexpected token in '.type' directive");
+ return TokError("expected end of directive");
Lex();
getStreamer().emitSymbolAttribute(Sym, Attr);
/// ::= .ident string
bool ELFAsmParser::ParseDirectiveIdent(StringRef, SMLoc) {
if (getLexer().isNot(AsmToken::String))
- return TokError("unexpected token in '.ident' directive");
+ return TokError("expected string");
StringRef Data = getTok().getIdentifier();
Lex();
if (getLexer().isNot(AsmToken::EndOfStatement))
- return TokError("unexpected token in '.ident' directive");
+ return TokError("expected end of directive");
Lex();
getStreamer().emitIdent(Data);
bool ELFAsmParser::ParseDirectiveSymver(StringRef, SMLoc) {
StringRef OriginalName, Name, Action;
if (getParser().parseIdentifier(OriginalName))
- return TokError("expected identifier in directive");
+ return TokError("expected identifier");
if (getLexer().isNot(AsmToken::Comma))
return TokError("expected a comma");
getLexer().setAllowAtInIdentifier(AllowAtInIdentifier);
if (getParser().parseIdentifier(Name))
- return TokError("expected identifier in directive");
+ return TokError("expected identifier");
if (!Name.contains('@'))
return TokError("expected a '@' in the name");
/// ::= .version string
bool ELFAsmParser::ParseDirectiveVersion(StringRef, SMLoc) {
if (getLexer().isNot(AsmToken::String))
- return TokError("unexpected token in '.version' directive");
+ return TokError("expected string");
StringRef Data = getTok().getIdentifier();
StringRef AliasName;
if (getParser().parseIdentifier(AliasName))
- return TokError("expected identifier in directive");
+ return TokError("expected identifier");
if (getLexer().isNot(AsmToken::Comma))
return TokError("expected a comma");
StringRef Name;
if (getParser().parseIdentifier(Name))
- return TokError("expected identifier in directive");
+ return TokError("expected identifier");
MCSymbol *Alias = getContext().getOrCreateSymbol(AliasName);
}
if (getLexer().isNot(AsmToken::EndOfStatement))
- return TokError("unexpected token in directive");
+ return TokError("expected end of directive");
Lex();