aboutsummaryrefslogtreecommitdiff
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
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
-rw-r--r--lib/Driver/Driver.cpp21
-rw-r--r--test/Driver/resource-dir.cpp10
2 files changed, 10 insertions, 21 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);
diff --git a/test/Driver/resource-dir.cpp b/test/Driver/resource-dir.cpp
deleted file mode 100644
index 106e883995..0000000000
--- a/test/Driver/resource-dir.cpp
+++ /dev/null
@@ -1,10 +0,0 @@
-// RUN: %clang %s -fsyntax-only -### 2> %t.log
-// RUN: FileCheck %s --check-prefix=CHECK-DEFAULT < %t.log
-
-// CHECK-DEFAULT: "-resource-dir" "{{.+}}/../lib/clang/{{.+}}"
-
-// RUN: %clang %s -fsyntax-only -ccc-install-dir /my/install/dir -### 2> %t.log
-// RUN: FileCheck %s --check-prefix=CHECK-INSTALL-DIR < %t.log
-// CHECK-INSTALL-DIR: "-resource-dir" "/my/install/dir{{[\\/]+}}..{{[\\/]+}}lib{{[\\/]+}}clang{{[\\/]+.+}}"
-
-void foo(void) {}