[cfe-commits] r116803 - /cfe/trunk/lib/Driver/Driver.cpp

Chandler Carruth chandlerc at gmail.com
Tue Oct 19 01:47:51 PDT 2010


Author: chandlerc
Date: Tue Oct 19 03:47:51 2010
New Revision: 116803

URL: http://llvm.org/viewvc/llvm-project?rev=116803&view=rev
Log:
Use CLANG_RESOURCE_DIR define if one is provided, otherwise use the default of
'../lib/clang/<version>'. Actually use '..' rather than removing the trailing
component to correctly handle paths containing '.' or symlinks in the presence
of -no-canonical-prefixes, etc. This shouldn't change any existing behavior.

Modified:
    cfe/trunk/lib/Driver/Driver.cpp

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=116803&r1=116802&r2=116803&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Tue Oct 19 03:47:51 2010
@@ -81,11 +81,16 @@
   Dir = Executable.getDirname();
 
   // Compute the path to the resource directory.
+  llvm::StringRef ClangResourceDir(CLANG_RESOURCE_DIR);
   llvm::sys::Path P(Dir);
-  P.eraseComponent(); // Remove /bin from foo/bin
-  P.appendComponent("lib");
-  P.appendComponent("clang");
-  P.appendComponent(CLANG_VERSION_STRING);
+  if (ClangResourceDir != "") {
+    P.appendComponent(ClangResourceDir);
+  } else {
+    P.appendComponent(".."); // Walk up from a 'bin' subdirectory.
+    P.appendComponent("lib");
+    P.appendComponent("clang");
+    P.appendComponent(CLANG_VERSION_STRING);
+  }
   ResourceDir = P.str();
 }
 





More information about the cfe-commits mailing list