summaryrefslogtreecommitdiff
path: root/lib/CompilerDriver/Action.cpp
diff options
context:
space:
mode:
authorMikhail Glushenkov <foldr@codedgers.com>2010-03-05 04:46:28 +0000
committerMikhail Glushenkov <foldr@codedgers.com>2010-03-05 04:46:28 +0000
commit0d61349dc3409056e590b966e7ca9b2cd9d2f76c (patch)
tree2109502419c6f7c1e3481cfc88d1922e8413ad18 /lib/CompilerDriver/Action.cpp
parent26e19ba9aa534e12fc8940036f82dd512b63f69d (diff)
downloadllvm-0d61349dc3409056e590b966e7ca9b2cd9d2f76c.tar.gz
llvm-0d61349dc3409056e590b966e7ca9b2cd9d2f76c.tar.bz2
llvm-0d61349dc3409056e590b966e7ca9b2cd9d2f76c.tar.xz
Use FindExecutable as a fall-back search method.
Allows us to find executables that are in the same directory. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97786 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CompilerDriver/Action.cpp')
-rw-r--r--lib/CompilerDriver/Action.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/CompilerDriver/Action.cpp b/lib/CompilerDriver/Action.cpp
index 7bcd30a8e0..9d07811c89 100644
--- a/lib/CompilerDriver/Action.cpp
+++ b/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.");