summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Option
diff options
context:
space:
mode:
authorDouglas Katzman <dougk@google.com>2015-07-29 17:34:41 +0000
committerDouglas Katzman <dougk@google.com>2015-07-29 17:34:41 +0000
commitf2b960886eeccbf2aa056ddb6a5e6ea28a888572 (patch)
tree43586866834cf9c22e4c5b7fe162f19d2265a622 /llvm/lib/Option
parent6093d143c5a76d168854321a1fc3d63e9c6d1ee6 (diff)
downloadbcm5719-llvm-f2b960886eeccbf2aa056ddb6a5e6ea28a888572.tar.gz
bcm5719-llvm-f2b960886eeccbf2aa056ddb6a5e6ea28a888572.zip
Add an ArgList::AddAllArgs that accepts a vector of OptSpecifier.
This lifts the somewhat arbitrary restriction on 3 OptSpecifiers. Differential Revision: http://reviews.llvm.org/D11597 llvm-svn: 243539
Diffstat (limited to 'llvm/lib/Option')
-rw-r--r--llvm/lib/Option/ArgList.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/lib/Option/ArgList.cpp b/llvm/lib/Option/ArgList.cpp
index a74ead6b358..a37f443e56f 100644
--- a/llvm/lib/Option/ArgList.cpp
+++ b/llvm/lib/Option/ArgList.cpp
@@ -258,6 +258,21 @@ void ArgList::AddLastArg(ArgStringList &Output, OptSpecifier Id0,
}
}
+void ArgList::AddAllArgs(ArgStringList &Output,
+ ArrayRef<OptSpecifier> Ids) const {
+ for (const Arg *Arg : Args) {
+ for (OptSpecifier Id : Ids) {
+ if (Arg->getOption().matches(Id)) {
+ Arg->claim();
+ Arg->render(*this, Output);
+ break;
+ }
+ }
+ }
+}
+
+/// This 3-opt variant of AddAllArgs could be eliminated in favor of one
+/// that accepts a single specifier, given the above which accepts any number.
void ArgList::AddAllArgs(ArgStringList &Output, OptSpecifier Id0,
OptSpecifier Id1, OptSpecifier Id2) const {
for (auto Arg: filtered(Id0, Id1, Id2)) {
OpenPOWER on IntegriCloud