Driver: Lookup program names using llvm::sys::Program::FindProgramByName

if our usual methods fail. This isn't necessary for running the tool,
but improves the accuracy of logging output.

Also, have GCC tools lookup gcc program path.

llvm-svn: 67243
This commit is contained in:
Daniel Dunbar 2009-03-18 21:34:08 +00:00
parent bf76c6d971
commit 6f66877ebf
2 changed files with 9 additions and 1 deletions

View File

@ -26,6 +26,7 @@
#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/System/Path.h"
#include "llvm/System/Program.h"
#include "InputInfo.h"
@ -879,6 +880,11 @@ llvm::sys::Path Driver::GetProgramPath(const char *Name,
if (P.exists())
return P;
// Search path to increase accuracy of logging output.
P = llvm::sys::Program::FindProgramByName(Name);
if (!P.empty())
return P;
return llvm::sys::Path(Name);
}

View File

@ -392,7 +392,9 @@ void gcc::Common::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back(II.getInputFilename());
}
Dest.addCommand(new Command("gcc", CmdArgs));
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath(C, "gcc").c_str());
Dest.addCommand(new Command(Exec, CmdArgs));
}
void gcc::Preprocess::RenderExtraToolArgs(ArgStringList &CmdArgs) const {