[PATCH] D11597: Add an ArgList::AddAllArgs that accepts a vector of OptSpecifier.
Douglas Katzman
dougk at google.com
Wed Jul 29 10:35:17 PDT 2015
This revision was automatically updated to reflect the committed changes.
Closed by commit rL243539: Add an ArgList::AddAllArgs that accepts a vector of OptSpecifier. (authored by dougk).
Changed prior to commit:
http://reviews.llvm.org/D11597?vs=30911&id=30920#toc
Repository:
rL LLVM
http://reviews.llvm.org/D11597
Files:
llvm/trunk/include/llvm/Option/ArgList.h
llvm/trunk/lib/Option/ArgList.cpp
Index: llvm/trunk/include/llvm/Option/ArgList.h
===================================================================
--- llvm/trunk/include/llvm/Option/ArgList.h
+++ llvm/trunk/include/llvm/Option/ArgList.h
@@ -259,6 +259,9 @@
void AddLastArg(ArgStringList &Output, OptSpecifier Id0,
OptSpecifier Id1) const;
+ /// AddAllArgs - Render all arguments matching any of the given ids.
+ void AddAllArgs(ArgStringList &Output, ArrayRef<OptSpecifier> Ids) const;
+
/// AddAllArgs - Render all arguments matching the given ids.
void AddAllArgs(ArgStringList &Output, OptSpecifier Id0,
OptSpecifier Id1 = 0U, OptSpecifier Id2 = 0U) const;
Index: llvm/trunk/lib/Option/ArgList.cpp
===================================================================
--- llvm/trunk/lib/Option/ArgList.cpp
+++ llvm/trunk/lib/Option/ArgList.cpp
@@ -258,6 +258,21 @@
}
}
+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)) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11597.30920.patch
Type: text/x-patch
Size: 1556 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150729/4a9efda1/attachment.bin>
More information about the llvm-commits
mailing list