mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
correct target directive handling error handling
The target specific parser should return `false' if the target AsmParser handles the directive, and `true' if the generic parser should handle the directive. Many of the target specific directive handlers would `return Error' which does not follow these semantics. This change simply changes the target specific routines to conform to the semantis of the ParseDirective correctly. Conformance to the semantics improves diagnostics emitted for the invalid directives. X86 is taken as a sample to ensure that multiple diagnostics are not presented for a single error. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199068 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -2407,13 +2407,17 @@ bool MipsAsmParser::parseDirectiveMipsHackStocg() {
|
||||
reportParseError("expected identifier");
|
||||
|
||||
MCSymbol *Sym = getContext().GetOrCreateSymbol(Name);
|
||||
if (getLexer().isNot(AsmToken::Comma))
|
||||
return TokError("unexpected token");
|
||||
if (getLexer().isNot(AsmToken::Comma)) {
|
||||
TokError("unexpected token");
|
||||
return false;
|
||||
}
|
||||
Lex();
|
||||
|
||||
int64_t Flags = 0;
|
||||
if (Parser.parseAbsoluteExpression(Flags))
|
||||
return TokError("unexpected token");
|
||||
if (Parser.parseAbsoluteExpression(Flags)) {
|
||||
TokError("unexpected token");
|
||||
return false;
|
||||
}
|
||||
|
||||
getTargetStreamer().emitMipsHackSTOCG(Sym, Flags);
|
||||
return false;
|
||||
@@ -2421,8 +2425,10 @@ bool MipsAsmParser::parseDirectiveMipsHackStocg() {
|
||||
|
||||
bool MipsAsmParser::parseDirectiveMipsHackELFFlags() {
|
||||
int64_t Flags = 0;
|
||||
if (Parser.parseAbsoluteExpression(Flags))
|
||||
return TokError("unexpected token");
|
||||
if (Parser.parseAbsoluteExpression(Flags)) {
|
||||
TokError("unexpected token");
|
||||
return false;
|
||||
}
|
||||
|
||||
getTargetStreamer().emitMipsHackELFFlags(Flags);
|
||||
return false;
|
||||
@@ -2499,7 +2505,6 @@ bool MipsAsmParser::parseDirectiveOption() {
|
||||
}
|
||||
|
||||
bool MipsAsmParser::ParseDirective(AsmToken DirectiveID) {
|
||||
|
||||
StringRef IDVal = DirectiveID.getString();
|
||||
|
||||
if (IDVal == ".ent") {
|
||||
|
Reference in New Issue
Block a user