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),
/// 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());
}
// 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(); }