[AST][FPEnv] Keep FP options in trailing storage of CallExpr
This change allow a CallExpr to have optional FPOptionsOverride object,
stored in trailing storage. The implementaion is made similar to the way
used in BinaryOperator.
Differential Revision: https://reviews.llvm.org/D84343
diff --git a/clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp b/clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp
index e122b10..8c41e71 100644
--- a/clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp
+++ b/clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp
@@ -2109,8 +2109,9 @@
DRE, nullptr, VK_RValue);
const auto *FT = msgSendType->castAs<FunctionType>();
- CallExpr *Exp = CallExpr::Create(
- *Context, ICE, Args, FT->getCallResultType(*Context), VK_RValue, EndLoc);
+ CallExpr *Exp =
+ CallExpr::Create(*Context, ICE, Args, FT->getCallResultType(*Context),
+ VK_RValue, EndLoc, FPOptionsOverride());
return Exp;
}
@@ -2692,7 +2693,7 @@
auto *FT = msgSendType->castAs<FunctionType>();
CallExpr *CE = CallExpr::Create(*Context, PE, MsgExprs, FT->getReturnType(),
- VK_RValue, EndLoc);
+ VK_RValue, EndLoc, FPOptionsOverride());
ReplaceStmt(Exp, CE);
return CE;
}
@@ -2732,7 +2733,7 @@
InitExprs.push_back(Exp->getElement(i));
Expr *NSArrayCallExpr =
CallExpr::Create(*Context, NSArrayDRE, InitExprs, NSArrayFType, VK_LValue,
- SourceLocation());
+ SourceLocation(), FPOptionsOverride());
FieldDecl *ARRFD = FieldDecl::Create(*Context, nullptr, SourceLocation(),
SourceLocation(),
@@ -2813,7 +2814,7 @@
const FunctionType *FT = msgSendType->castAs<FunctionType>();
CallExpr *CE = CallExpr::Create(*Context, PE, MsgExprs, FT->getReturnType(),
- VK_RValue, EndLoc);
+ VK_RValue, EndLoc, FPOptionsOverride());
ReplaceStmt(Exp, CE);
return CE;
}
@@ -2861,7 +2862,7 @@
// (const id [])objects
Expr *NSValueCallExpr =
CallExpr::Create(*Context, NSDictDRE, ValueExprs, NSDictFType, VK_LValue,
- SourceLocation());
+ SourceLocation(), FPOptionsOverride());
FieldDecl *ARRFD = FieldDecl::Create(*Context, nullptr, SourceLocation(),
SourceLocation(),
@@ -2879,8 +2880,9 @@
CK_BitCast,
DictLiteralValueME);
// (const id <NSCopying> [])keys
- Expr *NSKeyCallExpr = CallExpr::Create(
- *Context, NSDictDRE, KeyExprs, NSDictFType, VK_LValue, SourceLocation());
+ Expr *NSKeyCallExpr =
+ CallExpr::Create(*Context, NSDictDRE, KeyExprs, NSDictFType, VK_LValue,
+ SourceLocation(), FPOptionsOverride());
MemberExpr *DictLiteralKeyME =
MemberExpr::CreateImplicit(*Context, NSKeyCallExpr, false, ARRFD,
@@ -2964,7 +2966,7 @@
const FunctionType *FT = msgSendType->castAs<FunctionType>();
CallExpr *CE = CallExpr::Create(*Context, PE, MsgExprs, FT->getReturnType(),
- VK_RValue, EndLoc);
+ VK_RValue, EndLoc, FPOptionsOverride());
ReplaceStmt(Exp, CE);
return CE;
}
@@ -3175,8 +3177,9 @@
ID, FuncType, nullptr, SC_Extern, false, false);
DeclRefExpr *DRE = new (Context)
DeclRefExpr(*Context, FD, false, castType, VK_RValue, SourceLocation());
- CallExpr *STCE = CallExpr::Create(*Context, DRE, MsgExprs, castType,
- VK_LValue, SourceLocation());
+ CallExpr *STCE =
+ CallExpr::Create(*Context, DRE, MsgExprs, castType, VK_LValue,
+ SourceLocation(), FPOptionsOverride());
FieldDecl *FieldD = FieldDecl::Create(*Context, nullptr, SourceLocation(),
SourceLocation(),
@@ -3276,8 +3279,9 @@
DeclRefExpr *DRE = new (Context)
DeclRefExpr(*Context, SuperConstructorFunctionDecl, false, superType,
VK_LValue, SourceLocation());
- SuperRep = CallExpr::Create(*Context, DRE, InitExprs, superType,
- VK_LValue, SourceLocation());
+ SuperRep =
+ CallExpr::Create(*Context, DRE, InitExprs, superType, VK_LValue,
+ SourceLocation(), FPOptionsOverride());
// The code for super is a little tricky to prevent collision with
// the structure definition in the header. The rewriter has it's own
// internal definition (__rw_objc_super) that is uses. This is why
@@ -3371,8 +3375,9 @@
DeclRefExpr *DRE = new (Context)
DeclRefExpr(*Context, SuperConstructorFunctionDecl, false, superType,
VK_LValue, SourceLocation());
- SuperRep = CallExpr::Create(*Context, DRE, InitExprs, superType,
- VK_LValue, SourceLocation());
+ SuperRep =
+ CallExpr::Create(*Context, DRE, InitExprs, superType, VK_LValue,
+ SourceLocation(), FPOptionsOverride());
// The code for super is a little tricky to prevent collision with
// the structure definition in the header. The rewriter has it's own
// internal definition (__rw_objc_super) that is uses. This is why
@@ -3537,7 +3542,7 @@
const FunctionType *FT = msgSendType->castAs<FunctionType>();
CallExpr *CE = CallExpr::Create(*Context, PE, MsgExprs, FT->getReturnType(),
- VK_RValue, EndLoc);
+ VK_RValue, EndLoc, FPOptionsOverride());
Stmt *ReplacingStmt = CE;
if (MsgSendStretFlavor) {
// We have the method which returns a struct/union. Must also generate
@@ -4647,8 +4652,9 @@
E = Exp->arg_end(); I != E; ++I) {
BlkExprs.push_back(*I);
}
- CallExpr *CE = CallExpr::Create(*Context, PE, BlkExprs, Exp->getType(),
- VK_RValue, SourceLocation());
+ CallExpr *CE =
+ CallExpr::Create(*Context, PE, BlkExprs, Exp->getType(), VK_RValue,
+ SourceLocation(), FPOptionsOverride());
return CE;
}
@@ -5391,7 +5397,7 @@
InitExprs.push_back(FlagExp);
}
NewRep = CallExpr::Create(*Context, DRE, InitExprs, FType, VK_LValue,
- SourceLocation());
+ SourceLocation(), FPOptionsOverride());
if (GlobalBlockExpr) {
assert (!GlobalConstructionExp &&