diff options
-rw-r--r-- | include/clang/Driver/Driver.h | 3 | ||||
-rw-r--r-- | lib/Driver/Driver.cpp | 8 | ||||
-rw-r--r-- | lib/Driver/Tools.cpp | 10 |
3 files changed, 12 insertions, 9 deletions
diff --git a/include/clang/Driver/Driver.h b/include/clang/Driver/Driver.h index 8933619b2c..3186471ce6 100644 --- a/include/clang/Driver/Driver.h +++ b/include/clang/Driver/Driver.h @@ -61,6 +61,9 @@ public: /// command line. std::string Dir; + /// The path to the compiler resource directory. + std::string ResourceDir; + /// Default host triple. std::string DefaultHostTriple; diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index b073c0ae1e..c2693d8dff 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -67,6 +67,14 @@ Driver::Driver(llvm::StringRef _Name, llvm::StringRef _Dir, CCCUseClangCXX = false; } + + // Compute the path to the resource directory. + llvm::sys::Path P(Dir); + P.eraseComponent(); // Remove /bin from foo/bin + P.appendComponent("lib"); + P.appendComponent("clang"); + P.appendComponent(CLANG_VERSION_STRING); + ResourceDir = P.str(); } Driver::~Driver() { diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 010953df5e..5e1d2661dd 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -9,7 +9,6 @@ #include "Tools.h" -#include "clang/Basic/Version.h" #include "clang/Driver/Action.h" #include "clang/Driver/Arg.h" #include "clang/Driver/ArgList.h" @@ -864,15 +863,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, Args.AddLastArg(CmdArgs, options::OPT_nobuiltininc); // Pass the path to compiler resource files. - // - // FIXME: Get this from a configuration object. - llvm::sys::Path P(D.Dir); - P.eraseComponent(); // Remove /bin from foo/bin - P.appendComponent("lib"); - P.appendComponent("clang"); - P.appendComponent(CLANG_VERSION_STRING); CmdArgs.push_back("-resource-dir"); - CmdArgs.push_back(Args.MakeArgString(P.str())); + CmdArgs.push_back(D.ResourceDir.c_str()); // Add preprocessing options like -I, -D, etc. if we are using the // preprocessor. |