Fix memory leak in unittest added in r241101.
authorAlexey Samsonov <vonosmas@gmail.com>
Tue, 30 Jun 2015 22:17:29 +0000 (22:17 +0000)
committerAlexey Samsonov <vonosmas@gmail.com>
Tue, 30 Jun 2015 22:17:29 +0000 (22:17 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241123 91177308-0d34-0410-b5e6-96231b3b80d8

unittests/IR/IRBuilderTest.cpp

index bce7b94d709b758febd8f5a7157391d5aa64c085..f3db68feacce5cea7c6093f9def9b7711b058838 100644 (file)
@@ -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();
 }
 }