summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/InitHeaderSearch.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-11-09 23:02:47 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-11-09 23:02:47 +0000
commit4df9aa2388b62dcb361aa0cc7763faba238be6b8 (patch)
tree604ccc26e6778528c22c76b728b4d14938927dbe /clang/lib/Frontend/InitHeaderSearch.cpp
parent800aad3dda5d52a185c77b6ae5d77e4e8b0560c1 (diff)
downloadbcm5719-llvm-4df9aa2388b62dcb361aa0cc7763faba238be6b8.tar.gz
bcm5719-llvm-4df9aa2388b62dcb361aa0cc7763faba238be6b8.zip
Privatize InitHeaderSearch, this functionality is only exposed via
ApplyHeaderSearchOptions now. llvm-svn: 86617
Diffstat (limited to 'clang/lib/Frontend/InitHeaderSearch.cpp')
-rw-r--r--clang/lib/Frontend/InitHeaderSearch.cpp63
1 files changed, 61 insertions, 2 deletions
diff --git a/clang/lib/Frontend/InitHeaderSearch.cpp b/clang/lib/Frontend/InitHeaderSearch.cpp
index f9ccb8a72f1..0e120e87acf 100644
--- a/clang/lib/Frontend/InitHeaderSearch.cpp
+++ b/clang/lib/Frontend/InitHeaderSearch.cpp
@@ -11,13 +11,14 @@
//
//===----------------------------------------------------------------------===//
-#include "clang/Frontend/InitHeaderSearch.h"
+#include "clang/Frontend/Utils.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/ADT/Triple.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/System/Path.h"
#include "llvm/Config/config.h"
@@ -27,6 +28,64 @@
#include <windows.h>
#endif
using namespace clang;
+using namespace clang::frontend;
+
+namespace {
+
+/// InitHeaderSearch - This class makes it easier to set the search paths of
+/// a HeaderSearch object. InitHeaderSearch stores several search path lists
+/// internally, which can be sent to a HeaderSearch object in one swoop.
+class InitHeaderSearch {
+ std::vector<DirectoryLookup> IncludeGroup[4];
+ HeaderSearch& Headers;
+ bool Verbose;
+ std::string isysroot;
+
+public:
+
+ InitHeaderSearch(HeaderSearch &HS,
+ bool verbose = false, const std::string &iSysroot = "")
+ : Headers(HS), Verbose(verbose), isysroot(iSysroot) {}
+
+ /// AddPath - Add the specified path to the specified group list.
+ void AddPath(const llvm::StringRef &Path, IncludeDirGroup Group,
+ bool isCXXAware, bool isUserSupplied,
+ bool isFramework, bool IgnoreSysRoot = false);
+
+ /// AddGnuCPlusPlusIncludePaths - Add the necessary paths to suport a gnu
+ /// libstdc++.
+ void AddGnuCPlusPlusIncludePaths(const std::string &Base, const char *Dir32,
+ const char *Dir64,
+ const llvm::Triple &triple);
+
+ /// AddMinGWCPlusPlusIncludePaths - Add the necessary paths to suport a MinGW
+ /// libstdc++.
+ void AddMinGWCPlusPlusIncludePaths(const std::string &Base,
+ const char *Arch,
+ const char *Version);
+
+ /// AddDelimitedPaths - Add a list of paths delimited by the system PATH
+ /// separator. The processing follows that of the CPATH variable for gcc.
+ void AddDelimitedPaths(const char *String);
+
+ // AddDefaultCIncludePaths - Add paths that should always be searched.
+ void AddDefaultCIncludePaths(const llvm::Triple &triple);
+
+ // AddDefaultCPlusPlusIncludePaths - Add paths that should be searched when
+ // compiling c++.
+ void AddDefaultCPlusPlusIncludePaths(const llvm::Triple &triple);
+
+ /// AddDefaultSystemIncludePaths - Adds the default system include paths so
+ /// that e.g. stdio.h is found.
+ void AddDefaultSystemIncludePaths(const LangOptions &Lang,
+ const llvm::Triple &triple);
+
+ /// Realize - Merges all search path lists into one list and send it to
+ /// HeaderSearch.
+ void Realize();
+};
+
+}
void InitHeaderSearch::AddPath(const llvm::StringRef &Path,
IncludeDirGroup Group, bool isCXXAware,
@@ -601,7 +660,7 @@ void clang::ApplyHeaderSearchOptions(const HeaderSearchOptions &HSOpts,
if (!HSOpts.BuiltinIncludePath.empty()) {
// Ignore the sys root, we *always* look for clang headers relative to
// supplied path.
- Init.AddPath(HSOpts.BuiltinIncludePath, InitHeaderSearch::System,
+ Init.AddPath(HSOpts.BuiltinIncludePath, System,
false, false, false, /*IgnoreSysRoot=*/ true);
}
OpenPOWER on IntegriCloud