[llvm-commits] [PATCH] ExecutionEngine: fix ErrorStr handling

nobled nobled at dreamwidth.org
Tue May 10 11:35:11 PDT 2011


> Oops, I meant to paste this in the last message:
>
> When I tried this patch, it causes the test to fail all by itself,
> even though the "Engine.get() != NULL" assert doesn't trigger. It
> gives this output:
>
> Error building ExecutionEngine: Unable to find target for this triple
> (no targets are registered)
>
> Does that indicate a bug in the test?
>

I found the actual bug; the ExecutionEngine code was still setting
ErrorStr in the case whenever using the JIT failed, even if the
fallback to the interpreter was successful. The attached patch fixes
that case, and now the first patch works fine.

Okay to commit?

>> If EngineBuilder::create() returns NULL, this prints the reason why
>> before exiting.
>>
>> ---
>> diff --git a/unittests/ExecutionEngine/ExecutionEngineTest.cpp
>> b/unittests/ExecutionEngine/ExecutionEngineTest.cpp
>> index 904ee2b..e5daf19 100644
>> --- a/unittests/ExecutionEngine/ExecutionEngineTest.cpp
>> +++ b/unittests/ExecutionEngine/ExecutionEngineTest.cpp
>> @@ -22,11 +22,14 @@ namespace {
>>  class ExecutionEngineTest : public testing::Test {
>>  protected:
>>   ExecutionEngineTest()
>> -    : M(new Module("<main>", getGlobalContext())),
>> -      Engine(EngineBuilder(M).create()) {
>> +    : M(new Module("<main>", getGlobalContext())), Error(""),
>> +    Engine(EngineBuilder(M).setErrorStr(&Error).create()) {
>>   }
>>
>>   virtual void SetUp() {
>> +    EXPECT_EQ(Error.empty(), true)
>> +      << "Error building ExecutionEngine: " << Error;
>> +
>>     ASSERT_TRUE(Engine.get() != NULL);
>>   }
>>
>> @@ -36,6 +39,7 @@ protected:
>>   }
>>
>>   Module *const M;
>> +  std::string Error;
>>   const OwningPtr<ExecutionEngine> Engine;
>>  };
>>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-ExecutionEngine-fix-ErrorStr-handling.patch
Type: text/x-patch
Size: 1888 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110510/38487d0f/attachment.bin>


More information about the llvm-commits mailing list