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.

llvm-svn: 82601
This commit is contained in:
Chris Lattner 2009-09-23 02:03:49 +00:00
parent 41fa2bd112
commit 8bcc6445c7
1 changed files with 9 additions and 6 deletions

View File

@ -429,7 +429,8 @@ ExecutionEngine *EngineBuilder::create() {
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 *EngineBuilder::create() {
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 @@ ExecutionEngine *EngineBuilder::create() {
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;
}