forked from OSchip/llvm-project
5eec2b0bd3
using new/delete and OwningPtrs. After memory profiling Clang, I witnessed periodic leaks of these objects; digging deeper into the code, it was clear that our management of these objects was a mess. The ownership rules were murky at best, and not always followed. Worse, there are plenty of error paths where we could screw up. This patch introduces AttributeList::Factory, which is a factory class that creates AttributeList objects and then blows them away all at once. While conceptually simple, most of the changes in this patch just have to do with migrating over to the new interface. Most of the changes have resulted in some nice simplifications. This new strategy currently holds on to all AttributeList objects during the lifetime of the Parser object. This is easily tunable. If we desire to have more bound the lifetime of AttributeList objects more precisely, we can have the AttributeList::Factory object (in Parser) push/pop its underlying allocator as we enter/leave key methods in the Parser. This means that we get simple memory management while still having the ability to finely control memory use if necessary. Note that because AttributeList objects are now BumpPtrAllocated, we may reduce malloc() traffic in many large files with attributes. This fixes the leak reported in: <rdar://problem/8650003> llvm-svn: 118675 |
||
---|---|---|
.. | ||
CMakeLists.txt | ||
Makefile | ||
ParseAST.cpp | ||
ParseCXXInlineMethods.cpp | ||
ParseDecl.cpp | ||
ParseDeclCXX.cpp | ||
ParseExpr.cpp | ||
ParseExprCXX.cpp | ||
ParseInit.cpp | ||
ParseObjc.cpp | ||
ParsePragma.cpp | ||
ParsePragma.h | ||
ParseStmt.cpp | ||
ParseTemplate.cpp | ||
ParseTentative.cpp | ||
Parser.cpp | ||
RAIIObjectsForParser.h |