summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/Driver/clang.cpp7
-rw-r--r--clang/include/clang/Driver/InitHeaderSearch.h2
-rw-r--r--clang/lib/Driver/InitHeaderSearch.cpp4
3 files changed, 8 insertions, 5 deletions
diff --git a/clang/Driver/clang.cpp b/clang/Driver/clang.cpp
index 79166fb0bdf..525c27faccc 100644
--- a/clang/Driver/clang.cpp
+++ b/clang/Driver/clang.cpp
@@ -1098,8 +1098,11 @@ void InitializeIncludePaths(const char *Argv0, HeaderSearch &Headers,
MainExecutablePath.eraseComponent(); // Remove /clang from foo/bin/clang
MainExecutablePath.eraseComponent(); // Remove /bin from foo/bin
MainExecutablePath.appendComponent("Headers"); // Get foo/Headers
- Init.AddPath(MainExecutablePath.c_str(), InitHeaderSearch::After,
- false, false, false);
+
+ // We pass true to ignore sysroot so that we *always* look for clang headers
+ // relative to our executable, never relative to -isysroot.
+ Init.AddPath(MainExecutablePath.c_str(), InitHeaderSearch::System,
+ false, false, false, true /*ignore sysroot*/);
}
if (!nostdinc)
diff --git a/clang/include/clang/Driver/InitHeaderSearch.h b/clang/include/clang/Driver/InitHeaderSearch.h
index a113456e8a5..b02117e1b6b 100644
--- a/clang/include/clang/Driver/InitHeaderSearch.h
+++ b/clang/include/clang/Driver/InitHeaderSearch.h
@@ -50,7 +50,7 @@ public:
/// AddPath - Add the specified path to the specified group list.
void AddPath(const std::string &Path, IncludeDirGroup Group,
bool isCXXAware, bool isUserSupplied,
- bool isFramework);
+ bool isFramework, bool IgnoreSysRoot = false);
/// AddEnvVarPaths - Add a list of paths from an environment variable to a
/// header search list.
diff --git a/clang/lib/Driver/InitHeaderSearch.cpp b/clang/lib/Driver/InitHeaderSearch.cpp
index 4b5275d7264..5b0b2c2f72b 100644
--- a/clang/lib/Driver/InitHeaderSearch.cpp
+++ b/clang/lib/Driver/InitHeaderSearch.cpp
@@ -24,7 +24,7 @@ using namespace clang;
void InitHeaderSearch::AddPath(const std::string &Path, IncludeDirGroup Group,
bool isCXXAware, bool isUserSupplied,
- bool isFramework) {
+ bool isFramework, bool IgnoreSysRoot) {
assert(!Path.empty() && "can't handle empty path here");
FileManager &FM = Headers.getFileMgr();
@@ -32,7 +32,7 @@ void InitHeaderSearch::AddPath(const std::string &Path, IncludeDirGroup Group,
llvm::SmallString<256> MappedPath;
// Handle isysroot.
- if (Group == System) {
+ if (Group == System && !IgnoreSysRoot) {
// FIXME: Portability. This should be a sys::Path interface, this doesn't
// handle things like C:\ right, nor win32 \\network\device\blah.
if (isysroot.size() != 1 || isysroot[0] != '/') // Add isysroot if present.
OpenPOWER on IntegriCloud