aboutsummaryrefslogtreecommitdiff
path: root/lib/Driver/Driver.cpp
diff options
context:
space:
mode:
authorBob Wilson <bob.wilson@apple.com>2013-03-23 05:17:59 +0000
committerBob Wilson <bob.wilson@apple.com>2013-03-23 05:17:59 +0000
commit4a792960940bf19acced0123eae08bd39b15138b (patch)
treed531f661d664a10af8f9cd04d6faa535c7d600f8 /lib/Driver/Driver.cpp
parentb6a6079449a5275c283982e19b0c38e165833bb2 (diff)
Revert svn r176894 and r177658.
Changing -ccc-install-dir to affect cc1's resource-dir setting broke our internal LNT tests. After discussing the situation with Jim, we've decided to pursue an alternate approach. We really want the resource-dir to be located relative to clang, even when using -ccc-install-dir, but we're going to add a fallback setting for the libc++ headers if they don't exist alongside the compiler. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177815 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Driver.cpp')
-rw-r--r--lib/Driver/Driver.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp
index 3167e03ca4..689ecbcd79 100644
--- a/lib/Driver/Driver.cpp
+++ b/lib/Driver/Driver.cpp
@@ -59,6 +59,15 @@ 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() {
@@ -282,18 +291,8 @@ 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 (const Arg *A = Args->getLastArg(options::OPT_resource_dir))
- P = A->getValue();
- else if (!ClangResourceDir.empty())
- llvm::sys::path::append(P, ClangResourceDir);
- else
- llvm::sys::path::append(P, "..", "lib", "clang", CLANG_VERSION_STRING);
- ResourceDir = P.str();
+ ResourceDir = A->getValue();
// Perform the default argument translations.
DerivedArgList *TranslatedArgs = TranslateInputArgs(*Args);