diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-01-14 00:42:25 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-01-14 00:42:25 +0000 |
commit | fc767615bc67d3a7587b1fb2e0494c32c9dbd7a5 (patch) | |
tree | 97ef978358195ce02c6d93b6f2fe1e346deb5b2c /lib/AST/Decl.cpp | |
parent | edd1e2a362868a2fd28468265d3b5b801710b106 (diff) |
FunctionDecl::setParams() now uses the allocator associated with ASTContext to allocate the array of ParmVarDecl*'s.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62203 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Decl.cpp')
-rw-r--r-- | lib/AST/Decl.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index f29417ed13..0bc0043ccb 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -271,14 +271,16 @@ unsigned FunctionDecl::getNumParams() const { return getNumTypeParams(getType()); } -void FunctionDecl::setParams(ParmVarDecl **NewParamInfo, unsigned NumParams) { +void FunctionDecl::setParams(ASTContext& C, ParmVarDecl **NewParamInfo, + unsigned NumParams) { assert(ParamInfo == 0 && "Already has param info!"); assert(NumParams == getNumTypeParams(getType()) && "Parameter count mismatch!"); // Zero params -> null pointer. if (NumParams) { - ParamInfo = new ParmVarDecl*[NumParams]; + void *Mem = C.getAllocator().Allocate<ParmVarDecl*>(NumParams); + ParamInfo = new (Mem) ParmVarDecl*[NumParams]; memcpy(ParamInfo, NewParamInfo, sizeof(ParmVarDecl*)*NumParams); } } |