Reapply "Add support for #pragma float_control" with buildbot fixes
Add support for #pragma float_control

Reviewers: rjmccall, erichkeane, sepavloff

Differential Revision: https://reviews.llvm.org/D72841

This reverts commit fce82c0ed310174fe48e2402ac731b6340098389.
diff --git a/clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp b/clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp
index c46ba98..bb195ad 100644
--- a/clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp
+++ b/clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp
@@ -2587,9 +2587,10 @@
                                    strType, nullptr, SC_Static);
   DeclRefExpr *DRE = new (Context)
       DeclRefExpr(*Context, NewVD, false, strType, VK_LValue, SourceLocation());
-  Expr *Unop = new (Context)
-      UnaryOperator(DRE, UO_AddrOf, Context->getPointerType(DRE->getType()),
-                    VK_RValue, OK_Ordinary, SourceLocation(), false);
+  Expr *Unop = UnaryOperator::Create(
+      const_cast<ASTContext &>(*Context), DRE, UO_AddrOf,
+      Context->getPointerType(DRE->getType()), VK_RValue, OK_Ordinary,
+      SourceLocation(), false, FPOptions(Context->getLangOpts()));
   // cast to NSConstantString *
   CastExpr *cast = NoTypeInfoCStyleCastExpr(Context, Exp->getType(),
                                             CK_CPointerToObjCPointerCast, Unop);
@@ -3283,10 +3284,10 @@
       // we need the cast below. For example:
       // (struct __rw_objc_super *)&__rw_objc_super((id)self, (id)objc_getClass("SUPER"))
       //
-      SuperRep = new (Context) UnaryOperator(SuperRep, UO_AddrOf,
-                               Context->getPointerType(SuperRep->getType()),
-                                             VK_RValue, OK_Ordinary,
-                                             SourceLocation(), false);
+      SuperRep = UnaryOperator::Create(
+          const_cast<ASTContext &>(*Context), SuperRep, UO_AddrOf,
+          Context->getPointerType(SuperRep->getType()), VK_RValue, OK_Ordinary,
+          SourceLocation(), false, FPOptions(Context->getLangOpts()));
       SuperRep = NoTypeInfoCStyleCastExpr(Context,
                                           Context->getPointerType(superType),
                                           CK_BitCast, SuperRep);
@@ -3301,10 +3302,10 @@
                                                    superType, VK_LValue,
                                                    ILE, false);
       // struct __rw_objc_super *
-      SuperRep = new (Context) UnaryOperator(SuperRep, UO_AddrOf,
-                               Context->getPointerType(SuperRep->getType()),
-                                             VK_RValue, OK_Ordinary,
-                                             SourceLocation(), false);
+      SuperRep = UnaryOperator::Create(
+          const_cast<ASTContext &>(*Context), SuperRep, UO_AddrOf,
+          Context->getPointerType(SuperRep->getType()), VK_RValue, OK_Ordinary,
+          SourceLocation(), false, FPOptions(Context->getLangOpts()));
     }
     MsgExprs.push_back(SuperRep);
     break;
@@ -3378,10 +3379,10 @@
       // we need the cast below. For example:
       // (struct __rw_objc_super *)&__rw_objc_super((id)self, (id)objc_getClass("SUPER"))
       //
-      SuperRep = new (Context) UnaryOperator(SuperRep, UO_AddrOf,
-                               Context->getPointerType(SuperRep->getType()),
-                               VK_RValue, OK_Ordinary,
-                               SourceLocation(), false);
+      SuperRep = UnaryOperator::Create(
+          const_cast<ASTContext &>(*Context), SuperRep, UO_AddrOf,
+          Context->getPointerType(SuperRep->getType()), VK_RValue, OK_Ordinary,
+          SourceLocation(), false, FPOptions(Context->getLangOpts()));
       SuperRep = NoTypeInfoCStyleCastExpr(Context,
                                Context->getPointerType(superType),
                                CK_BitCast, SuperRep);
@@ -4705,9 +4706,10 @@
   if (VarDecl *Var = dyn_cast<VarDecl>(VD))
     if (!ImportedLocalExternalDecls.count(Var))
       return DRE;
-  Expr *Exp = new (Context) UnaryOperator(DRE, UO_Deref, DRE->getType(),
-                                          VK_LValue, OK_Ordinary,
-                                          DRE->getLocation(), false);
+  Expr *Exp = UnaryOperator::Create(const_cast<ASTContext &>(*Context), DRE,
+                                    UO_Deref, DRE->getType(), VK_LValue,
+                                    OK_Ordinary, DRE->getLocation(), false,
+                                    FPOptions(Context->getLangOpts()));
   // Need parens to enforce precedence.
   ParenExpr *PE = new (Context) ParenExpr(SourceLocation(), SourceLocation(),
                                           Exp);
@@ -5293,11 +5295,12 @@
   VarDecl *NewVD = VarDecl::Create(
       *Context, TUDecl, SourceLocation(), SourceLocation(),
       &Context->Idents.get(DescData), Context->VoidPtrTy, nullptr, SC_Static);
-  UnaryOperator *DescRefExpr = new (Context) UnaryOperator(
+  UnaryOperator *DescRefExpr = UnaryOperator::Create(
+      const_cast<ASTContext &>(*Context),
       new (Context) DeclRefExpr(*Context, NewVD, false, Context->VoidPtrTy,
                                 VK_LValue, SourceLocation()),
       UO_AddrOf, Context->getPointerType(Context->VoidPtrTy), VK_RValue,
-      OK_Ordinary, SourceLocation(), false);
+      OK_Ordinary, SourceLocation(), false, FPOptions(Context->getLangOpts()));
   InitExprs.push_back(DescRefExpr);
 
   // Add initializers for any closure decl refs.
@@ -5314,9 +5317,10 @@
         if (HasLocalVariableExternalStorage(*I)) {
           QualType QT = (*I)->getType();
           QT = Context->getPointerType(QT);
-          Exp = new (Context) UnaryOperator(Exp, UO_AddrOf, QT, VK_RValue,
-                                            OK_Ordinary, SourceLocation(),
-                                            false);
+          Exp = UnaryOperator::Create(const_cast<ASTContext &>(*Context), Exp,
+                                      UO_AddrOf, QT, VK_RValue, OK_Ordinary,
+                                      SourceLocation(), false,
+                                      FPOptions(Context->getLangOpts()));
         }
       } else if (isTopLevelBlockPointerType((*I)->getType())) {
         FD = SynthBlockInitFunctionDecl((*I)->getName());
@@ -5331,9 +5335,10 @@
         if (HasLocalVariableExternalStorage(*I)) {
           QualType QT = (*I)->getType();
           QT = Context->getPointerType(QT);
-          Exp = new (Context) UnaryOperator(Exp, UO_AddrOf, QT, VK_RValue,
-                                            OK_Ordinary, SourceLocation(),
-                                            false);
+          Exp = UnaryOperator::Create(const_cast<ASTContext &>(*Context), Exp,
+                                      UO_AddrOf, QT, VK_RValue, OK_Ordinary,
+                                      SourceLocation(), false,
+                                      FPOptions(Context->getLangOpts()));
         }
 
       }
@@ -5371,10 +5376,10 @@
       // captured nested byref variable has its address passed. Do not take
       // its address again.
       if (!isNestedCapturedVar)
-          Exp = new (Context) UnaryOperator(Exp, UO_AddrOf,
-                                     Context->getPointerType(Exp->getType()),
-                                     VK_RValue, OK_Ordinary, SourceLocation(),
-                                     false);
+        Exp = UnaryOperator::Create(
+            const_cast<ASTContext &>(*Context), Exp, UO_AddrOf,
+            Context->getPointerType(Exp->getType()), VK_RValue, OK_Ordinary,
+            SourceLocation(), false, FPOptions(Context->getLangOpts()));
       Exp = NoTypeInfoCStyleCastExpr(Context, castT, CK_BitCast, Exp);
       InitExprs.push_back(Exp);
     }
@@ -5398,9 +5403,10 @@
     NewRep = DRE;
   }
 
-  NewRep = new (Context) UnaryOperator(NewRep, UO_AddrOf,
-                             Context->getPointerType(NewRep->getType()),
-                             VK_RValue, OK_Ordinary, SourceLocation(), false);
+  NewRep = UnaryOperator::Create(
+      const_cast<ASTContext &>(*Context), NewRep, UO_AddrOf,
+      Context->getPointerType(NewRep->getType()), VK_RValue, OK_Ordinary,
+      SourceLocation(), false, FPOptions(Context->getLangOpts()));
   NewRep = NoTypeInfoCStyleCastExpr(Context, FType, CK_BitCast,
                                     NewRep);
   // Put Paren around the call.
@@ -7539,10 +7545,10 @@
                                           CK_BitCast,
                                           PE);
 
-
-      Expr *Exp = new (Context) UnaryOperator(castExpr, UO_Deref, IvarT,
-                                              VK_LValue, OK_Ordinary,
-                                              SourceLocation(), false);
+      Expr *Exp = UnaryOperator::Create(const_cast<ASTContext &>(*Context),
+                                        castExpr, UO_Deref, IvarT, VK_LValue,
+                                        OK_Ordinary, SourceLocation(), false,
+                                        FPOptions(Context->getLangOpts()));
       PE = new (Context) ParenExpr(OldRange.getBegin(),
                                    OldRange.getEnd(),
                                    Exp);