Skip to content

Commit 06067c5

Browse files
committed
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. llvm-svn: 116803
1 parent ffae4a6 commit 06067c5

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

clang/lib/Driver/Driver.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,16 @@ Driver::Driver(llvm::StringRef _ClangExecutable,
8181
Dir = Executable.getDirname();
8282

8383
// Compute the path to the resource directory.
84+
llvm::StringRef ClangResourceDir(CLANG_RESOURCE_DIR);
8485
llvm::sys::Path P(Dir);
85-
P.eraseComponent(); // Remove /bin from foo/bin
86-
P.appendComponent("lib");
87-
P.appendComponent("clang");
88-
P.appendComponent(CLANG_VERSION_STRING);
86+
if (ClangResourceDir != "") {
87+
P.appendComponent(ClangResourceDir);
88+
} else {
89+
P.appendComponent(".."); // Walk up from a 'bin' subdirectory.
90+
P.appendComponent("lib");
91+
P.appendComponent("clang");
92+
P.appendComponent(CLANG_VERSION_STRING);
93+
}
8994
ResourceDir = P.str();
9095
}
9196

0 commit comments

Comments
 (0)