diff options
author | Michael J. Spencer <bigcheesegs@gmail.com> | 2010-12-21 16:45:57 +0000 |
---|---|---|
committer | Michael J. Spencer <bigcheesegs@gmail.com> | 2010-12-21 16:45:57 +0000 |
commit | 740857fa10e0e70b2145acb7164b9b526da89a0a (patch) | |
tree | a1435900132a2617e54d6667c4c1ac0dc9538171 /clang/tools/driver/driver.cpp | |
parent | bc721825e8503fcb6fdcdb4ba900047b1d45b3ec (diff) | |
download | bcm5719-llvm-740857fa10e0e70b2145acb7164b9b526da89a0a.tar.gz bcm5719-llvm-740857fa10e0e70b2145acb7164b9b526da89a0a.zip |
Replace all uses of PathV1::makeAbsolute with PathV2::fs::make_absolute.
llvm-svn: 122340
Diffstat (limited to 'clang/tools/driver/driver.cpp')
-rw-r--r-- | clang/tools/driver/driver.cpp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/clang/tools/driver/driver.cpp b/clang/tools/driver/driver.cpp index c88a7a30540..594b07bd2ce 100644 --- a/clang/tools/driver/driver.cpp +++ b/clang/tools/driver/driver.cpp @@ -23,6 +23,7 @@ #include "llvm/ADT/OwningPtr.h" #include "llvm/Config/config.h" #include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/FileSystem.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/PrettyStackTrace.h" @@ -309,19 +310,22 @@ int main(int argc_, const char **argv_) { // Attempt to find the original path used to invoke the driver, to determine // the installed path. We do this manually, because we want to support that // path being a symlink. - llvm::sys::Path InstalledPath(argv[0]); - - // Do a PATH lookup, if there are no directory components. - if (llvm::sys::path::filename(InstalledPath.str()) == InstalledPath.str()) { - llvm::sys::Path Tmp = llvm::sys::Program::FindProgramByName( - llvm::sys::path::filename(InstalledPath.str())); - if (!Tmp.empty()) - InstalledPath = Tmp; + { + llvm::SmallString<128> InstalledPath(argv[0]); + + // Do a PATH lookup, if there are no directory components. + if (llvm::sys::path::filename(InstalledPath) == InstalledPath) { + llvm::sys::Path Tmp = llvm::sys::Program::FindProgramByName( + llvm::sys::path::filename(InstalledPath.str())); + if (!Tmp.empty()) + InstalledPath = Tmp.str(); + } + llvm::sys::fs::make_absolute(InstalledPath); + InstalledPath = llvm::sys::path::parent_path(InstalledPath); + bool exists; + if (!llvm::sys::fs::exists(InstalledPath.str(), exists) && exists) + TheDriver.setInstalledDir(InstalledPath); } - InstalledPath.makeAbsolute(); - InstalledPath.eraseComponent(); - if (InstalledPath.exists()) - TheDriver.setInstalledDir(InstalledPath.str()); // Check for ".*++" or ".*++-[^-]*" to determine if we are a C++ // compiler. This matches things like "c++", "clang++", and "clang++-1.1". |