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
diff --git a/lib/AST/ExprCXX.cpp b/lib/AST/ExprCXX.cpp
index 323fdd6..6069438 100644
--- a/lib/AST/ExprCXX.cpp
+++ b/lib/AST/ExprCXX.cpp
@@ -20,12 +20,8 @@
 
 
 // CXXCastExpr
-Stmt::child_iterator CXXCastExpr::child_begin() {
-  return reinterpret_cast<Stmt**>(&Op);
-}
-Stmt::child_iterator CXXCastExpr::child_end() {
-  return reinterpret_cast<Stmt**>(&Op)+1;
-}
+Stmt::child_iterator CXXCastExpr::child_begin() { return &Op; }
+Stmt::child_iterator CXXCastExpr::child_end() { return &Op+1; }
 
 // CXXBoolLiteralExpr
 Stmt::child_iterator CXXBoolLiteralExpr::child_begin() { 
@@ -36,14 +32,10 @@
 }
 
 // CXXThrowExpr
-Stmt::child_iterator CXXThrowExpr::child_begin() {
-  return reinterpret_cast<Stmt**>(&Op);
-}
+Stmt::child_iterator CXXThrowExpr::child_begin() { return &Op; }
 Stmt::child_iterator CXXThrowExpr::child_end() {
   // If Op is 0, we are processing throw; which has no children.
-  if (Op == 0)
-    return reinterpret_cast<Stmt**>(&Op)+0;
-  return reinterpret_cast<Stmt**>(&Op)+1;
+  return Op ? &Op+1 : &Op;
 }
 
 // CXXDefaultArgExpr
diff --git a/lib/AST/Stmt.cpp b/lib/AST/Stmt.cpp
index 31433a4..d3f3ff0 100644
--- a/lib/AST/Stmt.cpp
+++ b/lib/AST/Stmt.cpp
@@ -246,11 +246,11 @@
 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_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