mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-17 04:24:00 +00:00
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
This commit is contained in:
@ -91,6 +91,7 @@ void Option::addArgument() {
|
|||||||
static void GetOptionInfo(std::vector<Option*> &PositionalOpts,
|
static void GetOptionInfo(std::vector<Option*> &PositionalOpts,
|
||||||
std::map<std::string, Option*> &OptionsMap) {
|
std::map<std::string, Option*> &OptionsMap) {
|
||||||
std::vector<const char*> OptionNames;
|
std::vector<const char*> OptionNames;
|
||||||
|
Option *CAOpt = 0; // The ConsumeAfter option if it exists.
|
||||||
for (Option *O = RegisteredOptionList; O; O = O->getNextRegisteredOption()) {
|
for (Option *O = RegisteredOptionList; O; O = O->getNextRegisteredOption()) {
|
||||||
// If this option wants to handle multiple option names, get the full set.
|
// If this option wants to handle multiple option names, get the full set.
|
||||||
// This handles enum options like "-O1 -O2" etc.
|
// This handles enum options like "-O1 -O2" etc.
|
||||||
@ -114,12 +115,17 @@ static void GetOptionInfo(std::vector<Option*> &PositionalOpts,
|
|||||||
if (O->getFormattingFlag() == cl::Positional)
|
if (O->getFormattingFlag() == cl::Positional)
|
||||||
PositionalOpts.push_back(O);
|
PositionalOpts.push_back(O);
|
||||||
else if (O->getNumOccurrencesFlag() == cl::ConsumeAfter) {
|
else if (O->getNumOccurrencesFlag() == cl::ConsumeAfter) {
|
||||||
if (!PositionalOpts.empty() &&
|
if (CAOpt)
|
||||||
PositionalOpts.front()->getNumOccurrencesFlag() == cl::ConsumeAfter)
|
|
||||||
O->error("Cannot specify more than one option with cl::ConsumeAfter!");
|
O->error("Cannot specify more than one option with cl::ConsumeAfter!");
|
||||||
PositionalOpts.insert(PositionalOpts.begin(), O);
|
CAOpt = O;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (CAOpt)
|
||||||
|
PositionalOpts.push_back(CAOpt);
|
||||||
|
|
||||||
|
// Make sure that they are in order of registration not backwards.
|
||||||
|
std::reverse(PositionalOpts.begin(), PositionalOpts.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user