Driver: Add ArgList::hasArg, for testing for the presence of an
argument matching some Option::ID.
llvm-svn: 66758
diff --git a/clang/lib/Driver/ArgList.cpp b/clang/lib/Driver/ArgList.cpp
index a45e9d6..6a05607 100644
--- a/clang/lib/Driver/ArgList.cpp
+++ b/clang/lib/Driver/ArgList.cpp
@@ -29,3 +29,14 @@
Args.push_back(A);
}
+
+bool ArgList::hasArg(options::ID Id) const {
+ // FIXME: Make search efficient?
+
+ // FIXME: This needs to not require loading of the option.
+ for (const_iterator it = begin(), ie = end(); it != ie; ++ie)
+ if ((*it)->getOption().matches(Id))
+ return true;
+
+ return false;
+}