[Mlir-commits] [mlir] [mlir][NFC] Split registerAndParseCLIOptions() in mlir-opt (PR #166538)

weiwei chen llvmlistbot at llvm.org
Mon Nov 10 07:10:26 PST 2025


================
@@ -706,11 +697,29 @@ mlir::registerAndParseCLIOptions(int argc, char **argv,
     interleaveComma(registry.getDialectNames(), os,
                     [&](auto name) { os << name; });
   }
-  // Parse pass names in main to ensure static initialization completed.
+  return helpHeader;
+}
+
+std::pair<std::string, std::string>
+mlir::parseCLIOptions(int argc, char **argv, llvm::StringRef helpHeader) {
+  static cl::opt<std::string> inputFilename(
+      cl::Positional, cl::desc("<input file>"), cl::init("-"));
+
+  static cl::opt<std::string> outputFilename("o", cl::desc("Output filename"),
+                                             cl::value_desc("filename"),
+                                             cl::init("-"));
   cl::ParseCommandLineOptions(argc, argv, helpHeader);
   return std::make_pair(inputFilename.getValue(), outputFilename.getValue());
----------------
weiweichen wrote:

I see, this looks fine then. 

https://github.com/llvm/llvm-project/pull/166538


More information about the Mlir-commits mailing list