[cfe-commits] r62203 - in /cfe/trunk: include/clang/AST/Decl.h lib/AST/Decl.cpp lib/Sema/SemaDecl.cpp lib/Sema/SemaDeclCXX.cpp lib/Sema/SemaExprCXX.cpp
Ted Kremenek
kremenek at apple.com
Tue Jan 13 16:42:25 PST 2009
Author: kremenek
Date: Tue Jan 13 18:42:25 2009
New Revision: 62203
URL: http://llvm.org/viewvc/llvm-project?rev=62203&view=rev
Log:
FunctionDecl::setParams() now uses the allocator associated with ASTContext to allocate the array of ParmVarDecl*'s.
Modified:
cfe/trunk/include/clang/AST/Decl.h
cfe/trunk/lib/AST/Decl.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/lib/Sema/SemaExprCXX.cpp
Modified: cfe/trunk/include/clang/AST/Decl.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=62203&r1=62202&r2=62203&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Tue Jan 13 18:42:25 2009
@@ -736,7 +736,7 @@
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
Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=62203&r1=62202&r2=62203&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Tue Jan 13 18:42:25 2009
@@ -271,14 +271,16 @@
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);
}
}
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=62203&r1=62202&r2=62203&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Tue Jan 13 18:42:25 2009
@@ -467,7 +467,7 @@
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 @@
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 @@
0, 0));
}
- NewFD->setParams(&Params[0], Params.size());
+ NewFD->setParams(Context, &Params[0], Params.size());
}
}
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=62203&r1=62202&r2=62203&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Tue Jan 13 18:42:25 2009
@@ -875,7 +875,7 @@
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 @@
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.
Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=62203&r1=62202&r2=62203&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Tue Jan 13 18:42:25 2009
@@ -535,7 +535,7 @@
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
More information about the cfe-commits
mailing list