Reland D81869 "Modify FPFeatures to use delta not absolute settings"
This reverts commit defd43a5b393bb63a902042adf578081b03b171d.
with correction to solve msan report
To solve https://bugs.llvm.org/show_bug.cgi?id=46166 where the
floating point settings in PCH files aren't compatible, rewrite
FPFeatures to use a delta in the settings rather than absolute settings.
With this patch, these floating point options can be benign.
Reviewers: rjmccall
Differential Revision: https://reviews.llvm.org/D81869
diff --git a/clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp b/clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp
index bb195ad..e122b10 100644
--- a/clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp
+++ b/clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp
@@ -2590,7 +2590,7 @@
Expr *Unop = UnaryOperator::Create(
const_cast<ASTContext &>(*Context), DRE, UO_AddrOf,
Context->getPointerType(DRE->getType()), VK_RValue, OK_Ordinary,
- SourceLocation(), false, FPOptions(Context->getLangOpts()));
+ SourceLocation(), false, FPOptionsOverride());
// cast to NSConstantString *
CastExpr *cast = NoTypeInfoCStyleCastExpr(Context, Exp->getType(),
CK_CPointerToObjCPointerCast, Unop);
@@ -3287,7 +3287,7 @@
SuperRep = UnaryOperator::Create(
const_cast<ASTContext &>(*Context), SuperRep, UO_AddrOf,
Context->getPointerType(SuperRep->getType()), VK_RValue, OK_Ordinary,
- SourceLocation(), false, FPOptions(Context->getLangOpts()));
+ SourceLocation(), false, FPOptionsOverride());
SuperRep = NoTypeInfoCStyleCastExpr(Context,
Context->getPointerType(superType),
CK_BitCast, SuperRep);
@@ -3305,7 +3305,7 @@
SuperRep = UnaryOperator::Create(
const_cast<ASTContext &>(*Context), SuperRep, UO_AddrOf,
Context->getPointerType(SuperRep->getType()), VK_RValue, OK_Ordinary,
- SourceLocation(), false, FPOptions(Context->getLangOpts()));
+ SourceLocation(), false, FPOptionsOverride());
}
MsgExprs.push_back(SuperRep);
break;
@@ -3382,7 +3382,7 @@
SuperRep = UnaryOperator::Create(
const_cast<ASTContext &>(*Context), SuperRep, UO_AddrOf,
Context->getPointerType(SuperRep->getType()), VK_RValue, OK_Ordinary,
- SourceLocation(), false, FPOptions(Context->getLangOpts()));
+ SourceLocation(), false, FPOptionsOverride());
SuperRep = NoTypeInfoCStyleCastExpr(Context,
Context->getPointerType(superType),
CK_BitCast, SuperRep);
@@ -4706,10 +4706,9 @@
if (VarDecl *Var = dyn_cast<VarDecl>(VD))
if (!ImportedLocalExternalDecls.count(Var))
return DRE;
- Expr *Exp = UnaryOperator::Create(const_cast<ASTContext &>(*Context), DRE,
- UO_Deref, DRE->getType(), VK_LValue,
- OK_Ordinary, DRE->getLocation(), false,
- FPOptions(Context->getLangOpts()));
+ Expr *Exp = UnaryOperator::Create(
+ const_cast<ASTContext &>(*Context), DRE, UO_Deref, DRE->getType(),
+ VK_LValue, OK_Ordinary, DRE->getLocation(), false, FPOptionsOverride());
// Need parens to enforce precedence.
ParenExpr *PE = new (Context) ParenExpr(SourceLocation(), SourceLocation(),
Exp);
@@ -5300,7 +5299,7 @@
new (Context) DeclRefExpr(*Context, NewVD, false, Context->VoidPtrTy,
VK_LValue, SourceLocation()),
UO_AddrOf, Context->getPointerType(Context->VoidPtrTy), VK_RValue,
- OK_Ordinary, SourceLocation(), false, FPOptions(Context->getLangOpts()));
+ OK_Ordinary, SourceLocation(), false, FPOptionsOverride());
InitExprs.push_back(DescRefExpr);
// Add initializers for any closure decl refs.
@@ -5317,10 +5316,9 @@
if (HasLocalVariableExternalStorage(*I)) {
QualType QT = (*I)->getType();
QT = Context->getPointerType(QT);
- Exp = UnaryOperator::Create(const_cast<ASTContext &>(*Context), Exp,
- UO_AddrOf, QT, VK_RValue, OK_Ordinary,
- SourceLocation(), false,
- FPOptions(Context->getLangOpts()));
+ Exp = UnaryOperator::Create(
+ const_cast<ASTContext &>(*Context), Exp, UO_AddrOf, QT, VK_RValue,
+ OK_Ordinary, SourceLocation(), false, FPOptionsOverride());
}
} else if (isTopLevelBlockPointerType((*I)->getType())) {
FD = SynthBlockInitFunctionDecl((*I)->getName());
@@ -5335,10 +5333,9 @@
if (HasLocalVariableExternalStorage(*I)) {
QualType QT = (*I)->getType();
QT = Context->getPointerType(QT);
- Exp = UnaryOperator::Create(const_cast<ASTContext &>(*Context), Exp,
- UO_AddrOf, QT, VK_RValue, OK_Ordinary,
- SourceLocation(), false,
- FPOptions(Context->getLangOpts()));
+ Exp = UnaryOperator::Create(
+ const_cast<ASTContext &>(*Context), Exp, UO_AddrOf, QT, VK_RValue,
+ OK_Ordinary, SourceLocation(), false, FPOptionsOverride());
}
}
@@ -5379,7 +5376,7 @@
Exp = UnaryOperator::Create(
const_cast<ASTContext &>(*Context), Exp, UO_AddrOf,
Context->getPointerType(Exp->getType()), VK_RValue, OK_Ordinary,
- SourceLocation(), false, FPOptions(Context->getLangOpts()));
+ SourceLocation(), false, FPOptionsOverride());
Exp = NoTypeInfoCStyleCastExpr(Context, castT, CK_BitCast, Exp);
InitExprs.push_back(Exp);
}
@@ -5406,7 +5403,7 @@
NewRep = UnaryOperator::Create(
const_cast<ASTContext &>(*Context), NewRep, UO_AddrOf,
Context->getPointerType(NewRep->getType()), VK_RValue, OK_Ordinary,
- SourceLocation(), false, FPOptions(Context->getLangOpts()));
+ SourceLocation(), false, FPOptionsOverride());
NewRep = NoTypeInfoCStyleCastExpr(Context, FType, CK_BitCast,
NewRep);
// Put Paren around the call.
@@ -7494,7 +7491,7 @@
BinaryOperator *addExpr = BinaryOperator::Create(
*Context, castExpr, DRE, BO_Add,
Context->getPointerType(Context->CharTy), VK_RValue, OK_Ordinary,
- SourceLocation(), FPOptions(Context->getLangOpts()));
+ SourceLocation(), FPOptionsOverride());
// Don't forget the parens to enforce the proper binding.
ParenExpr *PE = new (Context) ParenExpr(SourceLocation(),
SourceLocation(),
@@ -7545,10 +7542,9 @@
CK_BitCast,
PE);
- Expr *Exp = UnaryOperator::Create(const_cast<ASTContext &>(*Context),
- castExpr, UO_Deref, IvarT, VK_LValue,
- OK_Ordinary, SourceLocation(), false,
- FPOptions(Context->getLangOpts()));
+ Expr *Exp = UnaryOperator::Create(
+ const_cast<ASTContext &>(*Context), castExpr, UO_Deref, IvarT,
+ VK_LValue, OK_Ordinary, SourceLocation(), false, FPOptionsOverride());
PE = new (Context) ParenExpr(OldRange.getBegin(),
OldRange.getEnd(),
Exp);