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.

llvm-svn: 177815
This commit is contained in:
Bob Wilson 2013-03-23 05:17:59 +00:00
parent fc306d3987
commit a20a1dad7f
2 changed files with 10 additions and 21 deletions

View File

@ -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);

View File

@ -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) {}