[mlir] Print the correct tool name in mlirTranslateMain
authorAndrew Young <youngar17@gmail.com>
Tue, 5 Jan 2021 21:38:29 +0000 (13:38 -0800)
committerAndrew Young <youngar17@gmail.com>
Wed, 6 Jan 2021 03:17:01 +0000 (19:17 -0800)
    The passed in tool name is not used, causing the wrong tool name to be printed by the help text.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D94120

mlir/lib/Translation/Translation.cpp
mlir/test/mlir-translate/commandline.mlir [new file with mode: 0644]

index 5c5ecb7e46c4c031778f8e291eabd912315a4381..3c17ea2370857571d83ece54dd412fcdf1b16630 100644 (file)
@@ -157,7 +157,7 @@ LogicalResult mlir::mlirTranslateMain(int argc, char **argv,
                            llvm::cl::Required);
   registerAsmPrinterCLOptions();
   registerMLIRContextCLOptions();
-  llvm::cl::ParseCommandLineOptions(argc, argv, "MLIR translation driver\n");
+  llvm::cl::ParseCommandLineOptions(argc, argv, toolName);
 
   std::string errorMessage;
   auto input = openInputFile(inputFilename, &errorMessage);
diff --git a/mlir/test/mlir-translate/commandline.mlir b/mlir/test/mlir-translate/commandline.mlir
new file mode 100644 (file)
index 0000000..e55e734
--- /dev/null
@@ -0,0 +1,2 @@
+// RUN: mlir-translate --help | FileCheck %s
+// CHECK: OVERVIEW: MLIR Translation Testing Tool
\ No newline at end of file