r180670 - Exit early when $PWD isn't set. Remove unused unistd.h include.

Benjamin Kramer benny.kra at googlemail.com
Sat Apr 27 01:42:33 PDT 2013


Author: d0k
Date: Sat Apr 27 03:42:33 2013
New Revision: 180670

URL: http://llvm.org/viewvc/llvm-project?rev=180670&view=rev
Log:
Exit early when $PWD isn't set. Remove unused unistd.h include.

Modified:
    cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=180670&r1=180669&r2=180670&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Sat Apr 27 03:42:33 2013
@@ -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(co
 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 &&





More information about the cfe-commits mailing list