]> granicus.if.org Git - clang/commitdiff
add actions for deleting expr/stmt nodes.
authorChris Lattner <sabre@nondot.org>
Fri, 31 Aug 2007 04:53:24 +0000 (04:53 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 31 Aug 2007 04:53:24 +0000 (04:53 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41635 91177308-0d34-0410-b5e6-96231b3b80d8

Sema/Sema.cpp
Sema/Sema.h
include/clang/Parse/Action.h

index f783302d5587ae96014eac9af9d10ef6b35be97d..1a012706927bdb839cfc9f32d988b2ec40b74e0f 100644 (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.
 //===----------------------------------------------------------------------===//
index fbf4f53be118e05adeb690ec971c66c47ab082da..046305ef00a2a5d13283f6c4348899281345a153 100644 (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.
   //
index cb1acf5afac81ac7b8d489d6ca7ad183c322c736..bc23b8121ee765c5e45080edf8810ecf1e10b74f 100644 (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.
   //===--------------------------------------------------------------------===//