summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Expr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/AST/Expr.cpp')
-rw-r--r--clang/lib/AST/Expr.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index 27ae2b22661..95a6a349f31 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -105,32 +105,43 @@ const char *UnaryOperator::getOpcodeStr(Opcode Op) {
// Postfix Operators.
//===----------------------------------------------------------------------===//
-CallExpr::CallExpr(StmtClass SC, Expr *fn, Expr **args,
+CallExpr::CallExpr(ASTContext& C, StmtClass SC, Expr *fn, Expr **args,
unsigned numargs, QualType t, SourceLocation rparenloc)
: Expr(SC, t,
fn->isTypeDependent() || hasAnyTypeDependentArguments(args, numargs),
fn->isValueDependent() || hasAnyValueDependentArguments(args, numargs)),
NumArgs(numargs) {
- SubExprs = new Stmt*[numargs+1];
+
+ SubExprs = new (C) Stmt*[numargs+1];
SubExprs[FN] = fn;
for (unsigned i = 0; i != numargs; ++i)
SubExprs[i+ARGS_START] = args[i];
+
RParenLoc = rparenloc;
}
-CallExpr::CallExpr(Expr *fn, Expr **args, unsigned numargs, QualType t,
- SourceLocation rparenloc)
+CallExpr::CallExpr(ASTContext& C, Expr *fn, Expr **args, unsigned numargs,
+ QualType t, SourceLocation rparenloc)
: Expr(CallExprClass, t,
fn->isTypeDependent() || hasAnyTypeDependentArguments(args, numargs),
fn->isValueDependent() || hasAnyValueDependentArguments(args, numargs)),
NumArgs(numargs) {
- SubExprs = new Stmt*[numargs+1];
+
+ SubExprs = new (C) Stmt*[numargs+1];
SubExprs[FN] = fn;
for (unsigned i = 0; i != numargs; ++i)
SubExprs[i+ARGS_START] = args[i];
+
RParenLoc = rparenloc;
}
+void CallExpr::Destroy(ASTContext& C) {
+ DestroyChildren(C);
+ if (SubExprs) C.Deallocate(SubExprs);
+ this->~CallExpr();
+ C.Deallocate(this);
+}
+
/// 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.
OpenPOWER on IntegriCloud