aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/Decl.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-01-14 00:42:25 +0000
committerTed Kremenek <kremenek@apple.com>2009-01-14 00:42:25 +0000
commitfc767615bc67d3a7587b1fb2e0494c32c9dbd7a5 (patch)
tree97ef978358195ce02c6d93b6f2fe1e346deb5b2c /lib/AST/Decl.cpp
parentedd1e2a362868a2fd28468265d3b5b801710b106 (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.cpp6
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);
}
}