diff --git a/tools/cgeist/Lib/clang-mlir.cc b/tools/cgeist/Lib/clang-mlir.cc index 87be7612df01..c8bde52dc071 100644 --- a/tools/cgeist/Lib/clang-mlir.cc +++ b/tools/cgeist/Lib/clang-mlir.cc @@ -5893,6 +5893,12 @@ static bool parseMLIR(const char *Argv0, std::vector filenames, new Driver(binary, llvm::sys::getDefaultTargetTriple(), Diags)); mlirclang::ArgumentList Argv; Argv.push_back(binary); + // TODO we should probably preserve the order of these args - they matter in + // some cases as is with this one - it has to be before the input file + if (Lang != "") { + Argv.push_back("-x"); + Argv.emplace_back(Lang); + } for (const auto &filename : filenames) { Argv.emplace_back(filename); } diff --git a/tools/cgeist/driver.cc b/tools/cgeist/driver.cc index 8d34965f38a9..5125d1e02149 100644 --- a/tools/cgeist/driver.cc +++ b/tools/cgeist/driver.cc @@ -213,6 +213,9 @@ static cl::opt EarlyVerifier("early-verifier", cl::init(false), static cl::opt Verbose("v", cl::init(false), cl::desc("Verbose")); +static cl::opt Lang("x", cl::init(""), + cl::desc("Treat input as language")); + static cl::list includeDirs("I", cl::desc("include search path"), cl::cat(toolOptions));