aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/Stmt.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-06-17 03:11:08 +0000
committerTed Kremenek <kremenek@apple.com>2008-06-17 03:11:08 +0000
commit1060aff23f72135f8b50034a1e80f16725ebc56c (patch)
treea54715b51e86ed7132e55d87505bc1b81c4a233a /lib/AST/Stmt.cpp
parentf2f8d6c4718564dab73df3b5aa2d0be21bc6a163 (diff)
Fix more strict-aliasing warnings.
Fix indentation of class declarations in ExprCXX.h git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52380 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Stmt.cpp')
-rw-r--r--lib/AST/Stmt.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/lib/AST/Stmt.cpp b/lib/AST/Stmt.cpp
index 31433a44b6..d3f3ff0e11 100644
--- a/lib/AST/Stmt.cpp
+++ b/lib/AST/Stmt.cpp
@@ -246,11 +246,11 @@ Stmt::child_iterator GotoStmt::child_begin() { return child_iterator(); }
Stmt::child_iterator GotoStmt::child_end() { return child_iterator(); }
// IndirectGotoStmt
-Stmt::child_iterator IndirectGotoStmt::child_begin() {
- return reinterpret_cast<Stmt**>(&Target);
-}
+Expr* IndirectGotoStmt::getTarget() { return cast<Expr>(Target); }
+const Expr* IndirectGotoStmt::getTarget() const { return cast<Expr>(Target); }
-Stmt::child_iterator IndirectGotoStmt::child_end() { return ++child_begin(); }
+Stmt::child_iterator IndirectGotoStmt::child_begin() { return &Target; }
+Stmt::child_iterator IndirectGotoStmt::child_end() { return &Target+1; }
// ContinueStmt
Stmt::child_iterator ContinueStmt::child_begin() { return child_iterator(); }
@@ -261,14 +261,18 @@ Stmt::child_iterator BreakStmt::child_begin() { return child_iterator(); }
Stmt::child_iterator BreakStmt::child_end() { return child_iterator(); }
// ReturnStmt
-Stmt::child_iterator ReturnStmt::child_begin() {
- if (RetExpr) return reinterpret_cast<Stmt**>(&RetExpr);
- else return child_iterator();
+const Expr* ReturnStmt::getRetValue() const {
+ return cast_or_null<Expr>(RetExpr);
+}
+Expr* ReturnStmt::getRetValue() {
+ return cast_or_null<Expr>(RetExpr);
}
-Stmt::child_iterator ReturnStmt::child_end() {
- if (RetExpr) return reinterpret_cast<Stmt**>(&RetExpr)+1;
- else return child_iterator();
+Stmt::child_iterator ReturnStmt::child_begin() {
+ return &RetExpr;
+}
+Stmt::child_iterator ReturnStmt::child_end() {
+ return RetExpr ? &RetExpr+1 : &RetExpr;
}
// AsmStmt