From: Chandler Carruth Date: Tue, 19 Oct 2010 08:47:51 +0000 (+0000) Subject: Use CLANG_RESOURCE_DIR define if one is provided, otherwise use the default of X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=acd65bd27011f5aa863bcf3a980888e3760dae26;p=clang Use CLANG_RESOURCE_DIR define if one is provided, otherwise use the default of '../lib/clang/'. 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 --- 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(); }