Skip to content

Commit

Permalink
Fix memory leak in unit test.
Browse files Browse the repository at this point in the history
The StringPool entries are destroyed with the allocator, the string pool
itself is not.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289207 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
d0k committed Dec 9, 2016
1 parent f6da5c0 commit eae8838
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion unittests/DebugInfo/DWARF/DwarfGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ llvm::Error dwarfgen::Generator::init(Triple TheTriple, uint16_t V) {
MC->setDwarfVersion(Version);
Asm->setDwarfVersion(Version);

StringPool = new DwarfStringPool(Allocator, *Asm, StringRef());
StringPool = llvm::make_unique<DwarfStringPool>(Allocator, *Asm, StringRef());

return Error::success();
}
Expand Down
4 changes: 2 additions & 2 deletions unittests/DebugInfo/DWARF/DwarfGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit eae8838

Please sign in to comment.