[cfe-commits] r65026 - in /cfe/trunk: Driver/clang.cpp include/clang/Driver/InitHeaderSearch.h lib/Driver/InitHeaderSearch.cpp
Chris Lattner
sabre at nondot.org
Wed Feb 18 22:48:29 PST 2009
Author: lattner
Date: Thu Feb 19 00:48:28 2009
New Revision: 65026
URL: http://llvm.org/viewvc/llvm-project?rev=65026&view=rev
Log:
fix a bug introduced in my previous patch: moving clang headers to the
"after" group instead of the system group makes it so #include <limits.h>
picks up the *system* limits.h file before clang's. This causes a failure
on linux and is definitely not what we want.
Modified:
cfe/trunk/Driver/clang.cpp
cfe/trunk/include/clang/Driver/InitHeaderSearch.h
cfe/trunk/lib/Driver/InitHeaderSearch.cpp
Modified: cfe/trunk/Driver/clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/clang.cpp?rev=65026&r1=65025&r2=65026&view=diff
==============================================================================
--- cfe/trunk/Driver/clang.cpp (original)
+++ cfe/trunk/Driver/clang.cpp Thu Feb 19 00:48:28 2009
@@ -1098,8 +1098,11 @@
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)
Modified: cfe/trunk/include/clang/Driver/InitHeaderSearch.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/InitHeaderSearch.h?rev=65026&r1=65025&r2=65026&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/InitHeaderSearch.h (original)
+++ cfe/trunk/include/clang/Driver/InitHeaderSearch.h Thu Feb 19 00:48:28 2009
@@ -50,7 +50,7 @@
/// 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.
Modified: cfe/trunk/lib/Driver/InitHeaderSearch.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/InitHeaderSearch.cpp?rev=65026&r1=65025&r2=65026&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/InitHeaderSearch.cpp (original)
+++ cfe/trunk/lib/Driver/InitHeaderSearch.cpp Thu Feb 19 00:48:28 2009
@@ -24,7 +24,7 @@
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 @@
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.
More information about the cfe-commits
mailing list