void GCCAsmStmt::setOutputsAndInputsAndClobbers(const ASTContext &C, IdentifierInfo **Names, StringLiteral **Constraints, Stmt **Exprs, unsigned NumOutputs, unsigned NumInputs, StringLiteral **Clobbers, unsigned NumClobbers) { this->NumOutputs = NumOutputs; this->NumInputs = NumInputs; this->NumClobbers = NumClobbers; unsigned NumExprs = NumOutputs + NumInputs; C.Deallocate(this->Names); this->Names = new (C) IdentifierInfo*[NumExprs]; std::copy(Names, Names + NumExprs, this->Names); C.Deallocate(this->Exprs); this->Exprs = new (C) Stmt*[NumExprs]; std::copy(Exprs, Exprs + NumExprs, this->Exprs); C.Deallocate(this->Constraints); this->Constraints = new (C) StringLiteral*[NumExprs]; std::copy(Constraints, Constraints + NumExprs, this->Constraints); C.Deallocate(this->Clobbers); this->Clobbers = new (C) StringLiteral*[NumClobbers]; std::copy(Clobbers, Clobbers + NumClobbers, this->Clobbers); }
void CXXConstructExpr::Destroy(ASTContext &C) { DestroyChildren(C); if (Args) C.Deallocate(Args); this->~CXXConstructExpr(); C.Deallocate(this); }
void CXXRecordDecl::Destroy(ASTContext &C) { if (data().Definition == this) { C.Deallocate(data().Bases); C.Deallocate(data().VBases); C.Deallocate(&data()); } this->RecordDecl::Destroy(C); }
void ClassTemplateDecl::Destroy(ASTContext& C) { if (!PreviousDeclaration) { CommonPtr->~Common(); C.Deallocate((void*)CommonPtr); } CommonPtr = 0; this->~ClassTemplateDecl(); C.Deallocate((void*)this); }
void ASTRecordLayout::Destroy(ASTContext &Ctx) { if (FieldOffsets) Ctx.Deallocate(FieldOffsets); if (CXXInfo) { Ctx.Deallocate(CXXInfo); CXXInfo->~CXXRecordLayoutInfo(); } this->~ASTRecordLayout(); Ctx.Deallocate(this); }
void VarDecl::Destroy(ASTContext& C) { Expr *Init = getInit(); if (Init) { Init->Destroy(C); if (EvaluatedStmt *Eval = this->Init.dyn_cast<EvaluatedStmt *>()) { Eval->~EvaluatedStmt(); C.Deallocate(Eval); } } this->~VarDecl(); C.Deallocate((void *)this); }
void CXXConditionDeclExpr::Destroy(ASTContext& C) { // FIXME: Cannot destroy the decl here, because it is linked into the // DeclContext's chain. //getVarDecl()->Destroy(C); this->~CXXConditionDeclExpr(); C.Deallocate(this); }
void ClassTemplateSpecializationDecl::Destroy(ASTContext &C) { if (SpecializedPartialSpecialization *PartialSpec = SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization*>()) C.Deallocate(PartialSpec); CXXRecordDecl::Destroy(C); }
void Stmt::Destroy(ASTContext &C) { DestroyChildren(C); // FIXME: Eventually all Stmts should be allocated with the allocator // in ASTContext, just like with Decls. this->~Stmt(); C.Deallocate((void *)this); }
void NamespaceDecl::Destroy(ASTContext& C) { // NamespaceDecl uses "NextDeclarator" to chain namespace declarations // together. They are all top-level Decls. this->~NamespaceDecl(); C.Deallocate((void *)this); }
void Decl::Destroy(ASTContext &C) { // Free attributes for this decl. if (HasAttrs) { C.getDeclAttrs(this)->Destroy(C); invalidateAttrs(); HasAttrs = false; } #if 0 // FIXME: Once ownership is fully understood, we can enable this code if (DeclContext *DC = dyn_cast<DeclContext>(this)) DC->decls_begin()->Destroy(C); // Observe the unrolled recursion. By setting N->NextDeclInContext = 0x0 // within the loop, only the Destroy method for the first Decl // will deallocate all of the Decls in a chain. Decl* N = getNextDeclInContext(); while (N) { Decl* Tmp = N->getNextDeclInContext(); N->NextDeclInContext = 0; N->Destroy(C); N = Tmp; } this->~Decl(); C.Deallocate((void *)this); #endif }
void CompoundStmt::setStmts(ASTContext &C, Stmt **Stmts, unsigned NumStmts) { if (this->Body) C.Deallocate(Body); this->CompoundStmtBits.NumStmts = NumStmts; Body = new (C) Stmt*[NumStmts]; memcpy(Body, Stmts, sizeof(Stmt *) * NumStmts); }
void VarDecl::setInit(ASTContext &C, Expr *I) { if (EvaluatedStmt *Eval = Init.dyn_cast<EvaluatedStmt *>()) { Eval->~EvaluatedStmt(); C.Deallocate(Eval); } Init = I; }
void Attr::Destroy(ASTContext &C) { if (Next) { Next->Destroy(C); Next = 0; } this->~Attr(); C.Deallocate((void*)this); }
void BlockDecl::Destroy(ASTContext& C) { if (Body) Body->Destroy(C); for (param_iterator I=param_begin(), E=param_end(); I!=E; ++I) (*I)->Destroy(C); C.Deallocate(ParamInfo); Decl::Destroy(C); }
void CompoundStmt::setStmts(const ASTContext &C, ArrayRef<Stmt *> Stmts) { if (Body) C.Deallocate(Body); CompoundStmtBits.NumStmts = Stmts.size(); assert(CompoundStmtBits.NumStmts == Stmts.size() && "NumStmts doesn't fit in bits of CompoundStmtBits.NumStmts!"); Body = new (C) Stmt*[Stmts.size()]; std::copy(Stmts.begin(), Stmts.end(), Body); }
void FunctionTemplateDecl::Destroy(ASTContext &C) { if (Common *CommonPtr = CommonOrPrev.dyn_cast<Common*>()) { for (llvm::FoldingSet<FunctionTemplateSpecializationInfo>::iterator Spec = CommonPtr->Specializations.begin(), SpecEnd = CommonPtr->Specializations.end(); Spec != SpecEnd; ++Spec) C.Deallocate(&*Spec); } Decl::Destroy(C); }
void FunctionDecl::Destroy(ASTContext& C) { if (Body && Body.isOffset()) Body.get(C.getExternalSource())->Destroy(C); for (param_iterator I=param_begin(), E=param_end(); I!=E; ++I) (*I)->Destroy(C); C.Deallocate(ParamInfo); Decl::Destroy(C); }
void FunctionDecl::Destroy(ASTContext& C) { if (Body && Body.isOffset()) Body.get(C.getExternalSource())->Destroy(C); for (param_iterator I=param_begin(), E=param_end(); I!=E; ++I) (*I)->Destroy(C); FunctionTemplateSpecializationInfo *FTSInfo = TemplateOrSpecialization.dyn_cast<FunctionTemplateSpecializationInfo*>(); if (FTSInfo) C.Deallocate(FTSInfo); MemberSpecializationInfo *MSInfo = TemplateOrSpecialization.dyn_cast<MemberSpecializationInfo*>(); if (MSInfo) C.Deallocate(MSInfo); C.Deallocate(ParamInfo); Decl::Destroy(C); }
void FullExpr::Destroy(ASTContext &Context) { if (Expr *E = SubExpr.dyn_cast<Expr *>()) { E->Destroy(Context); return; } ExprAndTemporaries *ET = SubExpr.get<ExprAndTemporaries *>(); for (ExprAndTemporaries::temps_iterator i = ET->temps_begin(), e = ET->temps_end(); i != e; ++i) (*i)->Destroy(Context); Context.Deallocate(ET); }
void APNumericStorage::setIntValue(ASTContext &C, const APInt &Val) { if (hasAllocation()) C.Deallocate(pVal); BitWidth = Val.getBitWidth(); unsigned NumWords = Val.getNumWords(); const uint64_t* Words = Val.getRawData(); if (NumWords > 1) { pVal = new (C) uint64_t[NumWords]; std::copy(Words, Words + NumWords, pVal); } else if (NumWords == 1) VAL = Words[0]; else VAL = 0; }
/// setNumArgs - This changes the number of arguments present in this call. /// Any orphaned expressions are deleted by this, and any new operands are set /// to null. void FunctionCall::setNumArgs(ASTContext& C, unsigned NumArgs) { // No change, just return. if (NumArgs == getNumArgs()) return; // If shrinking # arguments, just delete the extras and forgot them. if (NumArgs < getNumArgs()) { this->NumArgs = NumArgs; return; } // Otherwise, we are growing the # arguments. New an bigger argument array. Stmt **NewSubExprs = new (C) Stmt*[NumArgs+1]; // Copy over args. for (unsigned i = 0; i != getNumArgs()+ARGS_START; ++i) NewSubExprs[i] = SubExprs[i]; // Null out new args. for (unsigned i = getNumArgs()+ARGS_START; i != NumArgs+ARGS_START; ++i) NewSubExprs[i] = 0; if (SubExprs) C.Deallocate(SubExprs); SubExprs = NewSubExprs; this->NumArgs = NumArgs; }
void StaticAssertDecl::Destroy(ASTContext& C) { AssertExpr->Destroy(C); Message->Destroy(C); this->~StaticAssertDecl(); C.Deallocate((void *)this); }
void NestedNameSpecifier::Destroy(ASTContext &Context) { this->~NestedNameSpecifier(); Context.Deallocate((void *)this); }
void CXXExprWithTemporaries::Destroy(ASTContext &C) { DestroyChildren(C); this->~CXXExprWithTemporaries(); C.Deallocate(this); }
void DeclStmt::Destroy(ASTContext &C) { this->~DeclStmt(); C.Deallocate((void *)this); }
void CXXBindTemporaryExpr::Destroy(ASTContext &C) { Temp->Destroy(C); this->~CXXBindTemporaryExpr(); C.Deallocate(this); }
void CXXConstructorDecl::Destroy(ASTContext& C) { C.Deallocate(BaseOrMemberInitializers); CXXMethodDecl::Destroy(C); }
void CXXTemporary::Destroy(ASTContext &C) { this->~CXXTemporary(); C.Deallocate(this); }