r180661 - [driver] Revert r180652 and 180658 and temporarily #define MAXPATHLEN to

Chad Rosier mcrosier at apple.com
Fri Apr 26 18:14:43 PDT 2013


Author: mcrosier
Date: Fri Apr 26 20:14:43 2013
New Revision: 180661

URL: http://llvm.org/viewvc/llvm-project?rev=180661&view=rev
Log:
[driver] Revert r180652 and 180658 and temporarily #define MAXPATHLEN to
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

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=180661&r1=180660&r2=180661&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Fri Apr 26 20:14:43 2013
@@ -1775,6 +1775,9 @@ static bool shouldUseLeafFramePointer(co
   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 Arg
     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));
   }





More information about the cfe-commits mailing list