Driver: Lift clang resource directory computation to the Driver object.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93971 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp
index b073c0a..c2693d8 100644
--- a/lib/Driver/Driver.cpp
+++ b/lib/Driver/Driver.cpp
@@ -67,6 +67,14 @@
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 010953d..5e1d266 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 @@
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.