diff options
author | Thomas Köppe <tkoeppe@google.com> | 2021-05-18 23:44:25 +0000 |
---|---|---|
committer | Mehdi Amini <joker.eph@gmail.com> | 2021-05-19 00:12:39 +0000 |
commit | 58369fce30af484889356f225d89cb0b32009206 (patch) | |
tree | f7c4d235e4a0ac95058fd77e739459f9c509f574 /llvm/lib/CodeGen/MachineBasicBlock.cpp | |
parent | 861d69a5259653f60d59795597493a7939b794fe (diff) | |
download | llvm-58369fce30af484889356f225d89cb0b32009206.zip llvm-58369fce30af484889356f225d89cb0b32009206.tar.gz llvm-58369fce30af484889356f225d89cb0b32009206.tar.bz2 |
Add a helper function to convert LogicalResult to int for return from main
At present, a lot of code contains main function bodies like "return failed(mlir::MlirOptMain(...);". This is unfortunate for two reasons: a) it uses ADL, which is maybe not what the free "failed" function was designed for; and b) it is a bit awkward to read, requring the reader to both understand the boolean nature of the value and the semantics of main's return value. (And it's also not portable, since 1 is not a portable success value.)
The replacement code, `return mlir::AsMainReturnCode(mlir::MlirOptMain(...))` is a bit more self-explanatory.
The change applies the new function to a few internal uses of MlirOptMain, too.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D102641
Diffstat (limited to 'llvm/lib/CodeGen/MachineBasicBlock.cpp')
0 files changed, 0 insertions, 0 deletions