add actions for deleting expr/stmt nodes.

llvm-svn: 41635
This commit is contained in:
Chris Lattner 2007-08-31 04:53:24 +00:00
parent 9e47ead594
commit 57c523f50c
3 changed files with 16 additions and 0 deletions

View File

@ -38,6 +38,13 @@ Sema::Sema(Preprocessor &pp, ASTContext &ctxt, std::vector<Decl*> &prevInGroup)
KnownFunctionIDs[ id_vprintf ] = &IT.get("vprintf");
}
void Sema::DeleteExpr(ExprTy *E) {
delete static_cast<Expr*>(E);
}
void Sema::DeleteStmt(StmtTy *S) {
delete static_cast<Stmt*>(S);
}
//===----------------------------------------------------------------------===//
// Helper functions.
//===----------------------------------------------------------------------===//

View File

@ -120,6 +120,9 @@ public:
const std::string &Msg1, const std::string &Msg2,
SourceRange R1, SourceRange R2);
virtual void DeleteExpr(ExprTy *E);
virtual void DeleteStmt(StmtTy *S);
//===--------------------------------------------------------------------===//
// Type Analysis / Processing: SemaType.cpp.
//

View File

@ -78,6 +78,12 @@ public:
typedef ActionResult<1> StmtResult;
typedef ActionResult<2> TypeResult;
/// Deletion callbacks - Since the parser doesn't know the concrete types of
/// the AST nodes being generated, it must do callbacks to delete objects when
/// recovering from errors.
virtual void DeleteExpr(ExprTy *E) {}
virtual void DeleteStmt(StmtTy *E) {}
//===--------------------------------------------------------------------===//
// Declaration Tracking Callbacks.
//===--------------------------------------------------------------------===//