[llvm-commits] [llvm] r98411 - /llvm/trunk/unittests/VMCore/VerifierTest.cpp
Jeffrey Yasskin
jyasskin at google.com
Fri Mar 12 17:34:56 PST 2010
Author: jyasskin
Date: Fri Mar 12 19:34:56 2010
New Revision: 98411
URL: http://llvm.org/viewvc/llvm-project?rev=98411&view=rev
Log:
Remove a memory leak from VerifierTest.
Tested: valgrind --leak-check=full unittests/VMCore/Debug/VMCoreTests
Modified:
llvm/trunk/unittests/VMCore/VerifierTest.cpp
Modified: llvm/trunk/unittests/VMCore/VerifierTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/VMCore/VerifierTest.cpp?rev=98411&r1=98410&r2=98411&view=diff
==============================================================================
--- llvm/trunk/unittests/VMCore/VerifierTest.cpp (original)
+++ llvm/trunk/unittests/VMCore/VerifierTest.cpp Fri Mar 12 19:34:56 2010
@@ -12,6 +12,7 @@
#include "llvm/Function.h"
#include "llvm/Instructions.h"
#include "llvm/LLVMContext.h"
+#include "llvm/ADT/OwningPtr.h"
#include "llvm/Analysis/Verifier.h"
#include "gtest/gtest.h"
@@ -21,9 +22,9 @@
TEST(VerifierTest, Branch_i1) {
LLVMContext &C = getGlobalContext();
FunctionType *FTy = FunctionType::get(Type::getVoidTy(C), /*isVarArg=*/false);
- Function *F = Function::Create(FTy, GlobalValue::ExternalLinkage);
- BasicBlock *Entry = BasicBlock::Create(C, "entry", F);
- BasicBlock *Exit = BasicBlock::Create(C, "exit", F);
+ OwningPtr<Function> F(Function::Create(FTy, GlobalValue::ExternalLinkage));
+ BasicBlock *Entry = BasicBlock::Create(C, "entry", F.get());
+ BasicBlock *Exit = BasicBlock::Create(C, "exit", F.get());
ReturnInst::Create(C, Exit);
// To avoid triggering an assertion in BranchInst::Create, we first create
More information about the llvm-commits
mailing list