[llvm-commits] CVS: llvm/lib/Support/CommandLine.cpp

Reid Spencer rspencer at reidspencer.com
Wed Apr 11 13:00:00 PDT 2007


On Wed, 2007-04-11 at 10:35 -0500, Chris Lattner wrote:
> 
> Changes in directory llvm/lib/Support:
> 
> CommandLine.cpp updated: 1.85 -> 1.86
> ---
> Log message:
> 
> Fix PR1318: http://llvm.org/PR1318  by reacting appropriately to a mutating option list.

Could you please create a regression test for this? One thing that could
be done is to re-enable LLVMHello to built by default and then use it
with --load and -hello option. 

> 
> 
> ---
> Diffs of the changes:  (+14 -0)
> 
>  CommandLine.cpp |   14 ++++++++++++++
>  1 files changed, 14 insertions(+)
> 
> 
> Index: llvm/lib/Support/CommandLine.cpp
> diff -u llvm/lib/Support/CommandLine.cpp:1.85 llvm/lib/Support/CommandLine.cpp:1.86
> --- llvm/lib/Support/CommandLine.cpp:1.85	Sat Apr  7 00:38:53 2007
> +++ llvm/lib/Support/CommandLine.cpp	Wed Apr 11 10:35:18 2007
> @@ -394,6 +394,10 @@
>    // the positional args into the PositionalVals list...
>    Option *ActivePositionalArg = 0;
>  
> +  // Keep track of the option list so far so that we can tell if it is ever
> +  // extended.
> +  Option *CurOptionList = RegisteredOptionList;
> +  
>    // Loop over all of the arguments... processing them.
>    bool DashDashFound = false;  // Have we read '--'?
>    for (int i = 1; i < argc; ++i) {
> @@ -401,6 +405,16 @@
>      const char *Value = 0;
>      const char *ArgName = "";
>  
> +    // If the head of the option list changed, this means that some command line
> +    // option has just been registered or deregistered.  This can occur in
> +    // response to things like -load, etc.  If this happens, rescan the options.
> +    if (CurOptionList != RegisteredOptionList) {
> +      PositionalOpts.clear();
> +      Opts.clear();
> +      GetOptionInfo(PositionalOpts, Opts);
> +      CurOptionList = RegisteredOptionList;
> +    }
> +    
>      // Check to see if this is a positional argument.  This argument is
>      // considered to be positional if it doesn't start with '-', if it is "-"
>      // itself, or if we have seen "--" already.
> 
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list