[LLVMdev] [PATCH] Set error message if JIT/Interpreter not linked in.

Chris Lattner clattner at apple.com
Tue Sep 22 18:46:29 PDT 2009


On Sep 22, 2009, at 5:04 PM, KS Sreeram wrote:

> Hi,
>
> In ExecutionEngine.cpp, when the JIT or the Interpreter have not  
> been linked in then EngineBuilder::create fails without setting  
> ErrorStr.
>
> I've attached a patch to fix this.

Thanks, applied in r82600.  Please attach patches instead of including  
them inline.

-Chris

>
> Warm Regards
> KS Sreeram
> Index: lib/ExecutionEngine/ExecutionEngine.cpp
> ===================================================================
> --- lib/ExecutionEngine/ExecutionEngine.cpp	(revision 82523)
> +++ lib/ExecutionEngine/ExecutionEngine.cpp	(working copy)
> @@ -436,16 +436,23 @@
>
>   // Unless the interpreter was explicitly selected or the JIT is  
> not linked,
>   // try making a JIT.
> -  if (WhichEngine & EngineKind::JIT && ExecutionEngine::JITCtor) {
> -    EE = ExecutionEngine::JITCtor(MP, ErrorStr, JMM, OptLevel,
> -                                  AllocateGVsWithCode);
> +  if (WhichEngine & EngineKind::JIT) {
> +      if (ExecutionEngine::JITCtor) {
> +          EE = ExecutionEngine::JITCtor(MP, ErrorStr, JMM, OptLevel,
> +                                        AllocateGVsWithCode);
> +      } else {
> +          *ErrorStr = "JIT has not been linked in.";
> +      }
>   }
>
>   // If we can't make a JIT and we didn't request one specifically,  
> try making
>   // an interpreter instead.
> -  if (WhichEngine & EngineKind::Interpreter && EE == 0 &&
> -      ExecutionEngine::InterpCtor) {
> -    EE = ExecutionEngine::InterpCtor(MP, ErrorStr);
> +  if (WhichEngine & EngineKind::Interpreter && EE == 0) {
> +      if (ExecutionEngine::InterpCtor) {
> +          EE = ExecutionEngine::InterpCtor(MP, ErrorStr);
> +      } else {
> +          *ErrorStr = "Interpreter has not been linked in.";
> +      }
>   }
>
>   return EE;
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list