]> granicus.if.org Git - clang/commitdiff
Driver: Lift clang resource directory computation to the Driver object.
authorDaniel Dunbar <daniel@zuster.org>
Wed, 20 Jan 2010 02:35:16 +0000 (02:35 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Wed, 20 Jan 2010 02:35:16 +0000 (02:35 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93971 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Driver/Driver.h
lib/Driver/Driver.cpp
lib/Driver/Tools.cpp

index 8933619b2c2584f07141563bc831d456e0e24951..3186471ce613fa69ca795f6cab957edc57d7174c 100644 (file)
@@ -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;
 
index b073c0ae1ef9823ef7596e1461c0fd2a9a04df4f..c2693d8dfff0d9eb8feed33bf1f8fcf7ca3db806 100644 (file)
@@ -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() {
index 010953df5e0efd6edd5f44a3bbdc61701cddd004..5e1d2661dd19c10e64da705edd93536fb3a8dd49 100644 (file)
@@ -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.