From 6aead3a051a4d7c43e74b96ec25dbbf983f62d4e Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Mon, 10 May 2010 20:40:08 +0000 Subject: Start converting pieces of DeclarationNameTable to be allocated using ASTContext's allocator. While DeclarationNameTable doesn't leak, it uses 'malloc' too often. Start with having 'CXXLiteralOperatorNames' allocated using ASTContext's allocator and add a 'DoDestroy()' method to DeclarationNameTable that is called by ~ASTContext. llvm-svn: 103426 --- clang/lib/AST/ASTContext.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'clang/lib/AST/ASTContext.cpp') diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 141f1b9bf93..3a8084833e4 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -46,7 +46,9 @@ ASTContext::ASTContext(const LangOptions& LOpts, SourceManager &SM, sigjmp_bufDecl(0), BlockDescriptorType(0), BlockDescriptorExtendedType(0), SourceMgr(SM), LangOpts(LOpts), FreeMemory(FreeMem), Target(t), Idents(idents), Selectors(sels), - BuiltinInfo(builtins), ExternalSource(0), PrintingPolicy(LOpts), + BuiltinInfo(builtins), + DeclarationNames(*this), + ExternalSource(0), PrintingPolicy(LOpts), LastSDM(0, 0) { ObjCIdRedefinitionType = QualType(); ObjCClassRedefinitionType = QualType(); @@ -108,6 +110,9 @@ ASTContext::~ASTContext() { if (GlobalNestedNameSpecifier) GlobalNestedNameSpecifier->Destroy(*this); + // Deallocate the memory associated with the DeclarationNameTable. + DeclarationNames.DoDestroy(*this); + TUDecl->Destroy(*this); } -- cgit v1.2.3