summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/InitHeaderSearch.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-11-07 04:20:50 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-11-07 04:20:50 +0000
commit08d5669b010ba7e19ae5a301ee411ab2be255f49 (patch)
treea41e60ef1930d1dbe392a20a0d531f12613c639a /clang/lib/Frontend/InitHeaderSearch.cpp
parentec87991c8fbd98972c0d5739f6ecfafbfd8686e2 (diff)
downloadbcm5719-llvm-08d5669b010ba7e19ae5a301ee411ab2be255f49.tar.gz
bcm5719-llvm-08d5669b010ba7e19ae5a301ee411ab2be255f49.zip
Add HeaderSearchOptions class, for packaging the information needed to
initialize HeaderSearch. Not used yet. llvm-svn: 86338
Diffstat (limited to 'clang/lib/Frontend/InitHeaderSearch.cpp')
-rw-r--r--clang/lib/Frontend/InitHeaderSearch.cpp32
1 files changed, 31 insertions, 1 deletions
diff --git a/clang/lib/Frontend/InitHeaderSearch.cpp b/clang/lib/Frontend/InitHeaderSearch.cpp
index 0ca6e0b830c..989829895d3 100644
--- a/clang/lib/Frontend/InitHeaderSearch.cpp
+++ b/clang/lib/Frontend/InitHeaderSearch.cpp
@@ -12,9 +12,10 @@
//===----------------------------------------------------------------------===//
#include "clang/Frontend/InitHeaderSearch.h"
-#include "clang/Lex/HeaderSearch.h"
#include "clang/Basic/FileManager.h"
#include "clang/Basic/LangOptions.h"
+#include "clang/Frontend/HeaderSearchOptions.h"
+#include "clang/Lex/HeaderSearch.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/Support/raw_ostream.h"
@@ -580,3 +581,32 @@ void InitHeaderSearch::Realize() {
fprintf(stderr, "End of search list.\n");
}
}
+
+void clang::ApplyHeaderSearchOptions(const HeaderSearchOptions &HSOpts,
+ HeaderSearch &HS, const LangOptions &Lang,
+ const llvm::Triple &Triple) {
+ InitHeaderSearch Init(HS, HSOpts.Verbose, HSOpts.Sysroot);
+
+ // Add the user defined entries.
+ for (unsigned i = 0, e = HSOpts.UserEntries.size(); i != e; ++i) {
+ const HeaderSearchOptions::Entry &E = HSOpts.UserEntries[i];
+ Init.AddPath(E.Path, E.Group, E.IsCXXAware, E.IsUserSupplied, E.IsFramework,
+ E.IgnoreSysRoot);
+ }
+
+ // Add entries from CPATH and friends.
+ Init.AddDelimitedPaths(HSOpts.EnvIncPath.c_str());
+ Init.AddDelimitedPaths(HSOpts.LangEnvIncPath.c_str());
+
+ if (!HSOpts.BuiltinIncludePath.empty()) {
+ // Ignore the sys root, we *always* look for clang headers relative to
+ // supplied path.
+ Init.AddPath(HSOpts.BuiltinIncludePath, InitHeaderSearch::System,
+ false, false, false, /*IgnoreSysRoot=*/ true);
+ }
+
+ if (!HSOpts.UseStandardIncludes)
+ Init.AddDefaultSystemIncludePaths(Lang, Triple);
+
+ Init.Realize();
+}
OpenPOWER on IntegriCloud