Exit early when $PWD isn't set. Remove unused unistd.h include.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180670 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 7e3ed24..fb5bad4 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 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 &&