aboutsummaryrefslogtreecommitdiff
path: root/lib/Driver/Driver.cpp
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2013-03-12 20:17:58 +0000
committerJim Grosbach <grosbach@apple.com>2013-03-12 20:17:58 +0000
commit61d16c1f491f5ad6d4a254dcca8868acb5f150cc (patch)
treec8e18ed2f705da883d2975633cc77a96e2ad2539 /lib/Driver/Driver.cpp
parent327a6d9cbeb8cad648084df1ee43f2e9d7dc8296 (diff)
Driver: -ccc-install-dir should affect cc1 -resource-dir
-ccc-install-dir is supposed to cause the compiler to behave as-if it were installed in the indicated location. It almost does, but misses anything that's relying on the resource directory (libc++ header search, in particular). The resource dir is resolved too early, before command line args are handled. The fix is simply to move handling of the resource dir until after we know if a -ccc-install-dir is present. rdar://13402696 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176894 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Driver.cpp')
-rw-r--r--lib/Driver/Driver.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp
index 652046fce4..140c8799f1 100644
--- a/lib/Driver/Driver.cpp
+++ b/lib/Driver/Driver.cpp
@@ -59,15 +59,6 @@ Driver::Driver(StringRef ClangExecutable,
Name = llvm::sys::path::stem(ClangExecutable);
Dir = llvm::sys::path::parent_path(ClangExecutable);
-
- // Compute the path to the resource directory.
- StringRef ClangResourceDir(CLANG_RESOURCE_DIR);
- SmallString<128> P(Dir);
- if (ClangResourceDir != "")
- llvm::sys::path::append(P, ClangResourceDir);
- else
- llvm::sys::path::append(P, "..", "lib", "clang", CLANG_VERSION_STRING);
- ResourceDir = P.str();
}
Driver::~Driver() {
@@ -291,6 +282,17 @@ Compilation *Driver::BuildCompilation(ArrayRef<const char *> ArgList) {
if (Args->hasArg(options::OPT_nostdlib))
UseStdLib = false;
+ // Compute the path to the resource directory. We used to do this in
+ // Driver::Driver(), but that's not right, as command line args (such as
+ // ccc-install-dir) can change 'Dir'.
+ StringRef ClangResourceDir(CLANG_RESOURCE_DIR);
+ SmallString<128> P(Dir);
+ if (!ClangResourceDir.empty())
+ llvm::sys::path::append(P, ClangResourceDir);
+ else
+ llvm::sys::path::append(P, "..", "lib", "clang", CLANG_VERSION_STRING);
+ ResourceDir = P.str();
+
// Perform the default argument translations.
DerivedArgList *TranslatedArgs = TranslateInputArgs(*Args);