Fix problem where lli < foo.bc would have argc = 0
llvm-svn: 1393
diff --git a/llvm/tools/lli/lli.cpp b/llvm/tools/lli/lli.cpp
index ba5a3a5..ef9dddf 100644
--- a/llvm/tools/lli/lli.cpp
+++ b/llvm/tools/lli/lli.cpp
@@ -52,6 +52,13 @@
if (ProfileMode) I.enableProfiling();
if (TraceMode) I.enableTracing();
+ // Ensure that there is at least one argument... the name of the program.
+ // This is only unavailable if the program was read from stdin, instead of a
+ // file.
+ //
+ if (InputArgv.empty())
+ InputArgv.push_back("from-stdin-prog");
+
// Start interpreter into the main function...
//
if (!I.callMainMethod(MainFunction, InputArgv) && !DebugMode) {