return StmtPtr;
}
- void setInit(ASTContext &C, Expr *I);
+ void setInit(Expr *I);
EvaluatedStmt *EnsureEvaluatedStmt() const {
EvaluatedStmt *Eval = Init.dyn_cast<EvaluatedStmt *>();
assert(i < getNumParams() && "Illegal param #");
return ParamInfo[i];
}
- void setParams(ASTContext& C, ParmVarDecl **NewParamInfo, unsigned NumParams);
+ void setParams(ParmVarDecl **NewParamInfo, unsigned NumParams);
/// getMinRequiredArguments - Returns the minimum number of arguments
/// needed to call this function. This may be fewer than the number of
/// be inserted.
///
/// \param TSK the kind of template specialization this is.
- void setFunctionTemplateSpecialization(ASTContext &Context,
- FunctionTemplateDecl *Template,
+ void setFunctionTemplateSpecialization(FunctionTemplateDecl *Template,
const TemplateArgumentList *TemplateArgs,
void *InsertPos,
TemplateSpecializationKind TSK = TSK_ImplicitInstantiation);
/// declaration as being defined; it's enumerators have already been
/// added (via DeclContext::addDecl). NewType is the new underlying
/// type of the enumeration type.
- void completeDefinition(ASTContext &C, QualType NewType,
+ void completeDefinition(QualType NewType,
QualType PromotionType);
// enumerator_iterator - Iterates through the enumerators of this
/// completeDefinition - Notes that the definition of this type is
/// now complete.
- void completeDefinition(ASTContext& C);
+ void completeDefinition();
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
static bool classof(const RecordDecl *D) { return true; }
assert(i < getNumParams() && "Illegal param #");
return ParamInfo[i];
}
- void setParams(ASTContext& C, ParmVarDecl **NewParamInfo, unsigned NumParams);
+ void setParams(ParmVarDecl **NewParamInfo, unsigned NumParams);
// Implement isa/cast/dyncast/etc.
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
CFConstantStringTypeDecl->addDecl(Field);
}
- CFConstantStringTypeDecl->completeDefinition(*this);
+ CFConstantStringTypeDecl->completeDefinition();
}
return getTagDeclType(CFConstantStringTypeDecl);
ObjCFastEnumerationStateTypeDecl->addDecl(Field);
}
- ObjCFastEnumerationStateTypeDecl->completeDefinition(*this);
+ ObjCFastEnumerationStateTypeDecl->completeDefinition();
}
return getTagDeclType(ObjCFastEnumerationStateTypeDecl);
T->addDecl(Field);
}
- T->completeDefinition(*this);
+ T->completeDefinition();
BlockDescriptorType = T;
T->addDecl(Field);
}
- T->completeDefinition(*this);
+ T->completeDefinition();
BlockDescriptorExtendedType = T;
T->addDecl(Field);
}
- T->completeDefinition(*this);
+ T->completeDefinition();
return getPointerType(getTagDeclType(T));
}
T->addDecl(Field);
}
- T->completeDefinition(*this);
+ T->completeDefinition();
return getPointerType(getTagDeclType(T));
}
++FromMem)
Importer.Import(*FromMem);
- ToRecord->completeDefinition(Importer.getToContext());
+ ToRecord->completeDefinition();
}
return ToRecord;
Parameters[I]->setOwningFunction(ToFunction);
ToFunction->addDecl(Parameters[I]);
}
- ToFunction->setParams(Importer.getToContext(),
- Parameters.data(), Parameters.size());
+ ToFunction->setParams(Parameters.data(), Parameters.size());
// FIXME: Other bits to merge?
Importer.FromDiag(DDef->getLocation(), diag::note_odr_defined_here);
} else {
Expr *Init = Importer.Import(DDef->getInit());
- MergeWithVar->setInit(Importer.getToContext(), Init);
+ MergeWithVar->setInit(Init);
}
}
// FIXME: Can we really import any initializer? Alternatively, we could force
// ourselves to import every declaration of a variable and then only use
// getInit() here.
- ToVar->setInit(Importer.getToContext(),
- Importer.Import(const_cast<Expr *>(D->getAnyInitializer())));
+ ToVar->setInit(Importer.Import(const_cast<Expr *>(D->getAnyInitializer())));
// FIXME: Other bits to merge?
return 0;
}
-void VarDecl::setInit(ASTContext &C, Expr *I) {
+void VarDecl::setInit(Expr *I) {
if (EvaluatedStmt *Eval = Init.dyn_cast<EvaluatedStmt *>()) {
Eval->~EvaluatedStmt();
- C.Deallocate(Eval);
+ getASTContext().Deallocate(Eval);
}
Init = I;
}
-void FunctionDecl::setParams(ASTContext& C, ParmVarDecl **NewParamInfo,
- unsigned NumParams) {
+void FunctionDecl::setParams(ParmVarDecl **NewParamInfo, unsigned NumParams) {
assert(ParamInfo == 0 && "Already has param info!");
assert(NumParams == getNumParams() && "Parameter count mismatch!");
// Zero params -> null pointer.
if (NumParams) {
- void *Mem = C.Allocate(sizeof(ParmVarDecl*)*NumParams);
+ void *Mem = getASTContext().Allocate(sizeof(ParmVarDecl*)*NumParams);
ParamInfo = new (Mem) ParmVarDecl*[NumParams];
memcpy(ParamInfo, NewParamInfo, sizeof(ParmVarDecl*)*NumParams);
}
void
-FunctionDecl::setFunctionTemplateSpecialization(ASTContext &Context,
- FunctionTemplateDecl *Template,
+FunctionDecl::setFunctionTemplateSpecialization(FunctionTemplateDecl *Template,
const TemplateArgumentList *TemplateArgs,
void *InsertPos,
TemplateSpecializationKind TSK) {
FunctionTemplateSpecializationInfo *Info
= TemplateOrSpecialization.dyn_cast<FunctionTemplateSpecializationInfo*>();
if (!Info)
- Info = new (Context) FunctionTemplateSpecializationInfo;
+ Info = new (getASTContext()) FunctionTemplateSpecializationInfo;
Info->Function = this;
Info->Template.setPointer(Template);
Decl::Destroy(C);
}
-void EnumDecl::completeDefinition(ASTContext &C,
- QualType NewType,
+void EnumDecl::completeDefinition(QualType NewType,
QualType NewPromotionType) {
assert(!isDefinition() && "Cannot redefine enums!");
IntegerType = NewType;
/// completeDefinition - Notes that the definition of this type is now
/// complete.
-void RecordDecl::completeDefinition(ASTContext& C) {
+void RecordDecl::completeDefinition() {
assert(!isDefinition() && "Cannot redefine record!");
TagDecl::completeDefinition();
}
Decl::Destroy(C);
}
-void BlockDecl::setParams(ASTContext& C, ParmVarDecl **NewParamInfo,
+void BlockDecl::setParams(ParmVarDecl **NewParamInfo,
unsigned NParms) {
assert(ParamInfo == 0 && "Already has param info!");
// Zero params -> null pointer.
if (NParms) {
NumParams = NParms;
- void *Mem = C.Allocate(sizeof(ParmVarDecl*)*NumParams);
+ void *Mem = getASTContext().Allocate(sizeof(ParmVarDecl*)*NumParams);
ParamInfo = new (Mem) ParmVarDecl*[NumParams];
memcpy(ParamInfo, NewParamInfo, sizeof(ParmVarDecl*)*NumParams);
}
Ctx.getObjCIdType(), 0, 0, false));
RD->addDecl(FieldDecl::Create(Ctx, RD, SourceLocation(), 0,
Ctx.getObjCClassType(), 0, 0, false));
- RD->completeDefinition(Ctx);
+ RD->completeDefinition();
SuperCTy = Ctx.getTagDeclType(RD);
SuperPtrCTy = Ctx.getPointerType(SuperCTy);
Ctx.VoidPtrTy, 0, 0, false));
RD->addDecl(FieldDecl::Create(Ctx, RD, SourceLocation(), 0,
Ctx.getObjCSelType(), 0, 0, false));
- RD->completeDefinition(Ctx);
+ RD->completeDefinition();
MessageRefCTy = Ctx.getTagDeclType(RD);
MessageRefCPtrTy = Ctx.getPointerType(MessageRefCTy);
Params.reserve(NumParams);
for (unsigned I = 0; I != NumParams; ++I)
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) {
VD->setPreviousDeclaration(
cast_or_null<VarDecl>(Reader.GetDecl(Record[Idx++])));
if (Record[Idx++])
- VD->setInit(*Reader.getContext(), Reader.ReadDeclExpr());
+ VD->setInit(Reader.ReadDeclExpr());
}
void PCHDeclReader::VisitImplicitParamDecl(ImplicitParamDecl *PD) {
Params.reserve(NumParams);
for (unsigned I = 0; I != NumParams; ++I)
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>
/*Mutable=*/false));
}
- SuperStructDecl->completeDefinition(*Context);
+ SuperStructDecl->completeDefinition();
}
return Context->getTagDeclType(SuperStructDecl);
}
/*Mutable=*/true));
}
- ConstantStringDecl->completeDefinition(*Context);
+ ConstantStringDecl->completeDefinition();
}
return Context->getTagDeclType(ConstantStringDecl);
}
Params.push_back(ParmVarDecl::Create(Context, New, SourceLocation(), 0,
FT->getArgType(i), /*TInfo=*/0,
VarDecl::None, 0));
- New->setParams(Context, Params.data(), Params.size());
+ New->setParams(Params.data(), Params.size());
}
AddKnownFunctionAttributes(New);
Params.push_back(Param);
}
- New->setParams(Context, Params.data(), Params.size());
+ New->setParams(Params.data(), Params.size());
}
return MergeCompatibleFunctionDecls(New, Old);
"Should not need args for typedef of non-prototype fn");
}
// 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
// argument list into our AST format.
// };
// Attach the initializer
- VDecl->setInit(Context, Init);
+ VDecl->setInit(Init);
// C++ [class.mem]p4:
// A member-declarator can contain a constant-initializer only
Init = MaybeCreateCXXExprWithTemporaries(Init);
// Attach the initializer to the decl.
- VDecl->setInit(Context, Init);
+ VDecl->setInit(Init);
if (getLangOptions().CPlusPlus) {
// Make sure we mark the destructor as used if necessary.
Var->setInvalidDecl();
else {
if (Init.get())
- Var->setInit(Context,
- MaybeCreateCXXExprWithTemporaries(Init.takeAs<Expr>()));
+ Var->setInit(MaybeCreateCXXExprWithTemporaries(Init.takeAs<Expr>()));
if (getLangOptions().CPlusPlus)
if (const RecordType *Record
// Okay, we successfully defined 'Record'.
if (Record) {
- Record->completeDefinition(Context);
+ Record->completeDefinition();
} else {
ObjCIvarDecl **ClsFields =
reinterpret_cast<ObjCIvarDecl**>(RecFields.data());
ECD->setType(EnumType);
}
- Enum->completeDefinition(Context, Context.DependentTy, Context.DependentTy);
+ Enum->completeDefinition(Context.DependentTy, Context.DependentTy);
return;
}
ECD->setType(NewTy);
}
- Enum->completeDefinition(Context, BestType, BestPromotionType);
+ Enum->completeDefinition(BestType, BestPromotionType);
}
Sema::DeclPtrTy Sema::ActOnFileScopeAsmDecl(SourceLocation Loc,
/*IdentifierInfo=*/0,
ArgType, /*TInfo=*/0,
VarDecl::None, 0);
- CopyConstructor->setParams(Context, &FromParam, 1);
+ CopyConstructor->setParams(&FromParam, 1);
ClassDecl->addDecl(CopyConstructor);
}
/*IdentifierInfo=*/0,
ArgType, /*TInfo=*/0,
VarDecl::None, 0);
- CopyAssignment->setParams(Context, &FromParam, 1);
+ CopyAssignment->setParams(&FromParam, 1);
// Don't call addedAssignmentOperator. There is no way to distinguish an
// implicit from an explicit assignment operator.
Expr *Temp = TempResult.takeAs<Expr>();
MarkDeclarationReferenced(VD->getLocation(), Constructor);
Temp = MaybeCreateCXXExprWithTemporaries(Temp);
- VD->setInit(Context, Temp);
+ VD->setInit(Temp);
return false;
}
// Store the initialization expressions as a ParenListExpr.
unsigned NumExprs = Exprs.size();
- VDecl->setInit(Context,
- new (Context) ParenListExpr(Context, LParenLoc,
+ VDecl->setInit(new (Context) ParenListExpr(Context, LParenLoc,
(Expr **)Exprs.release(),
NumExprs, RParenLoc));
return;
}
Result = MaybeCreateCXXExprWithTemporaries(move(Result));
- VDecl->setInit(Context, Result.takeAs<Expr>());
+ VDecl->setInit(Result.takeAs<Expr>());
VDecl->setCXXDirectInitializer(true);
if (const RecordType *Record = VDecl->getType()->getAs<RecordType>())
CurBlock->Params.push_back(FTI.ArgInfo[i].Param.getAs<ParmVarDecl>());
CurBlock->isVariadic = FTI.isVariadic;
}
- CurBlock->TheDecl->setParams(Context, CurBlock->Params.data(),
+ CurBlock->TheDecl->setParams(CurBlock->Params.data(),
CurBlock->Params.size());
CurBlock->TheDecl->setIsVariadic(CurBlock->isVariadic);
ProcessDeclAttributes(CurScope, CurBlock->TheDecl, ParamInfo);
ParmVarDecl *Param = ParmVarDecl::Create(Context, Alloc, SourceLocation(),
0, Argument, /*TInfo=*/0,
VarDecl::None, 0);
- Alloc->setParams(Context, &Param, 1);
+ Alloc->setParams(&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
// Turn the given function declaration into a function template
// specialization, with the template arguments from the previous
// specialization.
- FD->setFunctionTemplateSpecialization(Context,
- Specialization->getPrimaryTemplate(),
+ FD->setFunctionTemplateSpecialization(Specialization->getPrimaryTemplate(),
new (Context) TemplateArgumentList(
*Specialization->getTemplateSpecializationArgs()),
/*InsertPos=*/0,
// Attach the parameters
for (unsigned P = 0; P < Params.size(); ++P)
Params[P]->setOwningFunction(Function);
- Function->setParams(SemaRef.Context, Params.data(), Params.size());
+ Function->setParams(Params.data(), Params.size());
if (TemplateParams) {
// Our resulting instantiation is actually a function template, since we
FunctionTemplate->setLexicalDeclContext(D->getLexicalDeclContext());
} else if (FunctionTemplate) {
// Record this function template specialization.
- Function->setFunctionTemplateSpecialization(SemaRef.Context,
- FunctionTemplate,
+ Function->setFunctionTemplateSpecialization(FunctionTemplate,
&TemplateArgs.getInnermost(),
InsertPos);
}
Method->setDescribedFunctionTemplate(FunctionTemplate);
} else if (FunctionTemplate) {
// Record this function template specialization.
- Method->setFunctionTemplateSpecialization(SemaRef.Context,
- FunctionTemplate,
+ Method->setFunctionTemplateSpecialization(FunctionTemplate,
&TemplateArgs.getInnermost(),
InsertPos);
} else {
// Attach the parameters
for (unsigned P = 0; P < Params.size(); ++P)
Params[P]->setOwningFunction(Method);
- Method->setParams(SemaRef.Context, Params.data(), Params.size());
+ Method->setParams(Params.data(), Params.size());
if (InitMethodInstantiation(Method, D))
Method->setInvalidDecl();