aboutsummaryrefslogtreecommitdiff
path: root/lib/Driver/Driver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Driver/Driver.cpp')
-rw-r--r--lib/Driver/Driver.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp
index 1355206065..c7a7434837 100644
--- a/lib/Driver/Driver.cpp
+++ b/lib/Driver/Driver.cpp
@@ -753,10 +753,19 @@ void Driver::BuildActions(const ToolChain &TC, const ArgList &Args,
}
// Check that the file exists, if enabled.
- if (CheckInputsExist && memcmp(Value, "-", 2) != 0 &&
- !llvm::sys::Path(Value).exists())
- Diag(clang::diag::err_drv_no_such_file) << A->getValue(Args);
- else
+ if (CheckInputsExist && memcmp(Value, "-", 2) != 0) {
+ llvm::sys::Path Path(Value);
+ if (Arg *WorkDir = Args.getLastArg(options::OPT_working_directory))
+ if (!Path.isAbsolute()) {
+ Path = WorkDir->getValue(Args);
+ Path.appendComponent(Value);
+ }
+
+ if (!Path.exists())
+ Diag(clang::diag::err_drv_no_such_file) << Path.str();
+ else
+ Inputs.push_back(std::make_pair(Ty, A));
+ } else
Inputs.push_back(std::make_pair(Ty, A));
} else if (A->getOption().isLinkerInput()) {