diff options
author | Mikhail Glushenkov <foldr@codedgers.com> | 2010-03-05 04:46:28 +0000 |
---|---|---|
committer | Mikhail Glushenkov <foldr@codedgers.com> | 2010-03-05 04:46:28 +0000 |
commit | cb231bb618cff9eae1724f37932a5d482d77ad38 (patch) | |
tree | 5ca492f3cb218115d3f4cfdcdd71622e2acef40b /llvm/lib/CompilerDriver/Action.cpp | |
parent | e73584384a6c791796143589fa3a89515f506d16 (diff) | |
download | bcm5719-llvm-cb231bb618cff9eae1724f37932a5d482d77ad38.tar.gz bcm5719-llvm-cb231bb618cff9eae1724f37932a5d482d77ad38.zip |
Use FindExecutable as a fall-back search method.
Allows us to find executables that are in the same directory.
llvm-svn: 97786
Diffstat (limited to 'llvm/lib/CompilerDriver/Action.cpp')
-rw-r--r-- | llvm/lib/CompilerDriver/Action.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/llvm/lib/CompilerDriver/Action.cpp b/llvm/lib/CompilerDriver/Action.cpp index 7bcd30a8e0e..9d07811c896 100644 --- a/llvm/lib/CompilerDriver/Action.cpp +++ b/llvm/lib/CompilerDriver/Action.cpp @@ -15,6 +15,7 @@ #include "llvm/CompilerDriver/BuiltinOptions.h" #include "llvm/Support/raw_ostream.h" +#include "llvm/Support/SystemUtils.h" #include "llvm/System/Program.h" #include "llvm/System/TimeValue.h" @@ -24,13 +25,23 @@ using namespace llvm; using namespace llvmc; +namespace llvmc { + +extern int Main(int argc, char** argv); +extern const char* ProgramName; + +} + namespace { int ExecuteProgram(const std::string& name, const StrVector& args) { sys::Path prog = sys::Program::FindProgramByName(name); - if (prog.isEmpty()) - throw std::runtime_error("Can't find program '" + name + "'"); + if (prog.isEmpty()) { + prog = FindExecutable(name, ProgramName, (void *)(intptr_t)&Main); + if (prog.isEmpty()) + throw std::runtime_error("Can't find program '" + name + "'"); + } if (!prog.canExecute()) throw std::runtime_error("Program '" + name + "' is not executable."); |