[llvm] r224773 - Fix a leak found by asan.
Rafael EspĂndola
rafael.espindola at gmail.com
Fri Dec 26 12:52:15 PST 2014
>> ==============================================================================
>> --- llvm/trunk/unittests/IR/WaymarkTest.cpp (original)
>> +++ llvm/trunk/unittests/IR/WaymarkTest.cpp Tue Dec 23 11:20:23 2014
>> @@ -29,8 +29,9 @@ TEST(WaymarkTest, NativeArray) {
>> Value * values[22];
>> std::transform(tail, tail + 22, values, char2constant);
>> FunctionType *FT =
>> FunctionType::get(Type::getVoidTy(getGlobalContext()), true);
>> - Function *F = Function::Create(FT, GlobalValue::ExternalLinkage);
>> - const CallInst *A = CallInst::Create(F, makeArrayRef(values));
>> + std::unique_ptr<Function> F(
>> + Function::Create(FT, GlobalValue::ExternalLinkage));
>
>
> I'm guessing there's no chance that Function::Create (& I guess, by
> extension, all the other <Instruction>::Create functions) should be changed
> to return std::unique_ptr?
It would probably not be worth it. There is a strong convention for
ownership of IR objects. This testcase is a small exception.
Cheers,
Rafael
More information about the llvm-commits
mailing list