[PATCH] D96068: [flang] Adapt mlir based error status handling in `tco` tool
Sourabh Singh Tomar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 4 21:37:47 PST 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbca0619a1bca: [flang] Adapt mlir based error status handling in `tco` tool (authored by SouraVX).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D96068/new/
https://reviews.llvm.org/D96068
Files:
flang/tools/tco/tco.cpp
Index: flang/tools/tco/tco.cpp
===================================================================
--- flang/tools/tco/tco.cpp
+++ flang/tools/tco/tco.cpp
@@ -47,14 +47,15 @@
}
// compile a .fir file
-static int compileFIR() {
+static mlir::LogicalResult
+compileFIR(const mlir::PassPipelineCLParser &passPipeline) {
// check that there is a file to load
ErrorOr<std::unique_ptr<MemoryBuffer>> fileOrErr =
MemoryBuffer::getFileOrSTDIN(inputFilename);
if (std::error_code EC = fileOrErr.getError()) {
errs() << "Could not open file: " << EC.message() << '\n';
- return 1;
+ return mlir::failure();
}
// load the file into a module
@@ -66,11 +67,11 @@
if (!owningRef) {
errs() << "Error can't load file " << inputFilename << '\n';
- return 2;
+ return mlir::failure();
}
if (mlir::failed(owningRef->verify())) {
errs() << "Error verifying FIR module\n";
- return 4;
+ return mlir::failure();
}
std::error_code ec;
@@ -94,13 +95,13 @@
if (emitFir)
printModuleBody(*owningRef, out.os());
out.keep();
- return 0;
+ return mlir::success();
}
// pass manager failed
printModuleBody(*owningRef, errs());
errs() << "\n\nFAILED: " << inputFilename << '\n';
- return 8;
+ return mlir::failure();
}
int main(int argc, char **argv) {
@@ -109,5 +110,5 @@
mlir::registerPassManagerCLOptions();
mlir::PassPipelineCLParser passPipe("", "Compiler passes to run");
cl::ParseCommandLineOptions(argc, argv, "Tilikum Crossing Optimizer\n");
- return compileFIR();
+ return mlir::failed(compileFIR(passPipe));
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96068.321656.patch
Type: text/x-patch
Size: 1626 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210205/d129096b/attachment.bin>
More information about the llvm-commits
mailing list