[llvm-commits] [llvm] r63384 - in /llvm/trunk: include/llvm/Support/CommandLine.h lib/Support/CommandLine.cpp

Chris Lattner clattner at apple.com
Fri Jan 30 10:00:36 PST 2009


On Jan 30, 2009, at 12:19 AM, Mike Stump wrote:

> Author: mrs
> Date: Fri Jan 30 02:19:46 2009
> New Revision: 63384
>
> URL: http://llvm.org/viewvc/llvm-project?rev=63384&view=rev
> Log:
> Add opposite_of and inverse_opt to support -fno- style options.  This
> is necessary for eventual gcc commmand line compatibility.

Hi Mike,

This is an interesting approach to fix this problem, but it pushes the  
problem off to the clients.  In the clang code you added, we now have  
two cl::opt's and have to have this sort of thing:

+  if (EnableBlocks.getPosition() || DisableBlocks.getPosition())
     Options.Blocks = EnableBlocks;

which is gross :).

How about adding a new flag that can only be used with cl::opt<bool>  
options, maybe named cl::AllowInverse.  This would let us use it like  
this:

static llvm::cl::opt<bool>
EnableBlocks("fblocks", llvm::cl::desc("enable the 'blocks' language  
feature"), cl::AllowInverse);

and cause the option to eat either -fblocks or -fno-blocks.

Also, any patches to the CommandLine library should update the dox:
http://llvm.org/docs/CommandLine.html

Please revert this patch in the meantime, thanks!

-Chris




More information about the llvm-commits mailing list