[llvm] r224773 - Fix a leak found by asan.

David Blaikie dblaikie at gmail.com
Fri Dec 26 10:08:52 PST 2014


On Tue, Dec 23, 2014 at 9:20 AM, Rafael Espindola <
rafael.espindola at gmail.com> wrote:

> Author: rafael
> Date: Tue Dec 23 11:20:23 2014
> New Revision: 224773
>
> URL: http://llvm.org/viewvc/llvm-project?rev=224773&view=rev
> Log:
> Fix a leak found by asan.
>
> Modified:
>     llvm/trunk/unittests/IR/WaymarkTest.cpp
>
> Modified: llvm/trunk/unittests/IR/WaymarkTest.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/WaymarkTest.cpp?rev=224773&r1=224772&r2=224773&view=diff
>
> ==============================================================================
> --- 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?


> +  const CallInst *A = CallInst::Create(F.get(), makeArrayRef(values));
>    ASSERT_NE(A, (const CallInst*)nullptr);
>    ASSERT_EQ(1U + 22, A->getNumOperands());
>    const Use *U = &A->getOperandUse(0);
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141226/1c46c728/attachment.html>


More information about the llvm-commits mailing list