aboutsummaryrefslogtreecommitdiff
path: root/lib/Driver/Driver.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2011-02-08 20:31:42 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2011-02-08 20:31:42 +0000
commit09982cec0029bc495591067fa89967b6b4d1fa19 (patch)
tree0ee120197623323b25018c8d469a36f4381d49d3 /lib/Driver/Driver.cpp
parentf76b092e1a6f0df4a5c64aae3c71d6e81e4b717c (diff)
Allow multiple -B prefixes. Patch by Joerg Sonnenberger.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125111 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Driver.cpp')
-rw-r--r--lib/Driver/Driver.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp
index 6edc46cdc1..a4f6c3ffa1 100644
--- a/lib/Driver/Driver.cpp
+++ b/lib/Driver/Driver.cpp
@@ -281,8 +281,12 @@ Compilation *Driver::BuildCompilation(int argc, const char **argv) {
DefaultHostTriple = A->getValue(*Args);
if (const Arg *A = Args->getLastArg(options::OPT_ccc_install_dir))
Dir = InstalledDir = A->getValue(*Args);
- if (const Arg *A = Args->getLastArg(options::OPT_B))
- PrefixDir = A->getValue(*Args);
+ for (arg_iterator it = Args->filtered_begin(options::OPT_B),
+ ie = Args->filtered_end(); it != ie; ++it) {
+ const Arg *A = *it;
+ A->claim();
+ PrefixDirs.push_back(A->getValue(*Args, 0));
+ }
Host = GetHostInfo(DefaultHostTriple.c_str());
@@ -1237,8 +1241,9 @@ const char *Driver::GetNamedOutputPath(Compilation &C,
std::string Driver::GetFilePath(const char *Name, const ToolChain &TC) const {
// Respect a limited subset of the '-Bprefix' functionality in GCC by
// attempting to use this prefix when lokup up program paths.
- if (!PrefixDir.empty()) {
- llvm::sys::Path P(PrefixDir);
+ for (Driver::prefix_list::const_iterator it = PrefixDirs.begin(),
+ ie = PrefixDirs.end(); it != ie; ++it) {
+ llvm::sys::Path P(*it);
P.appendComponent(Name);
bool Exists;
if (!llvm::sys::fs::exists(P.str(), Exists) && Exists)
@@ -1262,8 +1267,9 @@ std::string Driver::GetProgramPath(const char *Name, const ToolChain &TC,
bool WantFile) const {
// Respect a limited subset of the '-Bprefix' functionality in GCC by
// attempting to use this prefix when lokup up program paths.
- if (!PrefixDir.empty()) {
- llvm::sys::Path P(PrefixDir);
+ for (Driver::prefix_list::const_iterator it = PrefixDirs.begin(),
+ ie = PrefixDirs.end(); it != ie; ++it) {
+ llvm::sys::Path P(*it);
P.appendComponent(Name);
bool Exists;
if (WantFile ? !llvm::sys::fs::exists(P.str(), Exists) && Exists