mirror of
https://github.com/intel/llvm.git
synced 2026-01-24 08:30:34 +08:00
Driver: Lift clang resource directory computation to the Driver object.
llvm-svn: 93971
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user