[llvm] [Support] Accept -no-<name> to negate cl::opt<bool> (PR #224978)
James Henderson via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 22 00:28:11 PDT 2026
================
@@ -551,7 +551,17 @@ Option *CommandLineParser::LookupOption(SubCommand &Sub, StringRef &Arg,
// If we have an equals sign, remember the value.
if (EqualPos == StringRef::npos) {
// Look up the option.
- return Sub.OptionsMap.lookup(Arg);
+ if (Option *O = Sub.OptionsMap.lookup(Arg))
+ return O;
+ // -no-<name> negates the boolean option <name>.
----------------
jh7370 wrote:
I assume this additional logic here isn't going to significantly degrade the cost of command-line parsing? I imagine some tools have many options passed to them, so it wouldn't take much for the cost of running that tool to increase in a noticeable way.
https://github.com/llvm/llvm-project/pull/224978
More information about the llvm-commits
mailing list