[llvm-commits] [llvm] r117584 - /llvm/trunk/lib/CompilerDriver/Action.cpp
Mikhail Glushenkov
foldr at codedgers.com
Thu Oct 28 12:33:08 PDT 2010
Author: foldr
Date: Thu Oct 28 14:33:08 2010
New Revision: 117584
URL: http://llvm.org/viewvc/llvm-project?rev=117584&view=rev
Log:
llvmc: Make ExecuteProgram() look in the driver directory first.
Modified:
llvm/trunk/lib/CompilerDriver/Action.cpp
Modified: llvm/trunk/lib/CompilerDriver/Action.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CompilerDriver/Action.cpp?rev=117584&r1=117583&r2=117584&view=diff
==============================================================================
--- llvm/trunk/lib/CompilerDriver/Action.cpp (original)
+++ llvm/trunk/lib/CompilerDriver/Action.cpp Thu Oct 28 14:33:08 2010
@@ -14,6 +14,7 @@
#include "llvm/CompilerDriver/Action.h"
#include "llvm/CompilerDriver/BuiltinOptions.h"
#include "llvm/CompilerDriver/Error.h"
+#include "llvm/CompilerDriver/Main.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/SystemUtils.h"
@@ -28,7 +29,6 @@
namespace llvmc {
-extern int Main(int argc, char** argv);
extern const char* ProgramName;
}
@@ -55,10 +55,13 @@
int ExecuteProgram (const std::string& name,
const StrVector& args) {
- sys::Path prog = sys::Program::FindProgramByName(name);
+ sys::Path prog(name);
- if (prog.isEmpty()) {
+ if (!prog.isAbsolute())
prog = FindExecutable(name, ProgramName, (void *)(intptr_t)&Main);
+
+ if (prog.isEmpty()) {
+ prog = sys::Program::FindProgramByName(name);
if (prog.isEmpty()) {
PrintError("Can't find program '" + name + "'");
return -1;
More information about the llvm-commits
mailing list