diff options
| author | Nirav Dave <niravd@google.com> | 2016-07-18 19:35:21 +0000 |
|---|---|---|
| committer | Nirav Dave <niravd@google.com> | 2016-07-18 19:35:21 +0000 |
| commit | 1ab719971f049cc7fb94f49b5b5f86cce70534f8 (patch) | |
| tree | 362812b2d128623065b7b7062ec00ca7b1f95fc3 /llvm/lib/MC/MCParser | |
| parent | d61042b5490ce4b65b0ec6a832b24bacf58af2e6 (diff) | |
| download | bcm5719-llvm-1ab719971f049cc7fb94f49b5b5f86cce70534f8.tar.gz bcm5719-llvm-1ab719971f049cc7fb94f49b5b5f86cce70534f8.zip | |
[MC] Separate non-parsing operations from conditional chains. NFC.
llvm-svn: 275888
Diffstat (limited to 'llvm/lib/MC/MCParser')
| -rw-r--r-- | llvm/lib/MC/MCParser/AsmParser.cpp | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp index 1548aee8422..a314e4a1ddc 100644 --- a/llvm/lib/MC/MCParser/AsmParser.cpp +++ b/llvm/lib/MC/MCParser/AsmParser.cpp @@ -2610,10 +2610,12 @@ bool AsmParser::parseDirectiveReloc(SMLoc DirectiveLoc) { } if (parseToken(AsmToken::EndOfStatement, - "unexpected token in .reloc directive") || - check(getStreamer().EmitRelocDirective(*Offset, Name, Expr, DirectiveLoc), - NameLoc, "unknown relocation name")) - return true; + "unexpected token in .reloc directive")) + return true; + + if (getStreamer().EmitRelocDirective(*Offset, Name, Expr, DirectiveLoc)) + return Error(NameLoc, "unknown relocation name"); + return false; } @@ -3144,10 +3146,11 @@ bool AsmParser::parseDirectiveCVFile() { // directory. Allow the strings to have escaped octal character sequence. parseEscapedString(Filename) || parseToken(AsmToken::EndOfStatement, - "unexpected token in '.cv_file' directive") || - check(getStreamer().EmitCVFileDirective(FileNumber, Filename) == 0, - FileNumberLoc, "file number already allocated")) - return true; + "unexpected token in '.cv_file' directive")) + return true; + + if (getStreamer().EmitCVFileDirective(FileNumber, Filename) == 0) + Error(FileNumberLoc, "file number already allocated"); return false; } @@ -3927,11 +3930,12 @@ bool AsmParser::parseDirectivePurgeMacro(SMLoc DirectiveLoc) { if (getTokenLoc(Loc) || check(parseIdentifier(Name), Loc, "expected identifier in '.purgem' directive") || parseToken(AsmToken::EndOfStatement, - "unexpected token in '.purgem' directive") || - check(!lookupMacro(Name), DirectiveLoc, - "macro '" + Name + "' is not defined")) + "unexpected token in '.purgem' directive")) return true; + if (!lookupMacro(Name)) + return Error(DirectiveLoc, "macro '" + Name + "' is not defined"); + undefineMacro(Name); return false; } @@ -4210,11 +4214,12 @@ bool AsmParser::parseDirectiveIncbin() { "expected string in '.incbin' directive") || parseEscapedString(Filename) || parseToken(AsmToken::EndOfStatement, - "unexpected token in '.incbin' directive") || - // Attempt to process the included file. - check(processIncbinFile(Filename), IncbinLoc, - "Could not find incbin file '" + Filename + "'")) + "unexpected token in '.incbin' directive")) return true; + + // Attempt to process the included file. + if (processIncbinFile(Filename)) + return Error(IncbinLoc, "Could not find incbin file '" + Filename + "'"); return false; } |

