[AArch64][MC] Remove unneeded "in .xxx directive" from diagnostics

The prevailing style does not add the message. The directive name is not useful
because the next line replicates the error line which includes the directive.
This commit is contained in:
Fangrui Song 2021-05-23 13:58:16 -07:00
parent 30c413cda0
commit fc82507c89
3 changed files with 9 additions and 21 deletions

View File

@ -89,6 +89,7 @@ public:
const Twine &Msg = "unexpected token") {
return getParser().parseToken(T, Msg);
}
bool parseEOL() { return getParser().parseEOL(); }
bool parseMany(function_ref<bool()> parseOne, bool hasComma = true) {
return getParser().parseMany(parseOne, hasComma);

View File

@ -5594,9 +5594,7 @@ bool AArch64AsmParser::parseDirectiveInst(SMLoc Loc) {
return false;
};
if (parseMany(parseOp))
return addErrorSuffix(" in '.inst' directive");
return false;
return parseMany(parseOp);
}
// parseDirectiveTLSDescCall:
@ -5752,9 +5750,7 @@ bool AArch64AsmParser::parseDirectiveUnreq(SMLoc L) {
return TokError("unexpected input in .unreq directive.");
RegisterReqs.erase(Parser.getTok().getIdentifier().lower());
Parser.Lex(); // Eat the identifier.
if (parseToken(AsmToken::EndOfStatement))
return addErrorSuffix("in '.unreq' directive");
return false;
return parseToken(AsmToken::EndOfStatement);
}
bool AArch64AsmParser::parseDirectiveCFINegateRAState() {
@ -5787,16 +5783,13 @@ bool AArch64AsmParser::parseDirectiveVariantPCS(SMLoc L) {
MCSymbol *Sym = getContext().lookupSymbol(SymbolName);
if (!Sym)
return TokError("unknown symbol in '.variant_pcs' directive");
return TokError("unknown symbol");
Parser.Lex(); // Eat the symbol
// Shouldn't be any more tokens
if (parseToken(AsmToken::EndOfStatement))
return addErrorSuffix(" in '.variant_pcs' directive");
if (parseEOL())
return true;
getTargetStreamer().emitDirectiveVariantPCS(Sym);
return false;
}

View File

@ -1,17 +1,11 @@
// RUN: not llvm-mc -triple aarch64-unknown-none-eabi -filetype asm -o - %s 2>&1 | FileCheck %s
// CHECK: [[#@LINE+1]]:13: error: expected symbol name
.variant_pcs
// CHECK: error: expected symbol name
// CHECK-NEXT: .variant_pcs
// CHECK-NEXT: ^
// CHECK: [[#@LINE+1]]:14: error: unknown symbol
.variant_pcs foo
// CHECK: error: unknown symbol in '.variant_pcs' directive
// CHECK-NEXT: .variant_pcs foo
// CHECK-NEXT: ^
.global foo
// CHECK: [[#@LINE+1]]:18: error: expected newline
.variant_pcs foo bar
// CHECK: error: unexpected token in '.variant_pcs' directive
// CHECK-NEXT: .variant_pcs foo bar
// CHECK-NEXT: ^