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) const;
|
||||||
unsigned MakeIndex(StringRef String0, StringRef String1) const;
|
unsigned MakeIndex(StringRef String0, StringRef String1) const;
|
||||||
|
|
||||||
|
using ArgList::MakeArgString;
|
||||||
const char *MakeArgString(StringRef Str) const override;
|
const char *MakeArgString(StringRef Str) const override;
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
@ -365,6 +366,7 @@ public:
|
||||||
/// (to be freed).
|
/// (to be freed).
|
||||||
void AddSynthesizedArg(Arg *A);
|
void AddSynthesizedArg(Arg *A);
|
||||||
|
|
||||||
|
using ArgList::MakeArgString;
|
||||||
const char *MakeArgString(StringRef Str) const override;
|
const char *MakeArgString(StringRef Str) const override;
|
||||||
|
|
||||||
/// AddFlagArg - Construct a new FlagArg for the given option \p Id and
|
/// AddFlagArg - Construct a new FlagArg for the given option \p Id and
|
||||||
|
|
|
@ -350,9 +350,8 @@ void DerivedArgList::AddSynthesizedArg(Arg *A) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Arg *DerivedArgList::MakeFlagArg(const Arg *BaseArg, const Option Opt) const {
|
Arg *DerivedArgList::MakeFlagArg(const Arg *BaseArg, const Option Opt) const {
|
||||||
SynthesizedArgs.push_back(make_unique<Arg>(
|
SynthesizedArgs.push_back(
|
||||||
Opt,
|
make_unique<Arg>(Opt, MakeArgString(Opt.getPrefix() + Opt.getName()),
|
||||||
ArgList::MakeArgString(Twine(Opt.getPrefix()) + Twine(Opt.getName())),
|
|
||||||
BaseArgs.MakeIndex(Opt.getName()), BaseArg));
|
BaseArgs.MakeIndex(Opt.getName()), BaseArg));
|
||||||
return SynthesizedArgs.back().get();
|
return SynthesizedArgs.back().get();
|
||||||
}
|
}
|
||||||
|
@ -360,9 +359,8 @@ Arg *DerivedArgList::MakeFlagArg(const Arg *BaseArg, const Option Opt) const {
|
||||||
Arg *DerivedArgList::MakePositionalArg(const Arg *BaseArg, const Option Opt,
|
Arg *DerivedArgList::MakePositionalArg(const Arg *BaseArg, const Option Opt,
|
||||||
StringRef Value) const {
|
StringRef Value) const {
|
||||||
unsigned Index = BaseArgs.MakeIndex(Value);
|
unsigned Index = BaseArgs.MakeIndex(Value);
|
||||||
SynthesizedArgs.push_back(make_unique<Arg>(
|
SynthesizedArgs.push_back(
|
||||||
Opt,
|
make_unique<Arg>(Opt, MakeArgString(Opt.getPrefix() + Opt.getName()),
|
||||||
ArgList::MakeArgString(Twine(Opt.getPrefix()) + Twine(Opt.getName())),
|
|
||||||
Index, BaseArgs.getArgString(Index), BaseArg));
|
Index, BaseArgs.getArgString(Index), BaseArg));
|
||||||
return SynthesizedArgs.back().get();
|
return SynthesizedArgs.back().get();
|
||||||
}
|
}
|
||||||
|
@ -370,9 +368,8 @@ Arg *DerivedArgList::MakePositionalArg(const Arg *BaseArg, const Option Opt,
|
||||||
Arg *DerivedArgList::MakeSeparateArg(const Arg *BaseArg, const Option Opt,
|
Arg *DerivedArgList::MakeSeparateArg(const Arg *BaseArg, const Option Opt,
|
||||||
StringRef Value) const {
|
StringRef Value) const {
|
||||||
unsigned Index = BaseArgs.MakeIndex(Opt.getName(), Value);
|
unsigned Index = BaseArgs.MakeIndex(Opt.getName(), Value);
|
||||||
SynthesizedArgs.push_back(make_unique<Arg>(
|
SynthesizedArgs.push_back(
|
||||||
Opt,
|
make_unique<Arg>(Opt, MakeArgString(Opt.getPrefix() + Opt.getName()),
|
||||||
ArgList::MakeArgString(Twine(Opt.getPrefix()) + Twine(Opt.getName())),
|
|
||||||
Index, BaseArgs.getArgString(Index + 1), BaseArg));
|
Index, BaseArgs.getArgString(Index + 1), BaseArg));
|
||||||
return SynthesizedArgs.back().get();
|
return SynthesizedArgs.back().get();
|
||||||
}
|
}
|
||||||
|
@ -381,8 +378,7 @@ Arg *DerivedArgList::MakeJoinedArg(const Arg *BaseArg, const Option Opt,
|
||||||
StringRef Value) const {
|
StringRef Value) const {
|
||||||
unsigned Index = BaseArgs.MakeIndex(Opt.getName().str() + Value.str());
|
unsigned Index = BaseArgs.MakeIndex(Opt.getName().str() + Value.str());
|
||||||
SynthesizedArgs.push_back(make_unique<Arg>(
|
SynthesizedArgs.push_back(make_unique<Arg>(
|
||||||
Opt,
|
Opt, MakeArgString(Opt.getPrefix() + Opt.getName()), Index,
|
||||||
ArgList::MakeArgString(Twine(Opt.getPrefix()) + Twine(Opt.getName())),
|
BaseArgs.getArgString(Index) + Opt.getName().size(), BaseArg));
|
||||||
Index, BaseArgs.getArgString(Index) + Opt.getName().size(), BaseArg));
|
|
||||||
return SynthesizedArgs.back().get();
|
return SynthesizedArgs.back().get();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue