llvm.org GIT mirror llvm / ee2b320
Fix a bug in my earlier commit which exposed positional options backwards. This fixes llvm-ar. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35727 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 12 years ago
1 changed file(s) with 11 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
9090 static void GetOptionInfo(std::vector &PositionalOpts,
9191 std::map &OptionsMap) {
9292 std::vector OptionNames;
93 Option *CAOpt = 0; // The ConsumeAfter option if it exists.
9394 for (Option *O = RegisteredOptionList; O; O = O->getNextRegisteredOption()) {
9495 // If this option wants to handle multiple option names, get the full set.
9596 // This handles enum options like "-O1 -O2" etc.
113114 if (O->getFormattingFlag() == cl::Positional)
114115 PositionalOpts.push_back(O);
115116 else if (O->getNumOccurrencesFlag() == cl::ConsumeAfter) {
116 if (!PositionalOpts.empty() &&
117 PositionalOpts.front()->getNumOccurrencesFlag() == cl::ConsumeAfter)
117 if (CAOpt)
118118 O->error("Cannot specify more than one option with cl::ConsumeAfter!");
119 PositionalOpts.insert(PositionalOpts.begin(), O);
120 }
121 }
119 CAOpt = O;
120 }
121 }
122
123 if (CAOpt)
124 PositionalOpts.push_back(CAOpt);
125
126 // Make sure that they are in order of registration not backwards.
127 std::reverse(PositionalOpts.begin(), PositionalOpts.end());
122128 }
123129
124130