[llvm] r241123 - Fix memory leak in unittest added in r241101.

Alexey Samsonov vonosmas at gmail.com
Tue Jun 30 15:17:29 PDT 2015


Author: samsonov
Date: Tue Jun 30 17:17:29 2015
New Revision: 241123

URL: http://llvm.org/viewvc/llvm-project?rev=241123&view=rev
Log:
Fix memory leak in unittest added in r241101.

Modified:
    llvm/trunk/unittests/IR/IRBuilderTest.cpp

Modified: llvm/trunk/unittests/IR/IRBuilderTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/IRBuilderTest.cpp?rev=241123&r1=241122&r2=241123&view=diff
==============================================================================
--- llvm/trunk/unittests/IR/IRBuilderTest.cpp (original)
+++ llvm/trunk/unittests/IR/IRBuilderTest.cpp Tue Jun 30 17:17:29 2015
@@ -342,9 +342,11 @@ TEST_F(IRBuilderTest, DebugLoc) {
 
   DIBuilder DIB(*M);
   auto File = DIB.createFile("tmp.cpp", "/");
+  auto CU = DIB.createCompileUnit(dwarf::DW_LANG_C_plus_plus_11, "tmp.cpp", "/",
+                                  "", true, "", 0);
   auto SPType = DIB.createSubroutineType(File, DIB.getOrCreateTypeArray(None));
   auto SP =
-      DIB.createFunction(File, "foo", "foo", File, 1, SPType, false, true, 1);
+      DIB.createFunction(CU, "foo", "foo", File, 1, SPType, false, true, 1);
   DebugLoc DL1 = DILocation::get(Ctx, 2, 0, SP);
   DebugLoc DL2 = DILocation::get(Ctx, 3, 0, SP);
 
@@ -363,5 +365,7 @@ TEST_F(IRBuilderTest, DebugLoc) {
   EXPECT_EQ(DL2, Builder.getCurrentDebugLocation());
   auto Call2 = Builder.CreateCall(Callee, None);
   EXPECT_EQ(DL2, Call2->getDebugLoc());
+
+  DIB.finalize();
 }
 }





More information about the llvm-commits mailing list