summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/include/clang/Driver/ArgList.h7
-rw-r--r--clang/lib/Driver/ArgList.cpp11
2 files changed, 17 insertions, 1 deletions
diff --git a/clang/include/clang/Driver/ArgList.h b/clang/include/clang/Driver/ArgList.h
index c4f3bbc1a45..4131ff4d168 100644
--- a/clang/include/clang/Driver/ArgList.h
+++ b/clang/include/clang/Driver/ArgList.h
@@ -10,7 +10,9 @@
#ifndef CLANG_DRIVER_ARGLIST_H_
#define CLANG_DRIVER_ARGLIST_H_
-#include "Util.h"
+#include "clang/Driver/Options.h"
+
+#include "clang/Driver/Util.h"
#include "llvm/ADT/SmallVector.h"
namespace clang {
@@ -54,6 +56,9 @@ namespace driver {
/// getArgString - Return the input argument string at \arg Index.
const char *getArgString(unsigned Index) const { return ArgStrings[Index]; }
+
+ /// hasArg - Does the arg list contain any option matching \arg Id.
+ bool hasArg(options::ID Id) const;
};
} // end namespace driver
} // end namespace clang
diff --git a/clang/lib/Driver/ArgList.cpp b/clang/lib/Driver/ArgList.cpp
index a45e9d67b21..6a056074b7c 100644
--- a/clang/lib/Driver/ArgList.cpp
+++ b/clang/lib/Driver/ArgList.cpp
@@ -29,3 +29,14 @@ void ArgList::append(Arg *A) {
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;
+}
OpenPOWER on IntegriCloud