diff --git a/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp b/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp --- a/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp +++ b/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp @@ -32,6 +32,7 @@ #include "llvm/Support/FileUtilities.h" #include "llvm/Support/InitLLVM.h" #include "llvm/Support/ManagedStatic.h" +#include "llvm/Support/Process.h" #include "llvm/Support/Regex.h" #include "llvm/Support/SourceMgr.h" #include "llvm/Support/StringSaver.h" @@ -337,7 +338,10 @@ cl::ParseCommandLineOptions(argc, argv, helpHeader); MlirOptMainConfig config = MlirOptMainConfig::createFromCLOptions(); config.preloadDialectsInContext(preloadDialectsInContext); - + if (inputFilename == "-" && + sys::Process::FileDescriptorIsDisplayed(fileno(stdin))) + llvm::errs() << "(processing input from stdin now, hit ctrl-c/ctrl-d to " + "interrupt)\n"; // Set up the input file. std::string errorMessage; auto file = openInputFile(inputFilename, &errorMessage);