diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2010-10-19 08:47:51 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2010-10-19 08:47:51 +0000 |
commit | acd65bd27011f5aa863bcf3a980888e3760dae26 (patch) | |
tree | 36fba1d4d33d38739d8041d231091e344fa485a9 /lib/Driver/Driver.cpp | |
parent | 5d058e7f64d51f195128cdb13ef0d50df3161218 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116803 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Driver.cpp')
-rw-r--r-- | lib/Driver/Driver.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index b32dac0b88..1355206065 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -81,11 +81,16 @@ Driver::Driver(llvm::StringRef _ClangExecutable, 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(); } |