[llvm-commits] [llvm] r118174 - in /llvm/trunk: include/llvm/Support/SystemUtils.h lib/CompilerDriver/Action.cpp lib/Support/SystemUtils.cpp tools/bugpoint/OptimizerDriver.cpp tools/bugpoint/ToolRunner.cpp tools/llvm-ld/llvm-ld.cpp
Mikhail Glushenkov
foldr at codedgers.com
Wed Nov 3 09:14:17 PDT 2010
Author: foldr
Date: Wed Nov 3 11:14:16 2010
New Revision: 118174
URL: http://llvm.org/viewvc/llvm-project?rev=118174&view=rev
Log:
Rename FindExecutable to PrependMainExecutablePath.
Makes it more clear that it is just a path manipulation function.
Modified:
llvm/trunk/include/llvm/Support/SystemUtils.h
llvm/trunk/lib/CompilerDriver/Action.cpp
llvm/trunk/lib/Support/SystemUtils.cpp
llvm/trunk/tools/bugpoint/OptimizerDriver.cpp
llvm/trunk/tools/bugpoint/ToolRunner.cpp
llvm/trunk/tools/llvm-ld/llvm-ld.cpp
Modified: llvm/trunk/include/llvm/Support/SystemUtils.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/SystemUtils.h?rev=118174&r1=118173&r2=118174&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/SystemUtils.h (original)
+++ llvm/trunk/include/llvm/Support/SystemUtils.h Wed Nov 3 11:14:16 2010
@@ -30,13 +30,14 @@
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
Modified: llvm/trunk/lib/CompilerDriver/Action.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CompilerDriver/Action.cpp?rev=118174&r1=118173&r2=118174&view=diff
==============================================================================
--- llvm/trunk/lib/CompilerDriver/Action.cpp (original)
+++ llvm/trunk/lib/CompilerDriver/Action.cpp Wed Nov 3 11:14:16 2010
@@ -57,7 +57,8 @@
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);
Modified: llvm/trunk/lib/Support/SystemUtils.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/SystemUtils.cpp?rev=118174&r1=118173&r2=118174&view=diff
==============================================================================
--- llvm/trunk/lib/Support/SystemUtils.cpp (original)
+++ llvm/trunk/lib/Support/SystemUtils.cpp Wed Nov 3 11:14:16 2010
@@ -32,13 +32,14 @@
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.
Modified: llvm/trunk/tools/bugpoint/OptimizerDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/OptimizerDriver.cpp?rev=118174&r1=118173&r2=118174&view=diff
==============================================================================
--- llvm/trunk/tools/bugpoint/OptimizerDriver.cpp (original)
+++ llvm/trunk/tools/bugpoint/OptimizerDriver.cpp Wed Nov 3 11:14:16 2010
@@ -144,7 +144,8 @@
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;
Modified: llvm/trunk/tools/bugpoint/ToolRunner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/ToolRunner.cpp?rev=118174&r1=118173&r2=118174&view=diff
==============================================================================
--- llvm/trunk/tools/bugpoint/ToolRunner.cpp (original)
+++ llvm/trunk/tools/bugpoint/ToolRunner.cpp Wed Nov 3 11:14:16 2010
@@ -238,7 +238,7 @@
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 @@
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 @@
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 @@
///
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";
Modified: llvm/trunk/tools/llvm-ld/llvm-ld.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ld/llvm-ld.cpp?rev=118174&r1=118173&r2=118174&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-ld/llvm-ld.cpp (original)
+++ llvm/trunk/tools/llvm-ld/llvm-ld.cpp Wed Nov 3 11:14:16 2010
@@ -415,8 +415,8 @@
// 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 @@
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 @@
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());
More information about the llvm-commits
mailing list