[cfe-commits] r139127 - /cfe/trunk/lib/Driver/Driver.cpp
Peter Collingbourne
peter at pcc.me.uk
Mon Sep 5 19:08:31 PDT 2011
Author: pcc
Date: Mon Sep 5 21:08:31 2011
New Revision: 139127
URL: http://llvm.org/viewvc/llvm-project?rev=139127&view=rev
Log:
Add the resource directory to the search path for Driver::GetFilePath,
as well as the search path printed by -print-search-dirs.
The main purpose of this change is to cause -print-file-name=include
to print the path to the include directory under Clang's resource
directory, instead of the system compiler's include directory, whose
header files Clang may not be able to parse. Some build scripts will
do something like:
$(CC) -nostdinc -I`$(CC) -print-file-name=include`
to exclude all header paths except the compiler's.
Modified:
cfe/trunk/lib/Driver/Driver.cpp
Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=139127&r1=139126&r2=139127&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Mon Sep 5 21:08:31 2011
@@ -585,7 +585,7 @@
llvm::outs() << *it;
}
llvm::outs() << "\n";
- llvm::outs() << "libraries: =";
+ llvm::outs() << "libraries: =" << ResourceDir;
std::string sysroot;
if (Arg *A = C.getArgs().getLastArg(options::OPT__sysroot_EQ))
@@ -593,8 +593,7 @@
for (ToolChain::path_list::const_iterator it = TC.getFilePaths().begin(),
ie = TC.getFilePaths().end(); it != ie; ++it) {
- if (it != TC.getFilePaths().begin())
- llvm::outs() << ':';
+ llvm::outs() << ':';
const char *path = it->c_str();
if (path[0] == '=')
llvm::outs() << sysroot << path + 1;
@@ -1428,6 +1427,12 @@
return P.str();
}
+ llvm::sys::Path P(ResourceDir);
+ P.appendComponent(Name);
+ bool Exists;
+ if (!llvm::sys::fs::exists(P.str(), Exists) && Exists)
+ return P.str();
+
const ToolChain::path_list &List = TC.getFilePaths();
for (ToolChain::path_list::const_iterator
it = List.begin(), ie = List.end(); it != ie; ++it) {
More information about the cfe-commits
mailing list