summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikhail Glushenkov <foldr@codedgers.com>2010-11-03 16:14:16 +0000
committerMikhail Glushenkov <foldr@codedgers.com>2010-11-03 16:14:16 +0000
commitb8211b80bc53699674645172f0af82a72dcbdc41 (patch)
treee415a297796797d6b5acff67d96c4d817a2d096c
parent189c6c687ced08ff933098ea5a005c9b6e345064 (diff)
downloadbcm5719-llvm-b8211b80bc53699674645172f0af82a72dcbdc41.tar.gz
bcm5719-llvm-b8211b80bc53699674645172f0af82a72dcbdc41.zip
Rename FindExecutable to PrependMainExecutablePath.
Makes it more clear that it is just a path manipulation function. llvm-svn: 118174
-rw-r--r--llvm/include/llvm/Support/SystemUtils.h13
-rw-r--r--llvm/lib/CompilerDriver/Action.cpp3
-rw-r--r--llvm/lib/Support/SystemUtils.cpp15
-rw-r--r--llvm/tools/bugpoint/OptimizerDriver.cpp3
-rw-r--r--llvm/tools/bugpoint/ToolRunner.cpp10
-rw-r--r--llvm/tools/llvm-ld/llvm-ld.cpp12
6 files changed, 30 insertions, 26 deletions
diff --git a/llvm/include/llvm/Support/SystemUtils.h b/llvm/include/llvm/Support/SystemUtils.h
index 91fcfed0288..399aee51eb7 100644
--- a/llvm/include/llvm/Support/SystemUtils.h
+++ b/llvm/include/llvm/Support/SystemUtils.h
@@ -30,13 +30,14 @@ bool CheckBitcodeOutputToConsole(
bool print_warning = true ///< Control whether warnings are printed
);
-/// FindExecutable - Find a named executable, given the value of argv[0] of the
-/// program being executed and the address of main itself. This allows us to
-/// find another LLVM tool if it is built in the same directory. An empty string
-/// is returned on error.
+/// PrependMainExecutablePath - Prepend the path to the program being executed
+/// to \p ExeName, given the value of argv[0] and the address of main()
+/// itself. This allows us to find another LLVM tool if it is built in the same
+/// directory. An empty string is returned on error; note that this function
+/// just mainpulates the path and doesn't check for executability.
/// @brief Find a named executable.
-sys::Path FindExecutable(const std::string &ExeName,
- const char *Argv0, void *MainAddr);
+sys::Path PrependMainExecutablePath(const std::string &ExeName,
+ const char *Argv0, void *MainAddr);
} // End llvm namespace
diff --git a/llvm/lib/CompilerDriver/Action.cpp b/llvm/lib/CompilerDriver/Action.cpp
index 54b55d0d42f..19f5bbaa006 100644
--- a/llvm/lib/CompilerDriver/Action.cpp
+++ b/llvm/lib/CompilerDriver/Action.cpp
@@ -57,7 +57,8 @@ namespace {
sys::Path prog(name);
if (!prog.isAbsolute()) {
- prog = FindExecutable(name, ProgramName, (void *)(intptr_t)&Main);
+ prog = PrependMainExecutablePath(name, ProgramName,
+ (void *)(intptr_t)&Main);
if (!prog.canExecute()) {
prog = sys::Program::FindProgramByName(name);
diff --git a/llvm/lib/Support/SystemUtils.cpp b/llvm/lib/Support/SystemUtils.cpp
index ff076637ab5..9646d75bd2e 100644
--- a/llvm/lib/Support/SystemUtils.cpp
+++ b/llvm/lib/Support/SystemUtils.cpp
@@ -32,13 +32,14 @@ bool llvm::CheckBitcodeOutputToConsole(raw_ostream &stream_to_check,
return false;
}
-/// FindExecutable - Find a named executable, given the value of argv[0] of the
-/// program being executed and the address of main itself. This allows us to
-/// find another LLVM tool if it is built in the same directory. An empty string
-/// is returned on error.
-#undef FindExecutable // needed on windows :(
-sys::Path llvm::FindExecutable(const std::string &ExeName,
- const char *Argv0, void *MainAddr) {
+/// PrependMainExecutablePath - Prepend the path to the program being executed
+/// to \p ExeName, given the value of argv[0] and the address of main()
+/// itself. This allows us to find another LLVM tool if it is built in the same
+/// directory. An empty string is returned on error; note that this function
+/// just mainpulates the path and doesn't check for executability.
+/// @brief Find a named executable.
+sys::Path llvm::PrependMainExecutablePath(const std::string &ExeName,
+ const char *Argv0, void *MainAddr) {
// Check the directory that the calling program is in. We can do
// this if ProgramPath contains at least one / character, indicating that it
// is a relative path to the executable itself.
diff --git a/llvm/tools/bugpoint/OptimizerDriver.cpp b/llvm/tools/bugpoint/OptimizerDriver.cpp
index d28ce79877a..e8c1ab5f911 100644
--- a/llvm/tools/bugpoint/OptimizerDriver.cpp
+++ b/llvm/tools/bugpoint/OptimizerDriver.cpp
@@ -144,7 +144,8 @@ bool BugDriver::runPasses(Module *Program,
return 1;
}
- sys::Path tool = FindExecutable("opt", getToolName(), (void*)"opt");
+ sys::Path tool = PrependMainExecutablePath("opt", getToolName(),
+ (void*)"opt");
if (tool.empty()) {
errs() << "Cannot find `opt' in executable directory!\n";
return 1;
diff --git a/llvm/tools/bugpoint/ToolRunner.cpp b/llvm/tools/bugpoint/ToolRunner.cpp
index 83b358be552..ea82a6cd26e 100644
--- a/llvm/tools/bugpoint/ToolRunner.cpp
+++ b/llvm/tools/bugpoint/ToolRunner.cpp
@@ -238,7 +238,7 @@ AbstractInterpreter *AbstractInterpreter::createLLI(const char *Argv0,
std::string &Message,
const std::vector<std::string> *ToolArgs) {
std::string LLIPath =
- FindExecutable("lli", Argv0, (void *)(intptr_t)&createLLI).str();
+ PrependMainExecutablePath("lli", Argv0, (void *)(intptr_t)&createLLI).str();
if (!LLIPath.empty()) {
Message = "Found lli: " + LLIPath + "\n";
return new LLI(LLIPath, ToolArgs);
@@ -438,7 +438,7 @@ LLC *AbstractInterpreter::createLLC(const char *Argv0,
const std::vector<std::string> *GCCArgs,
bool UseIntegratedAssembler) {
std::string LLCPath =
- FindExecutable("llc", Argv0, (void *)(intptr_t)&createLLC).str();
+ PrependMainExecutablePath("llc", Argv0, (void *)(intptr_t)&createLLC).str();
if (LLCPath.empty()) {
Message = "Cannot find `llc' in executable directory!\n";
return 0;
@@ -526,7 +526,7 @@ int JIT::ExecuteProgram(const std::string &Bitcode,
AbstractInterpreter *AbstractInterpreter::createJIT(const char *Argv0,
std::string &Message, const std::vector<std::string> *Args) {
std::string LLIPath =
- FindExecutable("lli", Argv0, (void *)(intptr_t)&createJIT).str();
+ PrependMainExecutablePath("lli", Argv0, (void *)(intptr_t)&createJIT).str();
if (!LLIPath.empty()) {
Message = "Found lli: " + LLIPath + "\n";
return new JIT(LLIPath, Args);
@@ -604,11 +604,11 @@ int CBE::ExecuteProgram(const std::string &Bitcode,
///
CBE *AbstractInterpreter::createCBE(const char *Argv0,
std::string &Message,
- const std::string &GCCBinary,
+ const std::string &GCCBinary,
const std::vector<std::string> *Args,
const std::vector<std::string> *GCCArgs) {
sys::Path LLCPath =
- FindExecutable("llc", Argv0, (void *)(intptr_t)&createCBE);
+ PrependMainExecutablePath("llc", Argv0, (void *)(intptr_t)&createCBE);
if (LLCPath.isEmpty()) {
Message =
"Cannot find `llc' in executable directory!\n";
diff --git a/llvm/tools/llvm-ld/llvm-ld.cpp b/llvm/tools/llvm-ld/llvm-ld.cpp
index a28592bd979..9bf1081c7f1 100644
--- a/llvm/tools/llvm-ld/llvm-ld.cpp
+++ b/llvm/tools/llvm-ld/llvm-ld.cpp
@@ -415,8 +415,8 @@ static void EmitShellScript(char **argv, Module *M) {
// support windows systems, we copy the llvm-stub.exe executable from the
// build tree to the destination file.
std::string ErrMsg;
- sys::Path llvmstub = FindExecutable("llvm-stub.exe", argv[0],
- (void *)(intptr_t)&Optimize);
+ sys::Path llvmstub = PrependMainExecutablePath("llvm-stub", argv[0],
+ (void *)(intptr_t)&Optimize);
if (llvmstub.isEmpty())
PrintAndExit("Could not find llvm-stub.exe executable!", M);
@@ -664,8 +664,8 @@ int main(int argc, char **argv, char **envp) {
sys::RemoveFileOnSignal(AssemblyFile);
// Determine the locations of the llc and gcc programs.
- sys::Path llc = FindExecutable("llc", argv[0],
- (void *)(intptr_t)&Optimize);
+ sys::Path llc = PrependMainExecutablePath("llc", argv[0],
+ (void *)(intptr_t)&Optimize);
if (llc.isEmpty())
PrintAndExit("Failed to find llc", Composite.get());
@@ -691,8 +691,8 @@ int main(int argc, char **argv, char **envp) {
sys::RemoveFileOnSignal(CFile);
// Determine the locations of the llc and gcc programs.
- sys::Path llc = FindExecutable("llc", argv[0],
- (void *)(intptr_t)&Optimize);
+ sys::Path llc = PrependMainExecutablePath("llc", argv[0],
+ (void *)(intptr_t)&Optimize);
if (llc.isEmpty())
PrintAndExit("Failed to find llc", Composite.get());
OpenPOWER on IntegriCloud