Fix the dangling pointer.

llvm-svn: 180658
This commit is contained in:
Chad Rosier 2013-04-27 00:57:18 +00:00
parent 1357ab74e5
commit df001f7fb2
1 changed files with 2 additions and 2 deletions

View File

@ -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));
}