[llvm-commits] [llvm] r82601 - /llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp

Chris Lattner sabre at nondot.org
Tue Sep 22 19:03:49 PDT 2009


Author: lattner
Date: Tue Sep 22 21:03:49 2009
New Revision: 82601

URL: http://llvm.org/viewvc/llvm-project?rev=82601&view=rev
Log:
errorstr can be null, don't unconditionally set it.  Only report that
"the jit has not been linked in" if the interpreter failed.

This fixes a unit test failure.

Modified:
    llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp

Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp?rev=82601&r1=82600&r2=82601&view=diff

==============================================================================
--- llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp Tue Sep 22 21:03:49 2009
@@ -429,7 +429,8 @@
     if (WhichEngine & EngineKind::JIT)
       WhichEngine = EngineKind::JIT;
     else {
-      *ErrorStr = "Cannot create an interpreter with a memory manager.";
+      if (ErrorStr)
+        *ErrorStr = "Cannot create an interpreter with a memory manager.";
       return 0;
     }
   }
@@ -442,9 +443,6 @@
         ExecutionEngine::JITCtor(MP, ErrorStr, JMM, OptLevel,
                                  AllocateGVsWithCode);
       if (EE) return EE;
-    } else {
-      *ErrorStr = "JIT has not been linked in.";
-      return 0;
     }
   }
 
@@ -453,10 +451,15 @@
   if (WhichEngine & EngineKind::Interpreter) {
     if (ExecutionEngine::InterpCtor)
       return ExecutionEngine::InterpCtor(MP, ErrorStr);
-    *ErrorStr = "Interpreter has not been linked in.";
+    if (ErrorStr)
+      *ErrorStr = "Interpreter has not been linked in.";
     return 0;
   }
-  
+
+  if ((WhichEngine & EngineKind::JIT) && ExecutionEngine::JITCtor == 0) {
+    if (ErrorStr)
+      *ErrorStr = "JIT has not been linked in.";
+  }    
   return 0;
 }
 





More information about the llvm-commits mailing list