[LLVMdev] Using cl::ZeroOrMore more pervasively with the cl::opt class

Chad Rosier mcrosier at codeaurora.org
Fri Jan 23 13:24:20 PST 2015


All,
Is there any particular reason we don't use cl::ZeroOrMore more
pervasively with the cl::opt class of command-line options?

1. Some of llvm's optimizations are enabled/disabled by llvm command-line
options.  Passing these options to our build system via CFF and CXXF
result in redundant CL options.  If the CL option is a cl::opt which
defaults to cl::Optional, a warning is emitted.  In turn, our build system
bails on these type of warnings.

2. We have internal meta flags (similar to -Ofast) that expand to multiple
llvm CL flags.  If this type of flag expands, but I'd like to disable one
of the optimizations I'll hit a warning and the build will fail.

IIRC, the clang driver does not warn if you specify redundant options.  It
follows the last option wins policy.  It would be great if the llvm CL
options did the same, IMO.  Let me know if I've missed something.

The solution we have internally is to add the cl::ZeroOrMore option to
many of the CL options.  This causes our internal code base to diverge. 
This make me sad. :(

 Chad





More information about the llvm-dev mailing list