1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

Make AddLastArg() variadic and use it more. No behavior change.

llvm-svn: 364453
This commit is contained in:
Nico Weber 2019-06-26 17:51:47 +00:00
parent 6226063b98
commit 01b9e83c3f
2 changed files with 6 additions and 19 deletions

View File

@ -301,10 +301,12 @@ public:
bool hasFlag(OptSpecifier Pos, OptSpecifier PosAlias, OptSpecifier Neg, bool hasFlag(OptSpecifier Pos, OptSpecifier PosAlias, OptSpecifier Neg,
bool Default = true) const; bool Default = true) const;
/// AddLastArg - Render only the last argument match \p Id0, if present. /// Render only the last argument match \p Id0, if present.
void AddLastArg(ArgStringList &Output, OptSpecifier Id0) const; template<typename ...OptSpecifiers>
void AddLastArg(ArgStringList &Output, OptSpecifier Id0, void AddLastArg(ArgStringList &Output, OptSpecifiers ...Ids) const {
OptSpecifier Id1) const; if (Arg *A = getLastArg(Ids...)) // Calls claim() on all Ids's Args.
A->render(*this, Output);
}
/// AddAllArgsExcept - Render all arguments matching any of the given ids /// AddAllArgsExcept - Render all arguments matching any of the given ids
/// and not matching any of the excluded ids. /// and not matching any of the excluded ids.

View File

@ -95,21 +95,6 @@ std::vector<std::string> ArgList::getAllArgValues(OptSpecifier Id) const {
return std::vector<std::string>(Values.begin(), Values.end()); return std::vector<std::string>(Values.begin(), Values.end());
} }
void ArgList::AddLastArg(ArgStringList &Output, OptSpecifier Id) const {
if (Arg *A = getLastArg(Id)) {
A->claim();
A->render(*this, Output);
}
}
void ArgList::AddLastArg(ArgStringList &Output, OptSpecifier Id0,
OptSpecifier Id1) const {
if (Arg *A = getLastArg(Id0, Id1)) {
A->claim();
A->render(*this, Output);
}
}
void ArgList::AddAllArgsExcept(ArgStringList &Output, void ArgList::AddAllArgsExcept(ArgStringList &Output,
ArrayRef<OptSpecifier> Ids, ArrayRef<OptSpecifier> Ids,
ArrayRef<OptSpecifier> ExcludeIds) const { ArrayRef<OptSpecifier> ExcludeIds) const {