aboutsummaryrefslogtreecommitdiff
path: root/lib/Driver/Driver.cpp
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@apple.com>2011-09-14 00:47:55 +0000
committerChad Rosier <mcrosier@apple.com>2011-09-14 00:47:55 +0000
commit815eb6b80739ffca9879b9833208932dee55d0cb (patch)
tree0f9546f088014b53dcfeaf0a15649e595ba9c721 /lib/Driver/Driver.cpp
parent43f48b0b1bc763dc56db6e01de4fcc44ad389bef (diff)
[driver] Add support for the COMPILER_PATH environment variable, which adds the
specified path(s) to the list of prefix directories. rdar://10097714 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139677 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Driver.cpp')
-rw-r--r--lib/Driver/Driver.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp
index 0f373b3729..d77ae9229c 100644
--- a/lib/Driver/Driver.cpp
+++ b/lib/Driver/Driver.cpp
@@ -241,8 +241,16 @@ Compilation *Driver::BuildCompilation(ArrayRef<const char *> ArgList) {
llvm::PrettyStackTraceString CrashInfo("Compilation construction");
// FIXME: Handle environment options which affect driver behavior, somewhere
- // (client?). GCC_EXEC_PREFIX, COMPILER_PATH, LIBRARY_PATH, LPATH,
- // CC_PRINT_OPTIONS.
+ // (client?). GCC_EXEC_PREFIX, LIBRARY_PATH, LPATH, CC_PRINT_OPTIONS.
+
+ if (char *env = ::getenv("COMPILER_PATH")) {
+ StringRef CompilerPath = env;
+ while (!CompilerPath.empty()) {
+ std::pair<StringRef, StringRef> Split = CompilerPath.split(':');
+ PrefixDirs.push_back(Split.first);
+ CompilerPath = Split.second;
+ }
+ }
// FIXME: What are we going to do with -V and -b?