[llvm] [opt] Improve help message (PR #97805)

Nabeel Omer via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 5 02:40:32 PDT 2024


https://github.com/omern1 created https://github.com/llvm/llvm-project/pull/97805

This patch changes all single quotes in the help text to double quotes for the sake of cross platform correctness.

The single quotes previously used in the help message are correct for bash and most other shells but aren't correct for the Windows command prompt as it only interprets double quotes in the manner intended in the help message.

This patch was prompted by the fact that if you aren't aware of the aformentioned quirk the single quotes result in very confusing error messages from the command prompt.

>From 9d2a0bfca10f97e089d7d9eeb24b76d1318bafd7 Mon Sep 17 00:00:00 2001
From: Nabeel Omer <Nabeel.Omer at sony.com>
Date: Thu, 4 Jul 2024 21:23:18 +0100
Subject: [PATCH] [opt] Improve help message

This patch changes all single quotes in the help text to
double quotes for the sake of cross platform correctness.

The single quotes previously used in the help message are correct for
bash and most other shells but aren't correct for the Windows command
prompt as it only interprets double quotes in the manner intended in the
help message.

This patch was prompted by the fact that if you aren't
aware of the aformentioned quirk the single quotes result in very
confusing error messages from the command prompt.
---
 llvm/tools/opt/optdriver.cpp | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/llvm/tools/opt/optdriver.cpp b/llvm/tools/opt/optdriver.cpp
index a088e7512f5fa..b26aeb061851e 100644
--- a/llvm/tools/opt/optdriver.cpp
+++ b/llvm/tools/opt/optdriver.cpp
@@ -68,7 +68,7 @@ static codegen::RegisterCodeGenFlags CFG;
 // The OptimizationList is automatically populated with registered Passes by the
 // PassNameParser.
 static cl::list<const PassInfo *, bool, PassNameParser> PassList(cl::desc(
-    "Optimizations available (use '-passes=' for the new pass manager)"));
+    "Optimizations available (use \"-passes=\" for the new pass manager)"));
 
 static cl::opt<bool> EnableLegacyPassManager(
     "bugpoint-enable-legacy-pm",
@@ -85,7 +85,7 @@ static cl::opt<std::string> PassPipeline(
     "passes",
     cl::desc(
         "A textual description of the pass pipeline. To have analysis passes "
-        "available before a certain pass, add 'require<foo-analysis>'."));
+        "available before a certain pass, add \"require<foo-analysis>\"."));
 static cl::alias PassPipeline2("p", cl::aliasopt(PassPipeline),
                                cl::desc("Alias for -passes"));
 
@@ -154,28 +154,28 @@ static cl::opt<bool>
 
 static cl::opt<bool>
     OptLevelO0("O0", cl::desc("Optimization level 0. Similar to clang -O0. "
-                              "Same as -passes='default<O0>'"));
+                              "Same as -passes=\"default<O0>\""));
 
 static cl::opt<bool>
     OptLevelO1("O1", cl::desc("Optimization level 1. Similar to clang -O1. "
-                              "Same as -passes='default<O1>'"));
+                              "Same as -passes=\"default<O1>\""));
 
 static cl::opt<bool>
     OptLevelO2("O2", cl::desc("Optimization level 2. Similar to clang -O2. "
-                              "Same as -passes='default<O2>'"));
+                              "Same as -passes=\"default<O2>\""));
 
 static cl::opt<bool>
     OptLevelOs("Os", cl::desc("Like -O2 but size-conscious. Similar to clang "
-                              "-Os. Same as -passes='default<Os>'"));
+                              "-Os. Same as -passes=\"default<Os>\""));
 
 static cl::opt<bool> OptLevelOz(
     "Oz",
     cl::desc("Like -O2 but optimize for code size above all else. Similar to "
-             "clang -Oz. Same as -passes='default<Oz>'"));
+             "clang -Oz. Same as -passes=\"default<Oz>\""));
 
 static cl::opt<bool>
     OptLevelO3("O3", cl::desc("Optimization level 3. Similar to clang -O3. "
-                              "Same as -passes='default<O3>'"));
+                              "Same as -passes=\"default<O3>\""));
 
 static cl::opt<unsigned> CodeGenOptLevelCL(
     "codegen-opt-level",



More information about the llvm-commits mailing list