aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CompilerDriver/Action.cpp
diff options
context:
space:
mode:
authorShih-wei Liao <sliao@google.com>2010-04-07 12:21:42 -0700
committerShih-wei Liao <sliao@google.com>2010-04-07 12:21:42 -0700
commite4454320b3cfffe926a487c33fbeb454366de2f8 (patch)
tree133c05da684edf4a3b2529bcacfa996298c455f6 /lib/CompilerDriver/Action.cpp
parent20570085304f0a4ab4f112a01d77958bbd2827a1 (diff)
downloadexternal_llvm-e4454320b3cfffe926a487c33fbeb454366de2f8.zip
external_llvm-e4454320b3cfffe926a487c33fbeb454366de2f8.tar.gz
external_llvm-e4454320b3cfffe926a487c33fbeb454366de2f8.tar.bz2
libbcc
Change-Id: Ieaa3ebd5a38f370752495549f8870b534eeedfc5
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 7bcd30a..9d07811 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.");