Driver: Fix a possible use after free.

llvm-svn: 108659
This commit is contained in:
Daniel Dunbar 2010-07-18 21:16:15 +00:00
parent 3b4621103a
commit b31b76f1eb
2 changed files with 6 additions and 6 deletions

View File

@ -167,8 +167,8 @@ public:
void setTitle(std::string Value) { DriverTitle = Value; }
/// \brief Get the path to the main clang executable.
std::string getClangProgramPath() const {
return ClangExecutable;
const char *getClangProgramPath() const {
return ClangExecutable.c_str();
}
/// @}

View File

@ -1489,7 +1489,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
Args.AddAllArgs(CmdArgs, options::OPT_undef);
std::string Exec = getToolChain().getDriver().getClangProgramPath();
const char *Exec = getToolChain().getDriver().getClangProgramPath();
// Optionally embed the -cc1 level arguments into the debug info, for build
// analysis.
@ -1509,7 +1509,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back(Args.MakeArgString(Flags.str()));
}
Dest.addCommand(new Command(JA, *this, Exec.c_str(), CmdArgs));
Dest.addCommand(new Command(JA, *this, Exec, CmdArgs));
// Explicitly warn that these options are unsupported, even though
// we are allowing compilation to continue.
@ -1588,8 +1588,8 @@ void ClangAs::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back(Input.getFilename());
}
std::string Exec = getToolChain().getDriver().getClangProgramPath();
Dest.addCommand(new Command(JA, *this, Exec.c_str(), CmdArgs));
const char *Exec = getToolChain().getDriver().getClangProgramPath();
Dest.addCommand(new Command(JA, *this, Exec, CmdArgs));
}
void gcc::Common::ConstructJob(Compilation &C, const JobAction &JA,