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.

llvm-svn: 65026
This commit is contained in:
Chris Lattner 2009-02-19 06:48:28 +00:00
parent 5555697fa0
commit 06ef388a61
3 changed files with 8 additions and 5 deletions

View File

@ -1098,8 +1098,11 @@ void InitializeIncludePaths(const char *Argv0, HeaderSearch &Headers,
MainExecutablePath.eraseComponent(); // Remove /clang from foo/bin/clang MainExecutablePath.eraseComponent(); // Remove /clang from foo/bin/clang
MainExecutablePath.eraseComponent(); // Remove /bin from foo/bin MainExecutablePath.eraseComponent(); // Remove /bin from foo/bin
MainExecutablePath.appendComponent("Headers"); // Get foo/Headers 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) if (!nostdinc)

View File

@ -50,7 +50,7 @@ public:
/// AddPath - Add the specified path to the specified group list. /// AddPath - Add the specified path to the specified group list.
void AddPath(const std::string &Path, IncludeDirGroup Group, void AddPath(const std::string &Path, IncludeDirGroup Group,
bool isCXXAware, bool isUserSupplied, bool isCXXAware, bool isUserSupplied,
bool isFramework); bool isFramework, bool IgnoreSysRoot = false);
/// AddEnvVarPaths - Add a list of paths from an environment variable to a /// AddEnvVarPaths - Add a list of paths from an environment variable to a
/// header search list. /// header search list.

View File

@ -24,7 +24,7 @@ using namespace clang;
void InitHeaderSearch::AddPath(const std::string &Path, IncludeDirGroup Group, void InitHeaderSearch::AddPath(const std::string &Path, IncludeDirGroup Group,
bool isCXXAware, bool isUserSupplied, bool isCXXAware, bool isUserSupplied,
bool isFramework) { bool isFramework, bool IgnoreSysRoot) {
assert(!Path.empty() && "can't handle empty path here"); assert(!Path.empty() && "can't handle empty path here");
FileManager &FM = Headers.getFileMgr(); FileManager &FM = Headers.getFileMgr();
@ -32,7 +32,7 @@ void InitHeaderSearch::AddPath(const std::string &Path, IncludeDirGroup Group,
llvm::SmallString<256> MappedPath; llvm::SmallString<256> MappedPath;
// Handle isysroot. // Handle isysroot.
if (Group == System) { if (Group == System && !IgnoreSysRoot) {
// FIXME: Portability. This should be a sys::Path interface, this doesn't // FIXME: Portability. This should be a sys::Path interface, this doesn't
// handle things like C:\ right, nor win32 \\network\device\blah. // handle things like C:\ right, nor win32 \\network\device\blah.
if (isysroot.size() != 1 || isysroot[0] != '/') // Add isysroot if present. if (isysroot.size() != 1 || isysroot[0] != '/') // Add isysroot if present.