[llvm] r289207 - Fix memory leak in unit test.
Benjamin Kramer via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 9 05:12:31 PST 2016
Author: d0k
Date: Fri Dec 9 07:12:30 2016
New Revision: 289207
URL: http://llvm.org/viewvc/llvm-project?rev=289207&view=rev
Log:
Fix memory leak in unit test.
The StringPool entries are destroyed with the allocator, the string pool
itself is not.
Modified:
llvm/trunk/unittests/DebugInfo/DWARF/DwarfGenerator.cpp
llvm/trunk/unittests/DebugInfo/DWARF/DwarfGenerator.h
Modified: llvm/trunk/unittests/DebugInfo/DWARF/DwarfGenerator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/DebugInfo/DWARF/DwarfGenerator.cpp?rev=289207&r1=289206&r2=289207&view=diff
==============================================================================
--- llvm/trunk/unittests/DebugInfo/DWARF/DwarfGenerator.cpp (original)
+++ llvm/trunk/unittests/DebugInfo/DWARF/DwarfGenerator.cpp Fri Dec 9 07:12:30 2016
@@ -203,7 +203,7 @@ llvm::Error dwarfgen::Generator::init(Tr
MC->setDwarfVersion(Version);
Asm->setDwarfVersion(Version);
- StringPool = new DwarfStringPool(Allocator, *Asm, StringRef());
+ StringPool = llvm::make_unique<DwarfStringPool>(Allocator, *Asm, StringRef());
return Error::success();
}
Modified: llvm/trunk/unittests/DebugInfo/DWARF/DwarfGenerator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/DebugInfo/DWARF/DwarfGenerator.h?rev=289207&r1=289206&r2=289207&view=diff
==============================================================================
--- llvm/trunk/unittests/DebugInfo/DWARF/DwarfGenerator.h (original)
+++ llvm/trunk/unittests/DebugInfo/DWARF/DwarfGenerator.h Fri Dec 9 07:12:30 2016
@@ -170,9 +170,9 @@ class Generator {
MCStreamer *MS; // Owned by AsmPrinter
std::unique_ptr<TargetMachine> TM;
std::unique_ptr<AsmPrinter> Asm;
- DwarfStringPool *StringPool; // Owned by Allocator
- std::vector<std::unique_ptr<CompileUnit>> CompileUnits;
BumpPtrAllocator Allocator;
+ std::unique_ptr<DwarfStringPool> StringPool; // Entries owned by Allocator.
+ std::vector<std::unique_ptr<CompileUnit>> CompileUnits;
DIEAbbrevSet Abbreviations;
SmallString<4096> FileBytes;
More information about the llvm-commits
mailing list