summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Decl.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-06-15 17:44:38 +0000
committerDouglas Gregor <dgregor@apple.com>2010-06-15 17:44:38 +0000
commit20527e2c8333da70c1a39c55bb383cda88489255 (patch)
tree6f3f95f0fa88186fcf2365e352290908dab6cbaf /clang/lib/AST/Decl.cpp
parentde94e66234ae01281078c675096e37479cffa91f (diff)
downloadbcm5719-llvm-20527e2c8333da70c1a39c55bb383cda88489255.tar.gz
bcm5719-llvm-20527e2c8333da70c1a39c55bb383cda88489255.zip
Allocate template parameter lists for out-of-line definitions via the
ASTContext rather than via the normal heap. llvm-svn: 106008
Diffstat (limited to 'clang/lib/AST/Decl.cpp')
-rw-r--r--clang/lib/AST/Decl.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index 4593c6f0e5c..25687e15c4c 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/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
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud