Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MC] Add three-state parseDirective as a replacement for ParseDirective
Conventionally, parsing methods return false on success and true on error. However, directive parsing methods need a third state: the directive is not target specific. AsmParser::parseStatement detected this case by using a fragile heuristic: if the target parser did not consume any tokens, the directive is assumed to be not target-specific. Some targets fail to follow the convention: they return success after emitting an error or do not consume the entire line and return failure on successful parsing. This was partially worked around by checking for pending errors in parseStatement. This patch tries to improve the situation by introducing parseDirective method that returns ParseStatus -- three-state class. The new method should eventually replace the old one returning bool. ParseStatus is intentionally implicitly constructible from bool to allow uses like `return Error(Loc, "message")`. It also has a potential to replace OperandMatchResulTy as it is more convenient to use due to the implicit construction from bool and more type safe. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D154101
- Loading branch information
1 parent
624813a
commit af20c1c
Showing
30 changed files
with
402 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.