зеркало из https://github.com/microsoft/clang-1.git
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
This commit is contained in:
Родитель
55df49a997
Коммит
225c41706d
|
@ -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.
|
||||
|
|
Загрузка…
Ссылка в новой задаче