diff options
-rw-r--r-- | lib/Driver/Tools.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 7e3ed2461a..fb5bad4f24 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// #include <sys/stat.h> -#include <unistd.h> #include "Tools.h" #include "InputInfo.h" #include "SanitizerArgs.h" @@ -1780,9 +1779,11 @@ static bool shouldUseLeafFramePointer(const ArgList &Args, static void addDebugCompDirArg(const ArgList &Args, ArgStringList &CmdArgs) { struct stat StatPWDBuf, StatDotBuf; - const char *pwd; - if ((pwd = ::getenv("PWD")) != 0 && - llvm::sys::path::is_absolute(pwd) && + const char *pwd = ::getenv("PWD"); + if (!pwd) + return; + + if (llvm::sys::path::is_absolute(pwd) && stat(pwd, &StatPWDBuf) == 0 && stat(".", &StatDotBuf) == 0 && StatPWDBuf.st_ino == StatDotBuf.st_ino && |