aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/Decl.cpp
diff options
context:
space:
mode:
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);
}
}