diff options
Diffstat (limited to 'lib/Driver/Tools.cpp')
-rw-r--r-- | lib/Driver/Tools.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 5d152e5232..40aebd4d10 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -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)); } |