]> granicus.if.org Git - clang/commitdiff
[driver] Revert r180652 and 180658 and temporarily #define MAXPATHLEN to
authorChad Rosier <mcrosier@apple.com>
Sat, 27 Apr 2013 01:14:43 +0000 (01:14 +0000)
committerChad Rosier <mcrosier@apple.com>
Sat, 27 Apr 2013 01:14:43 +0000 (01:14 +0000)
make the gdb tests and the Windows bots happy.

The Path::GetCurrentDirectory API is not equivalent to ::getcwd(), so
r180652 causes a gdb tests to fail.  On the other hand, <sys/param.h>
isn't defined on Windows systems, so that causes Windows builds to fail.
rdar://12237559

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180661 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Tools.cpp

index 5d152e52325f467ee9835048d62fce1a52f1e206..40aebd4d1004ad0ba40f31e286613bef296fa18e 100644 (file)
@@ -1775,6 +1775,9 @@ static bool shouldUseLeafFramePointer(const ArgList &Args,
   return true;
 }
 
+// FIXME: This is a temporary hack until I can find a fix that works for all
+// platforms.
+#define MAXPATHLEN 4096
 /// If the PWD environment variable is set, add a CC1 option to specify the
 /// debug compilation directory.
 static void addDebugCompDirArg(const ArgList &Args, ArgStringList &CmdArgs) {
@@ -1792,8 +1795,8 @@ static void addDebugCompDirArg(const ArgList &Args, ArgStringList &CmdArgs) {
     return;
   }
   // Fall back to using getcwd.
-  std::string cwd = llvm::sys::Path::GetCurrentDirectory().str();
-  if (pwd && !cwd.empty()) {
+  char *cwd;
+  if (pwd && ::getcwd(cwd, MAXPATHLEN)) {
     CmdArgs.push_back("-fdebug-compilation-dir");
     CmdArgs.push_back(Args.MakeArgString(cwd));
   }