From: Argyrios Kyrtzidis Date: Fri, 26 Oct 2012 20:09:24 +0000 (+0000) Subject: [driver] Before applying the working directory check if the input path X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ccb428bb04adaa909431d6e929b8f9e6bdbe7208;p=clang [driver] Before applying the working directory check if the input path is absolute. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166808 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index 31492a7b6d..43e9e5d69f 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -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); } diff --git a/test/Driver/working-directory-and-abs.c b/test/Driver/working-directory-and-abs.c new file mode 100644 index 0000000000..6738c776d4 --- /dev/null +++ b/test/Driver/working-directory-and-abs.c @@ -0,0 +1 @@ +// RUN: %clang -working-directory=%S %S/working-directory-and-abs.c -fsyntax-only