[driver] Before applying the working directory check if the input path

is absolute.

llvm-svn: 166808
This commit is contained in:
Argyrios Kyrtzidis 2012-10-26 20:09:24 +00:00
parent 4a2dcfe5ee
commit c2c77c42ef
2 changed files with 3 additions and 2 deletions

View File

@ -1018,8 +1018,8 @@ void Driver::BuildInputs(const ToolChain &TC, const DerivedArgList &Args,
if (CheckInputsExist && memcmp(Value, "-", 2) != 0) {
SmallString<64> 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())) {
if (!llvm::sys::path::is_absolute(Path.str())) {
SmallString<64> Directory(WorkDir->getValue(Args));
llvm::sys::path::append(Directory, Value);
Path.assign(Directory);
}

View File

@ -0,0 +1 @@
// RUN: %clang -working-directory=%S %S/working-directory-and-abs.c -fsyntax-only