[llvm] [mlir] [Support] Accept only true, false, 1 and 0 for cl::opt<bool> (PR #224975)
Alexis Engelke via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 20 23:22:17 PDT 2026
================
@@ -439,13 +439,13 @@ static 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" ||
- Arg == "1") {
+ // A bare -flag passes a null Arg; -flag= passes an empty one.
+ if (!Arg.data() || Arg == "true" || Arg == "1") {
----------------
aengelke wrote:
StringRef data() can be non-null for empty strings. Why change that comparison anyway?
https://github.com/llvm/llvm-project/pull/224975
More information about the llvm-commits
mailing list