forked from OSchip/llvm-project
ArgList: use MakeArgList overloads in subclasses and clean up some calls.
llvm-svn: 211340
This commit is contained in:
parent
e03a25da70
commit
6f07046808
|
@ -328,6 +328,7 @@ public:
|
|||
unsigned MakeIndex(StringRef String0) const;
|
||||
unsigned MakeIndex(StringRef String0, StringRef String1) const;
|
||||
|
||||
using ArgList::MakeArgString;
|
||||
const char *MakeArgString(StringRef Str) const override;
|
||||
|
||||
/// @}
|
||||
|
@ -365,6 +366,7 @@ public:
|
|||
/// (to be freed).
|
||||
void AddSynthesizedArg(Arg *A);
|
||||
|
||||
using ArgList::MakeArgString;
|
||||
const char *MakeArgString(StringRef Str) const override;
|
||||
|
||||
/// AddFlagArg - Construct a new FlagArg for the given option \p Id and
|
||||
|
|
|
@ -350,30 +350,27 @@ void DerivedArgList::AddSynthesizedArg(Arg *A) {
|
|||
}
|
||||
|
||||
Arg *DerivedArgList::MakeFlagArg(const Arg *BaseArg, const Option Opt) const {
|
||||
SynthesizedArgs.push_back(make_unique<Arg>(
|
||||
Opt,
|
||||
ArgList::MakeArgString(Twine(Opt.getPrefix()) + Twine(Opt.getName())),
|
||||
BaseArgs.MakeIndex(Opt.getName()), BaseArg));
|
||||
SynthesizedArgs.push_back(
|
||||
make_unique<Arg>(Opt, MakeArgString(Opt.getPrefix() + Opt.getName()),
|
||||
BaseArgs.MakeIndex(Opt.getName()), BaseArg));
|
||||
return SynthesizedArgs.back().get();
|
||||
}
|
||||
|
||||
Arg *DerivedArgList::MakePositionalArg(const Arg *BaseArg, const Option Opt,
|
||||
StringRef Value) const {
|
||||
unsigned Index = BaseArgs.MakeIndex(Value);
|
||||
SynthesizedArgs.push_back(make_unique<Arg>(
|
||||
Opt,
|
||||
ArgList::MakeArgString(Twine(Opt.getPrefix()) + Twine(Opt.getName())),
|
||||
Index, BaseArgs.getArgString(Index), BaseArg));
|
||||
SynthesizedArgs.push_back(
|
||||
make_unique<Arg>(Opt, MakeArgString(Opt.getPrefix() + Opt.getName()),
|
||||
Index, BaseArgs.getArgString(Index), BaseArg));
|
||||
return SynthesizedArgs.back().get();
|
||||
}
|
||||
|
||||
Arg *DerivedArgList::MakeSeparateArg(const Arg *BaseArg, const Option Opt,
|
||||
StringRef Value) const {
|
||||
unsigned Index = BaseArgs.MakeIndex(Opt.getName(), Value);
|
||||
SynthesizedArgs.push_back(make_unique<Arg>(
|
||||
Opt,
|
||||
ArgList::MakeArgString(Twine(Opt.getPrefix()) + Twine(Opt.getName())),
|
||||
Index, BaseArgs.getArgString(Index + 1), BaseArg));
|
||||
SynthesizedArgs.push_back(
|
||||
make_unique<Arg>(Opt, MakeArgString(Opt.getPrefix() + Opt.getName()),
|
||||
Index, BaseArgs.getArgString(Index + 1), BaseArg));
|
||||
return SynthesizedArgs.back().get();
|
||||
}
|
||||
|
||||
|
@ -381,8 +378,7 @@ Arg *DerivedArgList::MakeJoinedArg(const Arg *BaseArg, const Option Opt,
|
|||
StringRef Value) const {
|
||||
unsigned Index = BaseArgs.MakeIndex(Opt.getName().str() + Value.str());
|
||||
SynthesizedArgs.push_back(make_unique<Arg>(
|
||||
Opt,
|
||||
ArgList::MakeArgString(Twine(Opt.getPrefix()) + Twine(Opt.getName())),
|
||||
Index, BaseArgs.getArgString(Index) + Opt.getName().size(), BaseArg));
|
||||
Opt, MakeArgString(Opt.getPrefix() + Opt.getName()), Index,
|
||||
BaseArgs.getArgString(Index) + Opt.getName().size(), BaseArg));
|
||||
return SynthesizedArgs.back().get();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue