aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/clang/lib/Frontend/Rewrite/RewriteObjC.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/clang/lib/Frontend/Rewrite/RewriteObjC.cpp')
-rw-r--r--contrib/llvm-project/clang/lib/Frontend/Rewrite/RewriteObjC.cpp47
1 files changed, 26 insertions, 21 deletions
diff --git a/contrib/llvm-project/clang/lib/Frontend/Rewrite/RewriteObjC.cpp b/contrib/llvm-project/clang/lib/Frontend/Rewrite/RewriteObjC.cpp
index 3f320dc57aa6..543b3b09a9cc 100644
--- a/contrib/llvm-project/clang/lib/Frontend/Rewrite/RewriteObjC.cpp
+++ b/contrib/llvm-project/clang/lib/Frontend/Rewrite/RewriteObjC.cpp
@@ -492,7 +492,8 @@ namespace {
CastKind Kind, Expr *E) {
TypeSourceInfo *TInfo = Ctx->getTrivialTypeSourceInfo(Ty, SourceLocation());
return CStyleCastExpr::Create(*Ctx, Ty, VK_RValue, Kind, E, nullptr,
- TInfo, SourceLocation(), SourceLocation());
+ FPOptionsOverride(), TInfo,
+ SourceLocation(), SourceLocation());
}
StringLiteral *getStringLiteral(StringRef Str) {
@@ -630,9 +631,9 @@ void RewriteObjC::InitializeCommon(ASTContext &context) {
// Get the ID and start/end of the main file.
MainFileID = SM->getMainFileID();
- const llvm::MemoryBuffer *MainBuf = SM->getBuffer(MainFileID);
- MainFileStart = MainBuf->getBufferStart();
- MainFileEnd = MainBuf->getBufferEnd();
+ llvm::MemoryBufferRef MainBuf = SM->getBufferOrFake(MainFileID);
+ MainFileStart = MainBuf.getBufferStart();
+ MainFileEnd = MainBuf.getBufferEnd();
Rewrite.setSourceMgr(Context->getSourceManager(), Context->getLangOpts());
}
@@ -2022,13 +2023,14 @@ RewriteObjC::SynthesizeCallToFunctionDecl(FunctionDecl *FD,
// Now, we cast the reference to a pointer to the objc_msgSend type.
QualType pToFunc = Context->getPointerType(msgSendType);
ImplicitCastExpr *ICE =
- ImplicitCastExpr::Create(*Context, pToFunc, CK_FunctionToPointerDecay,
- DRE, nullptr, VK_RValue);
+ ImplicitCastExpr::Create(*Context, pToFunc, CK_FunctionToPointerDecay,
+ DRE, nullptr, VK_RValue, FPOptionsOverride());
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;
}
@@ -2614,8 +2616,9 @@ CallExpr *RewriteObjC::SynthMsgSendStretCallExpr(FunctionDecl *MsgSendStretFlavo
ParenExpr *PE = new (Context) ParenExpr(SourceLocation(), SourceLocation(), cast);
const auto *FT = msgSendType->castAs<FunctionType>();
- CallExpr *STCE = CallExpr::Create(*Context, PE, MsgExprs, FT->getReturnType(),
- VK_RValue, SourceLocation());
+ CallExpr *STCE =
+ CallExpr::Create(*Context, PE, MsgExprs, FT->getReturnType(), VK_RValue,
+ SourceLocation(), FPOptionsOverride());
return STCE;
}
@@ -2707,8 +2710,9 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp,
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
@@ -2802,8 +2806,9 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp,
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
@@ -2968,7 +2973,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp,
const auto *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
@@ -3817,8 +3822,9 @@ Stmt *RewriteObjC::SynthesizeBlockCall(CallExpr *Exp, const Expr *BlockExp) {
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;
}
@@ -4530,7 +4536,7 @@ Stmt *RewriteObjC::SynthBlockInitExpr(BlockExpr *Exp,
InitExprs.push_back(FlagExp);
}
NewRep = CallExpr::Create(*Context, DRE, InitExprs, FType, VK_LValue,
- SourceLocation());
+ SourceLocation(), FPOptionsOverride());
NewRep = UnaryOperator::Create(
const_cast<ASTContext &>(*Context), NewRep, UO_AddrOf,
Context->getPointerType(NewRep->getType()), VK_RValue, OK_Ordinary,
@@ -5279,9 +5285,8 @@ void RewriteObjCFragileABI::RewriteObjCClassMetaData(ObjCImplementationDecl *IDe
}
// Build _objc_ivar_list metadata for classes ivars if needed
- unsigned NumIvars = !IDecl->ivar_empty()
- ? IDecl->ivar_size()
- : (CDecl ? CDecl->ivar_size() : 0);
+ unsigned NumIvars =
+ !IDecl->ivar_empty() ? IDecl->ivar_size() : CDecl->ivar_size();
if (NumIvars > 0) {
static bool objc_ivar = false;
if (!objc_ivar) {