Replace a bunch of static_cast + release with takeAs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70566 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 66b4c9c..5c0c33b 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -1852,7 +1852,7 @@
                                tok::TokenKind OpKind, SourceLocation MemberLoc,
                                IdentifierInfo &Member,
                                DeclPtrTy ObjCImpDecl) {
-  Expr *BaseExpr = static_cast<Expr *>(Base.release());
+  Expr *BaseExpr = Base.takeAs<Expr>();
   assert(BaseExpr && "no record expression");
 
   // Perform default conversions.
@@ -2322,7 +2322,7 @@
                     MultiExprArg args,
                     SourceLocation *CommaLocs, SourceLocation RParenLoc) {
   unsigned NumArgs = args.size();
-  Expr *Fn = static_cast<Expr *>(fn.release());
+  Expr *Fn = fn.takeAs<Expr>();
   Expr **Args = reinterpret_cast<Expr**>(args.release());
   assert(Fn && "no function call expression");
   FunctionDecl *FDecl = NULL;
@@ -2643,7 +2643,7 @@
   assert((Ty != 0) && (Op.get() != 0) &&
          "ActOnCastExpr(): missing type or expr");
 
-  Expr *castExpr = static_cast<Expr*>(Op.release());
+  Expr *castExpr = Op.takeAs<Expr>();
   QualType castType = QualType::getFromOpaquePtr(Ty);
 
   if (CheckCastTypes(SourceRange(LParenLoc, RParenLoc), castType, castExpr))
@@ -4715,8 +4715,8 @@
       // FIXME: C++: Verify that MemberDecl isn't a static field.
       // FIXME: Verify that MemberDecl isn't a bitfield.
       if (cast<RecordDecl>(MemberDecl->getDeclContext())->isAnonymousStructOrUnion()) {
-        Res = static_cast<Expr*>(BuildAnonymousStructUnionMemberReference(
-                SourceLocation(), MemberDecl, Res, SourceLocation()).release());
+        Res = BuildAnonymousStructUnionMemberReference(
+            SourceLocation(), MemberDecl, Res, SourceLocation()).takeAs<Expr>();
       } else {
         // MemberDecl->getType() doesn't get the right qualifiers, but it
         // doesn't matter here.