[llvm] [NFC][Support] Create helper function to parse bool. (PR #102818)

Alexandre Ganea via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 11 16:16:14 PDT 2024


================
@@ -404,6 +404,22 @@ class CommandLineParser {
 
 static ManagedStatic<CommandLineParser> GlobalParser;
 
+template <typename T, T TrueVal, T FalseVal>
+static bool parseBool(Option &O, StringRef ArgName, StringRef Arg, T &Value) {
+  if (Arg == "" || Arg == "true" || Arg == "TRUE" || Arg == "True" ||
----------------
aganea wrote:

We could use `Arg.equals_insensitive("true") here. Same below for `false`

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


More information about the llvm-commits mailing list