SourceLocation BuiltinLoc;
SourceLocation RParenLoc;
public:
- OverloadExpr(Expr **args, unsigned nexprs, unsigned idx, QualType t,
- SourceLocation bloc, SourceLocation rploc)
+ OverloadExpr(ASTContext& C, Expr **args, unsigned nexprs, unsigned idx,
+ QualType t, SourceLocation bloc, SourceLocation rploc)
: Expr(OverloadExprClass, t), NumExprs(nexprs), FnIndex(idx),
BuiltinLoc(bloc), RParenLoc(rploc) {
- SubExprs = new Stmt*[nexprs];
+ SubExprs = new (C) Stmt*[nexprs];
for (unsigned i = 0; i != nexprs; ++i)
SubExprs[i] = args[i];
}
- ~OverloadExpr() {
- delete [] SubExprs;
- }
+
+ ~OverloadExpr() {}
+
+ void Destroy(ASTContext& C);
/// arg_begin - Return a pointer to the list of arguments that will be passed
/// to the matching candidate function, skipping over the initial constant
Expr::Destroy(C);
}
+void OverloadExpr::Destroy(ASTContext& C) {
+ DestroyChildren(C);
+ C.Deallocate(SubExprs);
+ this->~OverloadExpr();
+ C.Deallocate(this);
+}
+
//===----------------------------------------------------------------------===//
// DesignatedInitExpr
//===----------------------------------------------------------------------===//
// FIXME: Avoid extra allocation.
llvm::SmallVector<Expr*, 4> Exprs(NumExprs);
D.BatchReadOwnedPtrs(NumExprs, Exprs.begin(), C);
- return new OverloadExpr(Exprs.begin(), NumExprs, FnIndex, T, BL, RP);
+ return new OverloadExpr(C, Exprs.begin(), NumExprs, FnIndex, T, BL, RP);
}
void VAArgExpr::EmitImpl(llvm::Serializer& S) const {
<< OE->getFn()->getSourceRange();
// Remember our match, and continue processing the remaining arguments
// to catch any errors.
- OE = new (Context) OverloadExpr(Args, NumArgs, i,
+ OE = new (Context) OverloadExpr(Context, Args, NumArgs, i,
FnType->getResultType().getNonReferenceType(),
BuiltinLoc, RParenLoc);
}