diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-06-15 17:44:38 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-06-15 17:44:38 +0000 |
commit | c722ea4fbf886d6460b256b5e819a4ee751d5fff (patch) | |
tree | cea324555f88ac0ae9013f3df472421992063846 /lib/AST/Decl.cpp | |
parent | 7cf84d66965a7706004d8590b5af5fe54b85f525 (diff) |
Allocate template parameter lists for out-of-line definitions via the
ASTContext rather than via the normal heap.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106008 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Decl.cpp')
-rw-r--r-- | lib/AST/Decl.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index 4593c6f0e5..25687e15c4 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -567,7 +567,8 @@ void DeclaratorDecl::setQualifierInfo(NestedNameSpecifier *Qualifier, } void -QualifierInfo::setTemplateParameterListsInfo(unsigned NumTPLists, +QualifierInfo::setTemplateParameterListsInfo(ASTContext &Context, + unsigned NumTPLists, TemplateParameterList **TPLists) { assert((NumTPLists == 0 || TPLists != 0) && "Empty array of template parameters with positive size!"); @@ -576,19 +577,25 @@ QualifierInfo::setTemplateParameterListsInfo(unsigned NumTPLists, // Free previous template parameters (if any). if (NumTemplParamLists > 0) { - delete[] TemplParamLists; + Context.Deallocate(TemplParamLists); TemplParamLists = 0; NumTemplParamLists = 0; } // Set info on matched template parameter lists (if any). if (NumTPLists > 0) { - TemplParamLists = new TemplateParameterList*[NumTPLists]; + TemplParamLists = new (Context) TemplateParameterList*[NumTPLists]; NumTemplParamLists = NumTPLists; for (unsigned i = NumTPLists; i-- > 0; ) TemplParamLists[i] = TPLists[i]; } } +void QualifierInfo::Destroy(ASTContext &Context) { + // FIXME: Deallocate template parameter lists themselves! + if (TemplParamLists) + Context.Deallocate(TemplParamLists); +} + //===----------------------------------------------------------------------===// // VarDecl Implementation //===----------------------------------------------------------------------===// |