diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 321894ae0034348345c4511d79b9f637d92d52ba..5d152e52325f467ee9835048d62fce1a52f1e206 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -1792,8 +1792,8 @@ static void addDebugCompDirArg(const ArgList &Args, ArgStringList &CmdArgs) { return; } // Fall back to using getcwd. - const char *cwd = llvm::sys::Path::GetCurrentDirectory().c_str(); - if (pwd && cwd) { + std::string cwd = llvm::sys::Path::GetCurrentDirectory().str(); + if (pwd && !cwd.empty()) { CmdArgs.push_back("-fdebug-compilation-dir"); CmdArgs.push_back(Args.MakeArgString(cwd)); }