| 30 | cl::NormalFormatting, cl::Optional, cl::desc("<output file path, default>")); |
| 31 | |
| 32 | static OwningOpRef<ModuleOp> parseMLIRInput( |
| 33 | StringRef inputFilename, MLIRContext* context) { |
| 34 | // Set up the input file. |
| 35 | std::string errorMessage; |
| 36 | auto file = openInputFile(inputFilename, &errorMessage); |
| 37 | if (!file) { |
| 38 | llvm::errs() << errorMessage << "\n"; |
| 39 | return nullptr; |
| 40 | } |
| 41 | llvm::SourceMgr sourceMgr; |
| 42 | sourceMgr.AddNewSourceBuffer(std::move(file), SMLoc()); |
| 43 | return OwningOpRef<ModuleOp>(parseSourceFile(sourceMgr, context)); |
| 44 | } |
| 45 | |
| 46 | int main(int argc, char** argv) { |
| 47 | cl::ParseCommandLineOptions(argc, argv); |