summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/Driver.cpp
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2012-02-20 14:13:25 +0000
committerAaron Ballman <aaron@aaronballman.com>2012-02-20 14:13:25 +0000
commit232c4f50ba576e9a23918756dff302b651288d66 (patch)
tree81b187dca9f313d2ed53a42bd3c84e32ffb02fe0 /clang/lib/Driver/Driver.cpp
parente550fa2f950e16c18276dfe82fd985cf2f28bba0 (diff)
downloadbcm5719-llvm-232c4f50ba576e9a23918756dff302b651288d66.tar.gz
bcm5719-llvm-232c4f50ba576e9a23918756dff302b651288d66.zip
Fixing the working-directory option so that it stores the proper directory.
llvm-svn: 150960
Diffstat (limited to 'clang/lib/Driver/Driver.cpp')
-rw-r--r--clang/lib/Driver/Driver.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index e105e99246e..da1a40d1e6b 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -960,14 +960,16 @@ void Driver::BuildInputs(const ToolChain &TC, const DerivedArgList &Args,
// Check that the file exists, if enabled.
if (CheckInputsExist && memcmp(Value, "-", 2) != 0) {
SmallString<64> Path(Value);
- if (Arg *WorkDir = Args.getLastArg(options::OPT_working_directory))
- if (llvm::sys::path::is_absolute(Path.str())) {
- Path = WorkDir->getValue(Args);
- llvm::sys::path::append(Path, Value);
+ if (Arg *WorkDir = Args.getLastArg(options::OPT_working_directory)) {
+ SmallString<64> Directory(WorkDir->getValue(Args));
+ if (llvm::sys::path::is_absolute(Directory.str())) {
+ llvm::sys::path::append(Directory, Value);
+ Path.assign(Directory);
}
+ }
bool exists = false;
- if (/*error_code ec =*/llvm::sys::fs::exists(Value, exists) || !exists)
+ if (llvm::sys::fs::exists(Path.c_str(), exists) || !exists)
Diag(clang::diag::err_drv_no_such_file) << Path.str();
else
Inputs.push_back(std::make_pair(Ty, A));
OpenPOWER on IntegriCloud