[cfe-commits] r93971 - in /cfe/trunk: include/clang/Driver/Driver.h lib/Driver/Driver.cpp lib/Driver/Tools.cpp

Daniel Dunbar daniel at zuster.org
Tue Jan 19 18:35:16 PST 2010


Author: ddunbar
Date: Tue Jan 19 20:35:16 2010
New Revision: 93971

URL: http://llvm.org/viewvc/llvm-project?rev=93971&view=rev
Log:
Driver: Lift clang resource directory computation to the Driver object.

Modified:
    cfe/trunk/include/clang/Driver/Driver.h
    cfe/trunk/lib/Driver/Driver.cpp
    cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/include/clang/Driver/Driver.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Driver.h?rev=93971&r1=93970&r2=93971&view=diff

==============================================================================
--- cfe/trunk/include/clang/Driver/Driver.h (original)
+++ cfe/trunk/include/clang/Driver/Driver.h Tue Jan 19 20:35:16 2010
@@ -61,6 +61,9 @@
   /// command line.
   std::string Dir;
 
+  /// The path to the compiler resource directory.
+  std::string ResourceDir;
+
   /// Default host triple.
   std::string DefaultHostTriple;
 

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=93971&r1=93970&r2=93971&view=diff

==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Tue Jan 19 20:35:16 2010
@@ -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() {

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=93971&r1=93970&r2=93971&view=diff

==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Tue Jan 19 20:35:16 2010
@@ -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.





More information about the cfe-commits mailing list