aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clang/AST/Expr.h6
-rw-r--r--lib/AST/Expr.cpp13
2 files changed, 7 insertions, 12 deletions
diff --git a/include/clang/AST/Expr.h b/include/clang/AST/Expr.h
index 9430b51dea..a9c1e68012 100644
--- a/include/clang/AST/Expr.h
+++ b/include/clang/AST/Expr.h
@@ -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());
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp
index 456b87b64e..6a4b6b0493 100644
--- a/lib/AST/Expr.cpp
+++ b/lib/AST/Expr.cpp
@@ -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(); }