llvm.org GIT mirror llvm / 159b0a4
Fix PR1318 by reacting appropriately to a mutating option list. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35905 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 13 years ago
1 changed file(s) with 14 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
393393 // the positional args into the PositionalVals list...
394394 Option *ActivePositionalArg = 0;
395395
396 // Keep track of the option list so far so that we can tell if it is ever
397 // extended.
398 Option *CurOptionList = RegisteredOptionList;
399
396400 // Loop over all of the arguments... processing them.
397401 bool DashDashFound = false; // Have we read '--'?
398402 for (int i = 1; i < argc; ++i) {
400404 const char *Value = 0;
401405 const char *ArgName = "";
402406
407 // If the head of the option list changed, this means that some command line
408 // option has just been registered or deregistered. This can occur in
409 // response to things like -load, etc. If this happens, rescan the options.
410 if (CurOptionList != RegisteredOptionList) {
411 PositionalOpts.clear();
412 Opts.clear();
413 GetOptionInfo(PositionalOpts, Opts);
414 CurOptionList = RegisteredOptionList;
415 }
416
403417 // Check to see if this is a positional argument. This argument is
404418 // considered to be positional if it doesn't start with '-', if it is "-"
405419 // itself, or if we have seen "--" already.