]> granicus.if.org Git - clang/commitdiff
Internally store the body of a BlockExpr using a Stmt* instead of a CompoundStmt...
authorTed Kremenek <kremenek@apple.com>
Fri, 26 Sep 2008 23:24:14 +0000 (23:24 +0000)
committerTed Kremenek <kremenek@apple.com>
Fri, 26 Sep 2008 23:24:14 +0000 (23:24 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56710 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/Expr.h
lib/AST/Expr.cpp

index 9430b51dead893e926c8fe87558ba648c0b2ed2a..a9c1e68012de67046e0a972b53ee7c3d4262a721 100644 (file)
@@ -1492,7 +1492,7 @@ private:
 class BlockExpr : public Expr {
   SourceLocation CaretLocation;
   llvm::SmallVector<ParmVarDecl*, 8> Args;
-  CompoundStmt *Body;
+  Stmt *Body;
 public:
   BlockExpr(SourceLocation caretloc, QualType ty, ParmVarDecl **args, 
             unsigned numargs, CompoundStmt *body) : Expr(BlockExprClass, ty), 
@@ -1503,8 +1503,8 @@ public:
   /// getFunctionType - Return the underlying function type for this block.
   const FunctionType *getFunctionType() const;
 
-  const CompoundStmt *getBody() const { return Body; }
-  CompoundStmt *getBody() { return Body; }
+  const CompoundStmt *getBody() const { return cast<CompoundStmt>(Body); }
+  CompoundStmt *getBody() { return cast<CompoundStmt>(Body); }
 
   virtual SourceRange getSourceRange() const {
     return SourceRange(getCaretLocation(), Body->getLocEnd());
index 456b87b64e01d314f72ddcbfb78584d3962181be..6a4b6b0493d3ba431b52782b46c52f3f772c0a73 100644 (file)
@@ -1460,13 +1460,8 @@ Stmt::child_iterator ObjCMessageExpr::child_end() {
 }
 
 // Blocks
-Stmt::child_iterator BlockExpr::child_begin() {
-  return reinterpret_cast<Stmt**>(&Body);
-}
-Stmt::child_iterator BlockExpr::child_end() {
-  return reinterpret_cast<Stmt**>(&Body)+1;
-}
-
-Stmt::child_iterator BlockDeclRefExpr::child_begin(){return child_iterator();}
-Stmt::child_iterator BlockDeclRefExpr::child_end() { return child_iterator();}
+Stmt::child_iterator BlockExpr::child_begin() { return &Body; }
+Stmt::child_iterator BlockExpr::child_end() { return &Body+1; }
 
+Stmt::child_iterator BlockDeclRefExpr::child_begin() { return child_iterator();}
+Stmt::child_iterator BlockDeclRefExpr::child_end() { return child_iterator(); }