aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clang/AST/Decl.h2
-rw-r--r--lib/AST/Decl.cpp6
-rw-r--r--lib/Sema/SemaDecl.cpp6
-rw-r--r--lib/Sema/SemaDeclCXX.cpp4
-rw-r--r--lib/Sema/SemaExprCXX.cpp2
5 files changed, 11 insertions, 9 deletions
diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h
index 673669209c..9ca1d3e9c9 100644
--- a/include/clang/AST/Decl.h
+++ b/include/clang/AST/Decl.h
@@ -736,7 +736,7 @@ public:
assert(i < getNumParams() && "Illegal param #");
return ParamInfo[i];
}
- void setParams(ParmVarDecl **NewParamInfo, unsigned NumParams);
+ void setParams(ASTContext& C, ParmVarDecl **NewParamInfo, unsigned NumParams);
/// getMinRequiredArguments - Returns the minimum number of arguments
/// needed to call this function. This may be fewer than the number of
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);
}
}
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 8d2e5590b9..c124c469ad 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -467,7 +467,7 @@ ScopedDecl *Sema::LazilyCreateBuiltin(IdentifierInfo *II, unsigned bid,
Params.push_back(ParmVarDecl::Create(Context, New, SourceLocation(), 0,
FT->getArgType(i), VarDecl::None, 0,
0));
- New->setParams(&Params[0], Params.size());
+ New->setParams(Context, &Params[0], Params.size());
}
@@ -1591,7 +1591,7 @@ Sema::ActOnDeclarator(Scope *S, Declarator &D, DeclTy *lastDecl,
Params.push_back((ParmVarDecl *)FTI.ArgInfo[i].Param);
}
- NewFD->setParams(&Params[0], Params.size());
+ NewFD->setParams(Context, &Params[0], Params.size());
} else if (R->getAsTypedefType()) {
// When we're declaring a function with a typedef, as in the
// following example, we'll need to synthesize (unnamed)
@@ -1620,7 +1620,7 @@ Sema::ActOnDeclarator(Scope *S, Declarator &D, DeclTy *lastDecl,
0, 0));
}
- NewFD->setParams(&Params[0], Params.size());
+ NewFD->setParams(Context, &Params[0], Params.size());
}
}
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index d7cef91f33..65c1416124 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -875,7 +875,7 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) {
ClassDecl->getLocation(),
/*IdentifierInfo=*/0,
ArgType, VarDecl::None, 0, 0);
- CopyConstructor->setParams(&FromParam, 1);
+ CopyConstructor->setParams(Context, &FromParam, 1);
ClassDecl->addedConstructor(Context, CopyConstructor);
ClassDecl->addDecl(CopyConstructor);
@@ -952,7 +952,7 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) {
ClassDecl->getLocation(),
/*IdentifierInfo=*/0,
ArgType, VarDecl::None, 0, 0);
- CopyAssignment->setParams(&FromParam, 1);
+ CopyAssignment->setParams(Context, &FromParam, 1);
// Don't call addedAssignmentOperator. There is no way to distinguish an
// implicit from an explicit assignment operator.
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index 99e00a7a82..efc664cf53 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -535,7 +535,7 @@ void Sema::DeclareGlobalAllocationFunction(DeclarationName Name,
Alloc->setImplicit();
ParmVarDecl *Param = ParmVarDecl::Create(Context, Alloc, SourceLocation(),
0, Argument, VarDecl::None, 0, 0);
- Alloc->setParams(&Param, 1);
+ Alloc->setParams(Context, &Param, 1);
// FIXME: Also add this declaration to the IdentifierResolver, but
// make sure it is at the end of the chain to coincide with the