summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Option
diff options
context:
space:
mode:
authorDouglas Katzman <dougk@google.com>2016-09-29 19:47:58 +0000
committerDouglas Katzman <dougk@google.com>2016-09-29 19:47:58 +0000
commit93a9a8397acd9ad2ac65462725a8b794cc5b28ce (patch)
tree28e5313f5fbe1b949860e750678fc31e19c42507 /llvm/lib/Option
parentbcfafa42fb802abce452755e13899109abe39928 (diff)
downloadbcm5719-llvm-93a9a8397acd9ad2ac65462725a8b794cc5b28ce.tar.gz
bcm5719-llvm-93a9a8397acd9ad2ac65462725a8b794cc5b28ce.zip
Generalize ArgList::AddAllArgs more
llvm-svn: 282755
Diffstat (limited to 'llvm/lib/Option')
-rw-r--r--llvm/lib/Option/ArgList.cpp27
1 files changed, 22 insertions, 5 deletions
diff --git a/llvm/lib/Option/ArgList.cpp b/llvm/lib/Option/ArgList.cpp
index d5c4a7e458b..f94de866ef3 100644
--- a/llvm/lib/Option/ArgList.cpp
+++ b/llvm/lib/Option/ArgList.cpp
@@ -259,19 +259,36 @@ void ArgList::AddLastArg(ArgStringList &Output, OptSpecifier Id0,
}
}
-void ArgList::AddAllArgs(ArgStringList &Output,
- ArrayRef<OptSpecifier> Ids) const {
+void ArgList::AddAllArgsExcept(ArgStringList &Output,
+ ArrayRef<OptSpecifier> Ids,
+ ArrayRef<OptSpecifier> ExcludeIds) const {
for (const Arg *Arg : Args) {
- for (OptSpecifier Id : Ids) {
+ bool Excluded = false;
+ for (OptSpecifier Id : ExcludeIds) {
if (Arg->getOption().matches(Id)) {
- Arg->claim();
- Arg->render(*this, Output);
+ Excluded = true;
break;
}
}
+ if (!Excluded) {
+ for (OptSpecifier Id : Ids) {
+ if (Arg->getOption().matches(Id)) {
+ Arg->claim();
+ Arg->render(*this, Output);
+ break;
+ }
+ }
+ }
}
}
+/// This is a nicer interface when you don't have a list of Ids to exclude.
+void ArgList::AddAllArgs(ArgStringList &Output,
+ ArrayRef<OptSpecifier> Ids) const {
+ ArrayRef<OptSpecifier> Exclude = None;
+ AddAllArgsExcept(Output, Ids, Exclude);
+}
+
/// 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,
OpenPOWER on IntegriCloud