Eliminate a bunch of unnecessary ASTContexts from members functions of

Decl subclasses. No functionality change.

llvm-svn: 95841
This commit is contained in:
Douglas Gregor 2010-02-11 01:19:42 +00:00
parent 7c2005aa6d
commit d505812422
13 changed files with 54 additions and 65 deletions

View File

@ -634,7 +634,7 @@ public:
return StmtPtr; return StmtPtr;
} }
void setInit(ASTContext &C, Expr *I); void setInit(Expr *I);
EvaluatedStmt *EnsureEvaluatedStmt() const { EvaluatedStmt *EnsureEvaluatedStmt() const {
EvaluatedStmt *Eval = Init.dyn_cast<EvaluatedStmt *>(); EvaluatedStmt *Eval = Init.dyn_cast<EvaluatedStmt *>();
@ -1137,7 +1137,7 @@ public:
assert(i < getNumParams() && "Illegal param #"); assert(i < getNumParams() && "Illegal param #");
return ParamInfo[i]; return ParamInfo[i];
} }
void setParams(ASTContext& C, ParmVarDecl **NewParamInfo, unsigned NumParams); void setParams(ParmVarDecl **NewParamInfo, unsigned NumParams);
/// getMinRequiredArguments - Returns the minimum number of arguments /// getMinRequiredArguments - Returns the minimum number of arguments
/// needed to call this function. This may be fewer than the number of /// needed to call this function. This may be fewer than the number of
@ -1282,8 +1282,7 @@ public:
/// be inserted. /// be inserted.
/// ///
/// \param TSK the kind of template specialization this is. /// \param TSK the kind of template specialization this is.
void setFunctionTemplateSpecialization(ASTContext &Context, void setFunctionTemplateSpecialization(FunctionTemplateDecl *Template,
FunctionTemplateDecl *Template,
const TemplateArgumentList *TemplateArgs, const TemplateArgumentList *TemplateArgs,
void *InsertPos, void *InsertPos,
TemplateSpecializationKind TSK = TSK_ImplicitInstantiation); TemplateSpecializationKind TSK = TSK_ImplicitInstantiation);
@ -1678,7 +1677,7 @@ public:
/// declaration as being defined; it's enumerators have already been /// declaration as being defined; it's enumerators have already been
/// added (via DeclContext::addDecl). NewType is the new underlying /// added (via DeclContext::addDecl). NewType is the new underlying
/// type of the enumeration type. /// type of the enumeration type.
void completeDefinition(ASTContext &C, QualType NewType, void completeDefinition(QualType NewType,
QualType PromotionType); QualType PromotionType);
// enumerator_iterator - Iterates through the enumerators of this // enumerator_iterator - Iterates through the enumerators of this
@ -1825,7 +1824,7 @@ public:
/// completeDefinition - Notes that the definition of this type is /// completeDefinition - Notes that the definition of this type is
/// now complete. /// now complete.
void completeDefinition(ASTContext& C); void completeDefinition();
static bool classof(const Decl *D) { return classofKind(D->getKind()); } static bool classof(const Decl *D) { return classofKind(D->getKind()); }
static bool classof(const RecordDecl *D) { return true; } static bool classof(const RecordDecl *D) { return true; }
@ -1907,7 +1906,7 @@ public:
assert(i < getNumParams() && "Illegal param #"); assert(i < getNumParams() && "Illegal param #");
return ParamInfo[i]; return ParamInfo[i];
} }
void setParams(ASTContext& C, ParmVarDecl **NewParamInfo, unsigned NumParams); void setParams(ParmVarDecl **NewParamInfo, unsigned NumParams);
// Implement isa/cast/dyncast/etc. // Implement isa/cast/dyncast/etc.
static bool classof(const Decl *D) { return classofKind(D->getKind()); } static bool classof(const Decl *D) { return classofKind(D->getKind()); }

View File

@ -2927,7 +2927,7 @@ QualType ASTContext::getCFConstantStringType() {
CFConstantStringTypeDecl->addDecl(Field); CFConstantStringTypeDecl->addDecl(Field);
} }
CFConstantStringTypeDecl->completeDefinition(*this); CFConstantStringTypeDecl->completeDefinition();
} }
return getTagDeclType(CFConstantStringTypeDecl); return getTagDeclType(CFConstantStringTypeDecl);
@ -2964,7 +2964,7 @@ QualType ASTContext::getObjCFastEnumerationStateType() {
ObjCFastEnumerationStateTypeDecl->addDecl(Field); ObjCFastEnumerationStateTypeDecl->addDecl(Field);
} }
ObjCFastEnumerationStateTypeDecl->completeDefinition(*this); ObjCFastEnumerationStateTypeDecl->completeDefinition();
} }
return getTagDeclType(ObjCFastEnumerationStateTypeDecl); return getTagDeclType(ObjCFastEnumerationStateTypeDecl);
@ -3001,7 +3001,7 @@ QualType ASTContext::getBlockDescriptorType() {
T->addDecl(Field); T->addDecl(Field);
} }
T->completeDefinition(*this); T->completeDefinition();
BlockDescriptorType = T; BlockDescriptorType = T;
@ -3049,7 +3049,7 @@ QualType ASTContext::getBlockDescriptorExtendedType() {
T->addDecl(Field); T->addDecl(Field);
} }
T->completeDefinition(*this); T->completeDefinition();
BlockDescriptorExtendedType = T; BlockDescriptorExtendedType = T;
@ -3126,7 +3126,7 @@ QualType ASTContext::BuildByRefType(const char *DeclName, QualType Ty) {
T->addDecl(Field); T->addDecl(Field);
} }
T->completeDefinition(*this); T->completeDefinition();
return getPointerType(getTagDeclType(T)); return getPointerType(getTagDeclType(T));
} }
@ -3190,7 +3190,7 @@ QualType ASTContext::getBlockParmType(
T->addDecl(Field); T->addDecl(Field);
} }
T->completeDefinition(*this); T->completeDefinition();
return getPointerType(getTagDeclType(T)); return getPointerType(getTagDeclType(T));
} }

View File

@ -759,7 +759,7 @@ Decl *ASTNodeImporter::VisitRecordDecl(RecordDecl *D) {
++FromMem) ++FromMem)
Importer.Import(*FromMem); Importer.Import(*FromMem);
ToRecord->completeDefinition(Importer.getToContext()); ToRecord->completeDefinition();
} }
return ToRecord; return ToRecord;
@ -851,8 +851,7 @@ Decl *ASTNodeImporter::VisitFunctionDecl(FunctionDecl *D) {
Parameters[I]->setOwningFunction(ToFunction); Parameters[I]->setOwningFunction(ToFunction);
ToFunction->addDecl(Parameters[I]); ToFunction->addDecl(Parameters[I]);
} }
ToFunction->setParams(Importer.getToContext(), ToFunction->setParams(Parameters.data(), Parameters.size());
Parameters.data(), Parameters.size());
// FIXME: Other bits to merge? // FIXME: Other bits to merge?
@ -963,7 +962,7 @@ Decl *ASTNodeImporter::VisitVarDecl(VarDecl *D) {
Importer.FromDiag(DDef->getLocation(), diag::note_odr_defined_here); Importer.FromDiag(DDef->getLocation(), diag::note_odr_defined_here);
} else { } else {
Expr *Init = Importer.Import(DDef->getInit()); Expr *Init = Importer.Import(DDef->getInit());
MergeWithVar->setInit(Importer.getToContext(), Init); MergeWithVar->setInit(Init);
} }
} }
@ -992,8 +991,7 @@ Decl *ASTNodeImporter::VisitVarDecl(VarDecl *D) {
// FIXME: Can we really import any initializer? Alternatively, we could force // FIXME: Can we really import any initializer? Alternatively, we could force
// ourselves to import every declaration of a variable and then only use // ourselves to import every declaration of a variable and then only use
// getInit() here. // getInit() here.
ToVar->setInit(Importer.getToContext(), ToVar->setInit(Importer.Import(const_cast<Expr *>(D->getAnyInitializer())));
Importer.Import(const_cast<Expr *>(D->getAnyInitializer())));
// FIXME: Other bits to merge? // FIXME: Other bits to merge?

View File

@ -717,10 +717,10 @@ VarDecl *VarDecl::getOutOfLineDefinition() {
return 0; return 0;
} }
void VarDecl::setInit(ASTContext &C, Expr *I) { void VarDecl::setInit(Expr *I) {
if (EvaluatedStmt *Eval = Init.dyn_cast<EvaluatedStmt *>()) { if (EvaluatedStmt *Eval = Init.dyn_cast<EvaluatedStmt *>()) {
Eval->~EvaluatedStmt(); Eval->~EvaluatedStmt();
C.Deallocate(Eval); getASTContext().Deallocate(Eval);
} }
Init = I; Init = I;
@ -984,14 +984,13 @@ unsigned FunctionDecl::getNumParams() const {
} }
void FunctionDecl::setParams(ASTContext& C, ParmVarDecl **NewParamInfo, void FunctionDecl::setParams(ParmVarDecl **NewParamInfo, unsigned NumParams) {
unsigned NumParams) {
assert(ParamInfo == 0 && "Already has param info!"); assert(ParamInfo == 0 && "Already has param info!");
assert(NumParams == getNumParams() && "Parameter count mismatch!"); assert(NumParams == getNumParams() && "Parameter count mismatch!");
// Zero params -> null pointer. // Zero params -> null pointer.
if (NumParams) { if (NumParams) {
void *Mem = C.Allocate(sizeof(ParmVarDecl*)*NumParams); void *Mem = getASTContext().Allocate(sizeof(ParmVarDecl*)*NumParams);
ParamInfo = new (Mem) ParmVarDecl*[NumParams]; ParamInfo = new (Mem) ParmVarDecl*[NumParams];
memcpy(ParamInfo, NewParamInfo, sizeof(ParmVarDecl*)*NumParams); memcpy(ParamInfo, NewParamInfo, sizeof(ParmVarDecl*)*NumParams);
@ -1228,8 +1227,7 @@ FunctionDecl::getTemplateSpecializationArgs() const {
} }
void void
FunctionDecl::setFunctionTemplateSpecialization(ASTContext &Context, FunctionDecl::setFunctionTemplateSpecialization(FunctionTemplateDecl *Template,
FunctionTemplateDecl *Template,
const TemplateArgumentList *TemplateArgs, const TemplateArgumentList *TemplateArgs,
void *InsertPos, void *InsertPos,
TemplateSpecializationKind TSK) { TemplateSpecializationKind TSK) {
@ -1238,7 +1236,7 @@ FunctionDecl::setFunctionTemplateSpecialization(ASTContext &Context,
FunctionTemplateSpecializationInfo *Info FunctionTemplateSpecializationInfo *Info
= TemplateOrSpecialization.dyn_cast<FunctionTemplateSpecializationInfo*>(); = TemplateOrSpecialization.dyn_cast<FunctionTemplateSpecializationInfo*>();
if (!Info) if (!Info)
Info = new (Context) FunctionTemplateSpecializationInfo; Info = new (getASTContext()) FunctionTemplateSpecializationInfo;
Info->Function = this; Info->Function = this;
Info->Template.setPointer(Template); Info->Template.setPointer(Template);
@ -1436,8 +1434,7 @@ void EnumDecl::Destroy(ASTContext& C) {
Decl::Destroy(C); Decl::Destroy(C);
} }
void EnumDecl::completeDefinition(ASTContext &C, void EnumDecl::completeDefinition(QualType NewType,
QualType NewType,
QualType NewPromotionType) { QualType NewPromotionType) {
assert(!isDefinition() && "Cannot redefine enums!"); assert(!isDefinition() && "Cannot redefine enums!");
IntegerType = NewType; IntegerType = NewType;
@ -1482,7 +1479,7 @@ bool RecordDecl::isInjectedClassName() const {
/// completeDefinition - Notes that the definition of this type is now /// completeDefinition - Notes that the definition of this type is now
/// complete. /// complete.
void RecordDecl::completeDefinition(ASTContext& C) { void RecordDecl::completeDefinition() {
assert(!isDefinition() && "Cannot redefine record!"); assert(!isDefinition() && "Cannot redefine record!");
TagDecl::completeDefinition(); TagDecl::completeDefinition();
} }
@ -1505,14 +1502,14 @@ void BlockDecl::Destroy(ASTContext& C) {
Decl::Destroy(C); Decl::Destroy(C);
} }
void BlockDecl::setParams(ASTContext& C, ParmVarDecl **NewParamInfo, void BlockDecl::setParams(ParmVarDecl **NewParamInfo,
unsigned NParms) { unsigned NParms) {
assert(ParamInfo == 0 && "Already has param info!"); assert(ParamInfo == 0 && "Already has param info!");
// Zero params -> null pointer. // Zero params -> null pointer.
if (NParms) { if (NParms) {
NumParams = NParms; NumParams = NParms;
void *Mem = C.Allocate(sizeof(ParmVarDecl*)*NumParams); void *Mem = getASTContext().Allocate(sizeof(ParmVarDecl*)*NumParams);
ParamInfo = new (Mem) ParmVarDecl*[NumParams]; ParamInfo = new (Mem) ParmVarDecl*[NumParams];
memcpy(ParamInfo, NewParamInfo, sizeof(ParmVarDecl*)*NumParams); memcpy(ParamInfo, NewParamInfo, sizeof(ParmVarDecl*)*NumParams);
} }

View File

@ -3631,7 +3631,7 @@ ObjCCommonTypesHelper::ObjCCommonTypesHelper(CodeGen::CodeGenModule &cgm)
Ctx.getObjCIdType(), 0, 0, false)); Ctx.getObjCIdType(), 0, 0, false));
RD->addDecl(FieldDecl::Create(Ctx, RD, SourceLocation(), 0, RD->addDecl(FieldDecl::Create(Ctx, RD, SourceLocation(), 0,
Ctx.getObjCClassType(), 0, 0, false)); Ctx.getObjCClassType(), 0, 0, false));
RD->completeDefinition(Ctx); RD->completeDefinition();
SuperCTy = Ctx.getTagDeclType(RD); SuperCTy = Ctx.getTagDeclType(RD);
SuperPtrCTy = Ctx.getPointerType(SuperCTy); SuperPtrCTy = Ctx.getPointerType(SuperCTy);
@ -4092,7 +4092,7 @@ ObjCNonFragileABITypesHelper::ObjCNonFragileABITypesHelper(CodeGen::CodeGenModul
Ctx.VoidPtrTy, 0, 0, false)); Ctx.VoidPtrTy, 0, 0, false));
RD->addDecl(FieldDecl::Create(Ctx, RD, SourceLocation(), 0, RD->addDecl(FieldDecl::Create(Ctx, RD, SourceLocation(), 0,
Ctx.getObjCSelType(), 0, 0, false)); Ctx.getObjCSelType(), 0, 0, false));
RD->completeDefinition(Ctx); RD->completeDefinition();
MessageRefCTy = Ctx.getTagDeclType(RD); MessageRefCTy = Ctx.getTagDeclType(RD);
MessageRefCPtrTy = Ctx.getPointerType(MessageRefCTy); MessageRefCPtrTy = Ctx.getPointerType(MessageRefCTy);

View File

@ -180,7 +180,7 @@ void PCHDeclReader::VisitFunctionDecl(FunctionDecl *FD) {
Params.reserve(NumParams); Params.reserve(NumParams);
for (unsigned I = 0; I != NumParams; ++I) for (unsigned I = 0; I != NumParams; ++I)
Params.push_back(cast<ParmVarDecl>(Reader.GetDecl(Record[Idx++]))); Params.push_back(cast<ParmVarDecl>(Reader.GetDecl(Record[Idx++])));
FD->setParams(*Reader.getContext(), Params.data(), NumParams); FD->setParams(Params.data(), NumParams);
} }
void PCHDeclReader::VisitObjCMethodDecl(ObjCMethodDecl *MD) { void PCHDeclReader::VisitObjCMethodDecl(ObjCMethodDecl *MD) {
@ -388,7 +388,7 @@ void PCHDeclReader::VisitVarDecl(VarDecl *VD) {
VD->setPreviousDeclaration( VD->setPreviousDeclaration(
cast_or_null<VarDecl>(Reader.GetDecl(Record[Idx++]))); cast_or_null<VarDecl>(Reader.GetDecl(Record[Idx++])));
if (Record[Idx++]) if (Record[Idx++])
VD->setInit(*Reader.getContext(), Reader.ReadDeclExpr()); VD->setInit(Reader.ReadDeclExpr());
} }
void PCHDeclReader::VisitImplicitParamDecl(ImplicitParamDecl *PD) { void PCHDeclReader::VisitImplicitParamDecl(ImplicitParamDecl *PD) {
@ -413,7 +413,7 @@ void PCHDeclReader::VisitBlockDecl(BlockDecl *BD) {
Params.reserve(NumParams); Params.reserve(NumParams);
for (unsigned I = 0; I != NumParams; ++I) for (unsigned I = 0; I != NumParams; ++I)
Params.push_back(cast<ParmVarDecl>(Reader.GetDecl(Record[Idx++]))); Params.push_back(cast<ParmVarDecl>(Reader.GetDecl(Record[Idx++])));
BD->setParams(*Reader.getContext(), Params.data(), NumParams); BD->setParams(Params.data(), NumParams);
} }
std::pair<uint64_t, uint64_t> std::pair<uint64_t, uint64_t>

View File

@ -2460,7 +2460,7 @@ QualType RewriteObjC::getSuperStructType() {
/*Mutable=*/false)); /*Mutable=*/false));
} }
SuperStructDecl->completeDefinition(*Context); SuperStructDecl->completeDefinition();
} }
return Context->getTagDeclType(SuperStructDecl); return Context->getTagDeclType(SuperStructDecl);
} }
@ -2491,7 +2491,7 @@ QualType RewriteObjC::getConstantStringStructType() {
/*Mutable=*/true)); /*Mutable=*/true));
} }
ConstantStringDecl->completeDefinition(*Context); ConstantStringDecl->completeDefinition();
} }
return Context->getTagDeclType(ConstantStringDecl); return Context->getTagDeclType(ConstantStringDecl);
} }

View File

@ -698,7 +698,7 @@ NamedDecl *Sema::LazilyCreateBuiltin(IdentifierInfo *II, unsigned bid,
Params.push_back(ParmVarDecl::Create(Context, New, SourceLocation(), 0, Params.push_back(ParmVarDecl::Create(Context, New, SourceLocation(), 0,
FT->getArgType(i), /*TInfo=*/0, FT->getArgType(i), /*TInfo=*/0,
VarDecl::None, 0)); VarDecl::None, 0));
New->setParams(Context, Params.data(), Params.size()); New->setParams(Params.data(), Params.size());
} }
AddKnownFunctionAttributes(New); AddKnownFunctionAttributes(New);
@ -1107,7 +1107,7 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD) {
Params.push_back(Param); Params.push_back(Param);
} }
New->setParams(Context, Params.data(), Params.size()); New->setParams(Params.data(), Params.size());
} }
return MergeCompatibleFunctionDecls(New, Old); return MergeCompatibleFunctionDecls(New, Old);
@ -2970,7 +2970,7 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC,
"Should not need args for typedef of non-prototype fn"); "Should not need args for typedef of non-prototype fn");
} }
// Finally, we know we have the right number of parameters, install them. // Finally, we know we have the right number of parameters, install them.
NewFD->setParams(Context, Params.data(), Params.size()); NewFD->setParams(Params.data(), Params.size());
// If the declarator is a template-id, translate the parser's template // If the declarator is a template-id, translate the parser's template
// argument list into our AST format. // argument list into our AST format.
@ -3561,7 +3561,7 @@ void Sema::AddInitializerToDecl(DeclPtrTy dcl, ExprArg init, bool DirectInit) {
// }; // };
// Attach the initializer // Attach the initializer
VDecl->setInit(Context, Init); VDecl->setInit(Init);
// C++ [class.mem]p4: // C++ [class.mem]p4:
// A member-declarator can contain a constant-initializer only // A member-declarator can contain a constant-initializer only
@ -3633,7 +3633,7 @@ void Sema::AddInitializerToDecl(DeclPtrTy dcl, ExprArg init, bool DirectInit) {
Init = MaybeCreateCXXExprWithTemporaries(Init); Init = MaybeCreateCXXExprWithTemporaries(Init);
// Attach the initializer to the decl. // Attach the initializer to the decl.
VDecl->setInit(Context, Init); VDecl->setInit(Init);
if (getLangOptions().CPlusPlus) { if (getLangOptions().CPlusPlus) {
// Make sure we mark the destructor as used if necessary. // Make sure we mark the destructor as used if necessary.
@ -3785,8 +3785,7 @@ void Sema::ActOnUninitializedDecl(DeclPtrTy dcl,
Var->setInvalidDecl(); Var->setInvalidDecl();
else { else {
if (Init.get()) if (Init.get())
Var->setInit(Context, Var->setInit(MaybeCreateCXXExprWithTemporaries(Init.takeAs<Expr>()));
MaybeCreateCXXExprWithTemporaries(Init.takeAs<Expr>()));
if (getLangOptions().CPlusPlus) if (getLangOptions().CPlusPlus)
if (const RecordType *Record if (const RecordType *Record
@ -5611,7 +5610,7 @@ void Sema::ActOnFields(Scope* S,
// Okay, we successfully defined 'Record'. // Okay, we successfully defined 'Record'.
if (Record) { if (Record) {
Record->completeDefinition(Context); Record->completeDefinition();
} else { } else {
ObjCIvarDecl **ClsFields = ObjCIvarDecl **ClsFields =
reinterpret_cast<ObjCIvarDecl**>(RecFields.data()); reinterpret_cast<ObjCIvarDecl**>(RecFields.data());
@ -5897,7 +5896,7 @@ void Sema::ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc,
ECD->setType(EnumType); ECD->setType(EnumType);
} }
Enum->completeDefinition(Context, Context.DependentTy, Context.DependentTy); Enum->completeDefinition(Context.DependentTy, Context.DependentTy);
return; return;
} }
@ -6077,7 +6076,7 @@ void Sema::ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc,
ECD->setType(NewTy); ECD->setType(NewTy);
} }
Enum->completeDefinition(Context, BestType, BestPromotionType); Enum->completeDefinition(BestType, BestPromotionType);
} }
Sema::DeclPtrTy Sema::ActOnFileScopeAsmDecl(SourceLocation Loc, Sema::DeclPtrTy Sema::ActOnFileScopeAsmDecl(SourceLocation Loc,

View File

@ -2263,7 +2263,7 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) {
/*IdentifierInfo=*/0, /*IdentifierInfo=*/0,
ArgType, /*TInfo=*/0, ArgType, /*TInfo=*/0,
VarDecl::None, 0); VarDecl::None, 0);
CopyConstructor->setParams(Context, &FromParam, 1); CopyConstructor->setParams(&FromParam, 1);
ClassDecl->addDecl(CopyConstructor); ClassDecl->addDecl(CopyConstructor);
} }
@ -2347,7 +2347,7 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) {
/*IdentifierInfo=*/0, /*IdentifierInfo=*/0,
ArgType, /*TInfo=*/0, ArgType, /*TInfo=*/0,
VarDecl::None, 0); VarDecl::None, 0);
CopyAssignment->setParams(Context, &FromParam, 1); CopyAssignment->setParams(&FromParam, 1);
// Don't call addedAssignmentOperator. There is no way to distinguish an // Don't call addedAssignmentOperator. There is no way to distinguish an
// implicit from an explicit assignment operator. // implicit from an explicit assignment operator.
@ -3991,7 +3991,7 @@ bool Sema::InitializeVarWithConstructor(VarDecl *VD,
Expr *Temp = TempResult.takeAs<Expr>(); Expr *Temp = TempResult.takeAs<Expr>();
MarkDeclarationReferenced(VD->getLocation(), Constructor); MarkDeclarationReferenced(VD->getLocation(), Constructor);
Temp = MaybeCreateCXXExprWithTemporaries(Temp); Temp = MaybeCreateCXXExprWithTemporaries(Temp);
VD->setInit(Context, Temp); VD->setInit(Temp);
return false; return false;
} }
@ -4048,8 +4048,7 @@ void Sema::AddCXXDirectInitializerToDecl(DeclPtrTy Dcl,
// Store the initialization expressions as a ParenListExpr. // Store the initialization expressions as a ParenListExpr.
unsigned NumExprs = Exprs.size(); unsigned NumExprs = Exprs.size();
VDecl->setInit(Context, VDecl->setInit(new (Context) ParenListExpr(Context, LParenLoc,
new (Context) ParenListExpr(Context, LParenLoc,
(Expr **)Exprs.release(), (Expr **)Exprs.release(),
NumExprs, RParenLoc)); NumExprs, RParenLoc));
return; return;
@ -4103,7 +4102,7 @@ void Sema::AddCXXDirectInitializerToDecl(DeclPtrTy Dcl,
} }
Result = MaybeCreateCXXExprWithTemporaries(move(Result)); Result = MaybeCreateCXXExprWithTemporaries(move(Result));
VDecl->setInit(Context, Result.takeAs<Expr>()); VDecl->setInit(Result.takeAs<Expr>());
VDecl->setCXXDirectInitializer(true); VDecl->setCXXDirectInitializer(true);
if (const RecordType *Record = VDecl->getType()->getAs<RecordType>()) if (const RecordType *Record = VDecl->getType()->getAs<RecordType>())

View File

@ -6835,7 +6835,7 @@ void Sema::ActOnBlockArguments(Declarator &ParamInfo, Scope *CurScope) {
CurBlock->Params.push_back(FTI.ArgInfo[i].Param.getAs<ParmVarDecl>()); CurBlock->Params.push_back(FTI.ArgInfo[i].Param.getAs<ParmVarDecl>());
CurBlock->isVariadic = FTI.isVariadic; CurBlock->isVariadic = FTI.isVariadic;
} }
CurBlock->TheDecl->setParams(Context, CurBlock->Params.data(), CurBlock->TheDecl->setParams(CurBlock->Params.data(),
CurBlock->Params.size()); CurBlock->Params.size());
CurBlock->TheDecl->setIsVariadic(CurBlock->isVariadic); CurBlock->TheDecl->setIsVariadic(CurBlock->isVariadic);
ProcessDeclAttributes(CurScope, CurBlock->TheDecl, ParamInfo); ProcessDeclAttributes(CurScope, CurBlock->TheDecl, ParamInfo);

View File

@ -811,7 +811,7 @@ void Sema::DeclareGlobalAllocationFunction(DeclarationName Name,
ParmVarDecl *Param = ParmVarDecl::Create(Context, Alloc, SourceLocation(), ParmVarDecl *Param = ParmVarDecl::Create(Context, Alloc, SourceLocation(),
0, Argument, /*TInfo=*/0, 0, Argument, /*TInfo=*/0,
VarDecl::None, 0); VarDecl::None, 0);
Alloc->setParams(Context, &Param, 1); Alloc->setParams(&Param, 1);
// FIXME: Also add this declaration to the IdentifierResolver, but // FIXME: Also add this declaration to the IdentifierResolver, but
// make sure it is at the end of the chain to coincide with the // make sure it is at the end of the chain to coincide with the

View File

@ -3941,8 +3941,7 @@ Sema::CheckFunctionTemplateSpecialization(FunctionDecl *FD,
// Turn the given function declaration into a function template // Turn the given function declaration into a function template
// specialization, with the template arguments from the previous // specialization, with the template arguments from the previous
// specialization. // specialization.
FD->setFunctionTemplateSpecialization(Context, FD->setFunctionTemplateSpecialization(Specialization->getPrimaryTemplate(),
Specialization->getPrimaryTemplate(),
new (Context) TemplateArgumentList( new (Context) TemplateArgumentList(
*Specialization->getTemplateSpecializationArgs()), *Specialization->getTemplateSpecializationArgs()),
/*InsertPos=*/0, /*InsertPos=*/0,

View File

@ -768,7 +768,7 @@ Decl *TemplateDeclInstantiator::VisitFunctionDecl(FunctionDecl *D,
// Attach the parameters // Attach the parameters
for (unsigned P = 0; P < Params.size(); ++P) for (unsigned P = 0; P < Params.size(); ++P)
Params[P]->setOwningFunction(Function); Params[P]->setOwningFunction(Function);
Function->setParams(SemaRef.Context, Params.data(), Params.size()); Function->setParams(Params.data(), Params.size());
if (TemplateParams) { if (TemplateParams) {
// Our resulting instantiation is actually a function template, since we // Our resulting instantiation is actually a function template, since we
@ -793,8 +793,7 @@ Decl *TemplateDeclInstantiator::VisitFunctionDecl(FunctionDecl *D,
FunctionTemplate->setLexicalDeclContext(D->getLexicalDeclContext()); FunctionTemplate->setLexicalDeclContext(D->getLexicalDeclContext());
} else if (FunctionTemplate) { } else if (FunctionTemplate) {
// Record this function template specialization. // Record this function template specialization.
Function->setFunctionTemplateSpecialization(SemaRef.Context, Function->setFunctionTemplateSpecialization(FunctionTemplate,
FunctionTemplate,
&TemplateArgs.getInnermost(), &TemplateArgs.getInnermost(),
InsertPos); InsertPos);
} }
@ -947,8 +946,7 @@ TemplateDeclInstantiator::VisitCXXMethodDecl(CXXMethodDecl *D,
Method->setDescribedFunctionTemplate(FunctionTemplate); Method->setDescribedFunctionTemplate(FunctionTemplate);
} else if (FunctionTemplate) { } else if (FunctionTemplate) {
// Record this function template specialization. // Record this function template specialization.
Method->setFunctionTemplateSpecialization(SemaRef.Context, Method->setFunctionTemplateSpecialization(FunctionTemplate,
FunctionTemplate,
&TemplateArgs.getInnermost(), &TemplateArgs.getInnermost(),
InsertPos); InsertPos);
} else { } else {
@ -965,7 +963,7 @@ TemplateDeclInstantiator::VisitCXXMethodDecl(CXXMethodDecl *D,
// Attach the parameters // Attach the parameters
for (unsigned P = 0; P < Params.size(); ++P) for (unsigned P = 0; P < Params.size(); ++P)
Params[P]->setOwningFunction(Method); Params[P]->setOwningFunction(Method);
Method->setParams(SemaRef.Context, Params.data(), Params.size()); Method->setParams(Params.data(), Params.size());
if (InitMethodInstantiation(Method, D)) if (InitMethodInstantiation(Method, D))
Method->setInvalidDecl(); Method->setInvalidDecl();