[llvm] 84a8cf2 - [AsmWriter] Fix leak after D141343

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 11 00:11:55 PST 2023


Author: Vitaly Buka
Date: 2023-01-11T00:04:37-08:00
New Revision: 84a8cf2865a5ade80c76e3c0da6b8b86fdfd2465

URL: https://github.com/llvm/llvm-project/commit/84a8cf2865a5ade80c76e3c0da6b8b86fdfd2465
DIFF: https://github.com/llvm/llvm-project/commit/84a8cf2865a5ade80c76e3c0da6b8b86fdfd2465.diff

LOG: [AsmWriter] Fix leak after D141343

Added: 
    

Modified: 
    llvm/unittests/IR/AsmWriterTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/unittests/IR/AsmWriterTest.cpp b/llvm/unittests/IR/AsmWriterTest.cpp
index a3967f72f00f9..04f977e0e4029 100644
--- a/llvm/unittests/IR/AsmWriterTest.cpp
+++ b/llvm/unittests/IR/AsmWriterTest.cpp
@@ -64,11 +64,11 @@ TEST(AsmWriterTest, DumpDIExpression) {
 
 TEST(AsmWriterTest, PrintAddrspaceWithNullOperand) {
   LLVMContext Ctx;
-  std::unique_ptr<Module> M;
+  Module M("test module", Ctx);
   SmallVector<Type *, 3> FArgTypes;
   FArgTypes.push_back(Type::getInt64Ty(Ctx));
   FunctionType *FTy = FunctionType::get(Type::getVoidTy(Ctx), FArgTypes, false);
-  Function *F = Function::Create(FTy, Function::ExternalLinkage, "", M.get());
+  Function *F = Function::Create(FTy, Function::ExternalLinkage, "", &M);
   Argument *Arg0 = F->getArg(0);
   Value *Args[] = {Arg0};
   std::unique_ptr<CallInst> Call(CallInst::Create(F, Args));


        


More information about the llvm-commits mailing list