Driver: Free synthesized derived arguments.

llvm-svn: 98262
This commit is contained in:
Daniel Dunbar 2010-03-11 18:04:53 +00:00
parent 66e2768918
commit 86d838970b
2 changed files with 15 additions and 8 deletions

View File

@ -287,7 +287,7 @@ namespace driver {
arglist_type ActualArgs;
/// The list of arguments we synthesized.
arglist_type SynthesizedArgs;
mutable arglist_type SynthesizedArgs;
/// Is this only a proxy for the base ArgList?
bool OnlyProxy;

View File

@ -218,23 +218,30 @@ const char *DerivedArgList::MakeArgString(llvm::StringRef Str) const {
}
Arg *DerivedArgList::MakeFlagArg(const Arg *BaseArg, const Option *Opt) const {
return new FlagArg(Opt, BaseArgs.MakeIndex(Opt->getName()), BaseArg);
Arg *A = new FlagArg(Opt, BaseArgs.MakeIndex(Opt->getName()), BaseArg);
SynthesizedArgs.push_back(A);
return A;
}
Arg *DerivedArgList::MakePositionalArg(const Arg *BaseArg, const Option *Opt,
llvm::StringRef Value) const {
return new PositionalArg(Opt, BaseArgs.MakeIndex(Value), BaseArg);
Arg *A = new PositionalArg(Opt, BaseArgs.MakeIndex(Value), BaseArg);
SynthesizedArgs.push_back(A);
return A;
}
Arg *DerivedArgList::MakeSeparateArg(const Arg *BaseArg, const Option *Opt,
llvm::StringRef Value) const {
return new SeparateArg(Opt, BaseArgs.MakeIndex(Opt->getName(), Value), 1,
BaseArg);
Arg *A = new SeparateArg(Opt, BaseArgs.MakeIndex(Opt->getName(), Value), 1,
BaseArg);
SynthesizedArgs.push_back(A);
return A;
}
Arg *DerivedArgList::MakeJoinedArg(const Arg *BaseArg, const Option *Opt,
llvm::StringRef Value) const {
std::string Joined(Opt->getName());
Joined += Value;
return new JoinedArg(Opt, BaseArgs.MakeIndex(Joined.c_str()), BaseArg);
Arg *A = new JoinedArg(Opt, BaseArgs.MakeIndex(Opt->getName() + Value.str()),
BaseArg);
SynthesizedArgs.push_back(A);
return A;
}