diff options
Diffstat (limited to 'lib/Frontend/Rewrite/RewriteModernObjC.cpp')
-rw-r--r-- | lib/Frontend/Rewrite/RewriteModernObjC.cpp | 73 |
1 files changed, 33 insertions, 40 deletions
diff --git a/lib/Frontend/Rewrite/RewriteModernObjC.cpp b/lib/Frontend/Rewrite/RewriteModernObjC.cpp index 10ca9a785699..bd091ee03351 100644 --- a/lib/Frontend/Rewrite/RewriteModernObjC.cpp +++ b/lib/Frontend/Rewrite/RewriteModernObjC.cpp @@ -1,9 +1,8 @@ -//===--- RewriteObjC.cpp - Playground for the code rewriter ---------------===// +//===-- RewriteModernObjC.cpp - Playground for the code rewriter ----------===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // @@ -882,9 +881,8 @@ RewriteModernObjC::getIvarAccessString(ObjCIvarDecl *D) { IvarT, nullptr, /*BitWidth=*/nullptr, /*Mutable=*/true, ICIS_NoInit); - MemberExpr *ME = new (Context) - MemberExpr(PE, true, SourceLocation(), FD, SourceLocation(), - FD->getType(), VK_LValue, OK_Ordinary); + MemberExpr *ME = MemberExpr::CreateImplicit( + *Context, PE, true, FD, FD->getType(), VK_LValue, OK_Ordinary); IvarT = Context->getDecltypeType(ME, ME->getType()); } } @@ -2430,7 +2428,7 @@ void RewriteModernObjC::SynthMsgSendFunctionDecl() { assert(!argT.isNull() && "Can't find 'SEL' type"); ArgTys.push_back(argT); QualType msgSendType = getSimpleFunctionType(Context->getObjCIdType(), - ArgTys, /*isVariadic=*/true); + ArgTys, /*variadic=*/true); MsgSendFunctionDecl = FunctionDecl::Create(*Context, TUDecl, SourceLocation(), SourceLocation(), @@ -2444,7 +2442,7 @@ void RewriteModernObjC::SynthMsgSendSuperFunctionDecl() { SmallVector<QualType, 2> ArgTys; ArgTys.push_back(Context->VoidTy); QualType msgSendType = getSimpleFunctionType(Context->getObjCIdType(), - ArgTys, /*isVariadic=*/true); + ArgTys, /*variadic=*/true); MsgSendSuperFunctionDecl = FunctionDecl::Create(*Context, TUDecl, SourceLocation(), SourceLocation(), @@ -2463,7 +2461,7 @@ void RewriteModernObjC::SynthMsgSendStretFunctionDecl() { assert(!argT.isNull() && "Can't find 'SEL' type"); ArgTys.push_back(argT); QualType msgSendType = getSimpleFunctionType(Context->getObjCIdType(), - ArgTys, /*isVariadic=*/true); + ArgTys, /*variadic=*/true); MsgSendStretFunctionDecl = FunctionDecl::Create(*Context, TUDecl, SourceLocation(), SourceLocation(), @@ -2479,7 +2477,7 @@ void RewriteModernObjC::SynthMsgSendSuperStretFunctionDecl() { SmallVector<QualType, 2> ArgTys; ArgTys.push_back(Context->VoidTy); QualType msgSendType = getSimpleFunctionType(Context->getObjCIdType(), - ArgTys, /*isVariadic=*/true); + ArgTys, /*variadic=*/true); MsgSendSuperStretFunctionDecl = FunctionDecl::Create(*Context, TUDecl, SourceLocation(), SourceLocation(), @@ -2499,7 +2497,7 @@ void RewriteModernObjC::SynthMsgSendFpretFunctionDecl() { assert(!argT.isNull() && "Can't find 'SEL' type"); ArgTys.push_back(argT); QualType msgSendType = getSimpleFunctionType(Context->DoubleTy, - ArgTys, /*isVariadic=*/true); + ArgTys, /*variadic=*/true); MsgSendFpretFunctionDecl = FunctionDecl::Create(*Context, TUDecl, SourceLocation(), SourceLocation(), @@ -2737,9 +2735,9 @@ Stmt *RewriteModernObjC::RewriteObjCArrayLiteralExpr(ObjCArrayLiteral *Exp) { Context->getPointerType(Context->VoidPtrTy), nullptr, /*BitWidth=*/nullptr, /*Mutable=*/true, ICIS_NoInit); - MemberExpr *ArrayLiteralME = new (Context) - MemberExpr(NSArrayCallExpr, false, SourceLocation(), ARRFD, - SourceLocation(), ARRFD->getType(), VK_LValue, OK_Ordinary); + MemberExpr *ArrayLiteralME = + MemberExpr::CreateImplicit(*Context, NSArrayCallExpr, false, ARRFD, + ARRFD->getType(), VK_LValue, OK_Ordinary); QualType ConstIdT = Context->getObjCIdType().withConst(); CStyleCastExpr * ArrayLiteralObjects = NoTypeInfoCStyleCastExpr(Context, @@ -2866,9 +2864,9 @@ Stmt *RewriteModernObjC::RewriteObjCDictionaryLiteralExpr(ObjCDictionaryLiteral Context->getPointerType(Context->VoidPtrTy), nullptr, /*BitWidth=*/nullptr, /*Mutable=*/true, ICIS_NoInit); - MemberExpr *DictLiteralValueME = new (Context) - MemberExpr(NSValueCallExpr, false, SourceLocation(), ARRFD, - SourceLocation(), ARRFD->getType(), VK_LValue, OK_Ordinary); + MemberExpr *DictLiteralValueME = + MemberExpr::CreateImplicit(*Context, NSValueCallExpr, false, ARRFD, + ARRFD->getType(), VK_LValue, OK_Ordinary); QualType ConstIdT = Context->getObjCIdType().withConst(); CStyleCastExpr * DictValueObjects = NoTypeInfoCStyleCastExpr(Context, @@ -2879,9 +2877,9 @@ Stmt *RewriteModernObjC::RewriteObjCDictionaryLiteralExpr(ObjCDictionaryLiteral Expr *NSKeyCallExpr = CallExpr::Create( *Context, NSDictDRE, KeyExprs, NSDictFType, VK_LValue, SourceLocation()); - MemberExpr *DictLiteralKeyME = new (Context) - MemberExpr(NSKeyCallExpr, false, SourceLocation(), ARRFD, - SourceLocation(), ARRFD->getType(), VK_LValue, OK_Ordinary); + MemberExpr *DictLiteralKeyME = + MemberExpr::CreateImplicit(*Context, NSKeyCallExpr, false, ARRFD, + ARRFD->getType(), VK_LValue, OK_Ordinary); CStyleCastExpr * DictKeyObjects = NoTypeInfoCStyleCastExpr(Context, @@ -3181,9 +3179,8 @@ Expr *RewriteModernObjC::SynthMsgSendStretCallExpr(FunctionDecl *MsgSendStretFla returnType, nullptr, /*BitWidth=*/nullptr, /*Mutable=*/true, ICIS_NoInit); - MemberExpr *ME = new (Context) - MemberExpr(STCE, false, SourceLocation(), FieldD, SourceLocation(), - FieldD->getType(), VK_LValue, OK_Ordinary); + MemberExpr *ME = MemberExpr::CreateImplicit( + *Context, STCE, false, FieldD, FieldD->getType(), VK_LValue, OK_Ordinary); return ME; } @@ -4630,9 +4627,8 @@ Stmt *RewriteModernObjC::SynthesizeBlockCall(CallExpr *Exp, const Expr *BlockExp Context->VoidPtrTy, nullptr, /*BitWidth=*/nullptr, /*Mutable=*/true, ICIS_NoInit); - MemberExpr *ME = - new (Context) MemberExpr(PE, true, SourceLocation(), FD, SourceLocation(), - FD->getType(), VK_LValue, OK_Ordinary); + MemberExpr *ME = MemberExpr::CreateImplicit( + *Context, PE, true, FD, FD->getType(), VK_LValue, OK_Ordinary); CastExpr *FunkCast = NoTypeInfoCStyleCastExpr(Context, PtrToFuncCastType, CK_BitCast, ME); @@ -4677,9 +4673,8 @@ Stmt *RewriteModernObjC::RewriteBlockDeclRefExpr(DeclRefExpr *DeclRefExp) { Context->VoidPtrTy, nullptr, /*BitWidth=*/nullptr, /*Mutable=*/true, ICIS_NoInit); - MemberExpr *ME = new (Context) - MemberExpr(DeclRefExp, isArrow, SourceLocation(), FD, SourceLocation(), - FD->getType(), VK_LValue, OK_Ordinary); + MemberExpr *ME = MemberExpr::CreateImplicit( + *Context, DeclRefExp, isArrow, FD, FD->getType(), VK_LValue, OK_Ordinary); StringRef Name = VD->getName(); FD = FieldDecl::Create(*Context, nullptr, SourceLocation(), SourceLocation(), @@ -4687,9 +4682,8 @@ Stmt *RewriteModernObjC::RewriteBlockDeclRefExpr(DeclRefExpr *DeclRefExp) { Context->VoidPtrTy, nullptr, /*BitWidth=*/nullptr, /*Mutable=*/true, ICIS_NoInit); - ME = - new (Context) MemberExpr(ME, true, SourceLocation(), FD, SourceLocation(), - DeclRefExp->getType(), VK_LValue, OK_Ordinary); + ME = MemberExpr::CreateImplicit(*Context, ME, true, FD, DeclRefExp->getType(), + VK_LValue, OK_Ordinary); // Need parens to enforce precedence. ParenExpr *PE = new (Context) ParenExpr(DeclRefExp->getExprLoc(), @@ -7529,9 +7523,8 @@ Stmt *RewriteModernObjC::RewriteObjCIvarRefExpr(ObjCIvarRefExpr *IV) { IvarT, nullptr, /*BitWidth=*/nullptr, /*Mutable=*/true, ICIS_NoInit); - MemberExpr *ME = new (Context) - MemberExpr(PE, true, SourceLocation(), FD, SourceLocation(), - FD->getType(), VK_LValue, OK_Ordinary); + MemberExpr *ME = MemberExpr::CreateImplicit( + *Context, PE, true, FD, FD->getType(), VK_LValue, OK_Ordinary); IvarT = Context->getDecltypeType(ME, ME->getType()); } } @@ -7558,9 +7551,9 @@ Stmt *RewriteModernObjC::RewriteObjCIvarRefExpr(ObjCIvarRefExpr *IV) { D->getType(), nullptr, /*BitWidth=*/D->getBitWidth(), /*Mutable=*/true, ICIS_NoInit); - MemberExpr *ME = new (Context) - MemberExpr(PE, /*isArrow*/ false, SourceLocation(), FD, - SourceLocation(), FD->getType(), VK_LValue, OK_Ordinary); + MemberExpr *ME = + MemberExpr::CreateImplicit(*Context, PE, /*isArrow*/ false, FD, + FD->getType(), VK_LValue, OK_Ordinary); Replacement = ME; } |