summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/include/clang/AST/Expr.h6
-rw-r--r--clang/lib/AST/Expr.cpp13
2 files changed, 7 insertions, 12 deletions
diff --git a/clang/include/clang/AST/Expr.h b/clang/include/clang/AST/Expr.h
index 9430b51dead..a9c1e68012d 100644
--- a/clang/include/clang/AST/Expr.h
+++ b/clang/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/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index 456b87b64e0..6a4b6b0493d 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/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(); }
OpenPOWER on IntegriCloud