mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-15 23:31:37 +00:00
improve the patch for PR1318 to also support grouped options with custom
handlers (like the pass list). My previous fix only supported *new* command line options, not additions to old ones. This fixes test/Feature/load_module.ll git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35935 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
cfa71e026d
commit
69d6f1358c
@ -57,6 +57,10 @@ void ParseEnvironmentOptions(const char *progName, const char *envvar,
|
||||
/// CommandLine utilities to print their own version string.
|
||||
void SetVersionPrinter(void (*func)());
|
||||
|
||||
|
||||
// MarkOptionsChanged - Internal helper function.
|
||||
void MarkOptionsChanged();
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Flags permitted to be passed to command line arguments
|
||||
//
|
||||
@ -469,6 +473,7 @@ public:
|
||||
assert(findOption(Name) == Values.size() && "Option already exists!");
|
||||
Values.push_back(std::make_pair(Name,
|
||||
std::make_pair(static_cast<DataType>(V),HelpStr)));
|
||||
MarkOptionsChanged();
|
||||
}
|
||||
|
||||
/// removeLiteralOption - Remove the specified option.
|
||||
|
@ -71,6 +71,13 @@ extrahelp::extrahelp(const char *Help)
|
||||
MoreHelp->push_back(Help);
|
||||
}
|
||||
|
||||
static bool OptionListChanged = false;
|
||||
|
||||
// MarkOptionsChanged - Internal helper function.
|
||||
void cl::MarkOptionsChanged() {
|
||||
OptionListChanged = true;
|
||||
}
|
||||
|
||||
/// RegisteredOptionList - This is the list of the command line options that
|
||||
/// have statically constructed themselves.
|
||||
static Option *RegisteredOptionList = 0;
|
||||
@ -80,8 +87,10 @@ void Option::addArgument() {
|
||||
|
||||
NextRegistered = RegisteredOptionList;
|
||||
RegisteredOptionList = this;
|
||||
MarkOptionsChanged();
|
||||
}
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Basic, shared command line option processing machinery.
|
||||
//
|
||||
@ -394,10 +403,6 @@ void cl::ParseCommandLineOptions(int &argc, char **argv,
|
||||
// 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) {
|
||||
@ -405,14 +410,14 @@ void cl::ParseCommandLineOptions(int &argc, char **argv,
|
||||
const char *Value = 0;
|
||||
const char *ArgName = "";
|
||||
|
||||
// If the head of the option list changed, this means that some command line
|
||||
// If 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) {
|
||||
if (OptionListChanged) {
|
||||
PositionalOpts.clear();
|
||||
Opts.clear();
|
||||
GetOptionInfo(PositionalOpts, Opts);
|
||||
CurOptionList = RegisteredOptionList;
|
||||
OptionListChanged = false;
|
||||
}
|
||||
|
||||
// Check to see if this is a positional argument. This argument is
|
||||
|
Loading…
x
Reference in New Issue
Block a user