24 #include "llvm/ADT/STLExtras.h"
25 #include "llvm/IR/CallSite.h"
26 #include "llvm/IR/DataLayout.h"
27 #include "llvm/IR/InlineAsm.h"
28 using namespace clang;
29 using namespace CodeGen;
43 return llvm::ConstantPointerNull::get(cast<llvm::PointerType>(type));
66 assert(BoxingMethod &&
"BoxingMethod is null");
67 assert(BoxingMethod->
isClassMethod() &&
"BoxingMethod must be a class method");
84 if (ValueType->isObjCBoxableRecordType()) {
110 Args, ClassDecl, BoxingMethod);
121 DLE = cast<ObjCDictionaryLiteral>(E);
124 uint64_t NumElements =
134 llvm::AllocaInst *Objects =
CreateMemTemp(ElementArrayType,
"objects");
135 llvm::AllocaInst *Keys =
nullptr;
142 bool TrackNeededObjects =
147 for (uint64_t i = 0; i < NumElements; i++) {
152 Builder.CreateStructGEP(Objects->getAllocatedType(), Objects, i),
157 if (TrackNeededObjects) {
158 NeededObjects.push_back(value);
164 Builder.CreateStructGEP(Keys->getAllocatedType(), Keys, i),
172 Builder.CreateStructGEP(Objects->getAllocatedType(), Objects, i),
176 if (TrackNeededObjects) {
177 NeededObjects.push_back(keyValue);
178 NeededObjects.push_back(valueValue);
213 Receiver, Args, Class, MethodWithObjects);
219 if (TrackNeededObjects) {
287 if (isa<MemberExpr>(receiver) || isa<ObjCIvarRefExpr>(receiver))
292 if (!declRef)
return true;
294 if (!var)
return true;
299 !var->
hasAttr<ObjCPreciseLifetimeAttr>());
312 llvm_unreachable(
"invalid receiver kind");
333 method->
hasAttr<NSConsumesSelfAttr>());
336 bool isSuperMessage =
false;
337 bool isClassMessage =
false;
348 Receiver = ter.getPointer();
349 if (ter.getInt()) retainSelf =
false;
357 assert(ObjTy &&
"Invalid Objective-C class message send");
359 assert(OID &&
"Invalid Objective-C class message send");
360 Receiver = Runtime.
GetClass(*
this, OID);
361 isClassMessage =
true;
368 isSuperMessage =
true;
374 isSuperMessage =
true;
375 isClassMessage =
true;
386 method->
hasAttr<ObjCReturnsInnerPointerAttr>() &&
402 if (isDelegateInit) {
404 "delegate init calls should only be marked in ARC");
408 LocalDeclMap[cast<ObjCMethodDecl>(
CurCodeDecl)->getSelfDecl()];
409 assert(selfAddr &&
"no self entry for a delegate init call?");
415 if (isSuperMessage) {
418 bool isCategoryImpl = isa<ObjCCategoryImplDecl>(OMD->
getDeclContext());
436 if (isDelegateInit) {
438 LocalDeclMap[cast<ObjCMethodDecl>(
CurCodeDecl)->getSelfDecl()];
445 newSelf =
Builder.CreateBitCast(newSelf, selfTy);
447 Builder.CreateStore(newSelf, selfAddr);
460 if (!iface->getSuperClass())
return;
462 bool isCategory = isa<ObjCCategoryImplDecl>(impl);
489 if (OMD->
hasAttr<NoDebugAttr>())
514 if (ident->
isStr(
"dealloc"))
527 assert(isa<CompoundStmt>(OMD->
getBody()));
536 bool isAtomic,
bool hasStrong) {
541 ivar, 0).getAddress();
577 llvm::Triple::ArchType arch) {
587 class PropertyImplStrategy {
599 SetPropertyAndExpressionGet,
609 StrategyKind
getKind()
const {
return StrategyKind(
Kind); }
611 bool hasStrongMember()
const {
return HasStrong; }
612 bool isAtomic()
const {
return IsAtomic; }
613 bool isCopy()
const {
return IsCopy; }
615 CharUnits getIvarSize()
const {
return IvarSize; }
616 CharUnits getIvarAlignment()
const {
return IvarAlignment; }
623 unsigned IsAtomic : 1;
625 unsigned HasStrong : 1;
633 PropertyImplStrategy::PropertyImplStrategy(
CodeGenModule &CGM,
645 std::tie(IvarSize, IvarAlignment) =
651 Kind = GetSetProperty;
664 }
else if (CGM.
getLangOpts().ObjCAutoRefCount && !IsAtomic) {
674 Kind = SetPropertyAndExpressionGet;
680 }
else if (!IsAtomic) {
681 Kind = SetPropertyAndExpressionGet;
686 Kind = GetSetProperty;
717 HasStrong = recordType->getDecl()->hasObjectMember();
732 if (!IvarSize.isPowerOfTwo()) {
737 llvm::Triple::ArchType arch =
765 llvm::Constant *AtomicHelperFn =
769 assert(OMD &&
"Invalid call to generate getter (empty method)");
779 if (!getter)
return true;
792 return (
construct->getConstructor()->isTrivial());
796 assert(isa<ExprWithCleanups>(getter));
803 llvm::Value *returnAddr,
805 llvm::Constant *AtomicHelperFn) {
814 llvm::Value *ivarAddr =
823 llvm::Value *copyCppAtomicObjectFn =
836 llvm::Constant *AtomicHelperFn) {
839 if (!AtomicHelperFn) {
847 ivar, AtomicHelperFn);
859 PropertyImplStrategy strategy(CGM, propImpl);
860 switch (strategy.getKind()) {
861 case PropertyImplStrategy::Native: {
863 if (strategy.getIvarSize().isZero())
870 llvm::Type *bitcastType =
873 bitcastType = bitcastType->getPointerTo();
877 ivarAddr =
Builder.CreateBitCast(ivarAddr, bitcastType);
878 llvm::LoadInst *load =
Builder.CreateLoad(ivarAddr,
"load");
879 load->setAlignment(strategy.getIvarAlignment().getQuantity());
880 load->setAtomic(llvm::Unordered);
892 case PropertyImplStrategy::GetSetProperty: {
893 llvm::Value *getPropertyFn =
895 if (!getPropertyFn) {
906 llvm::Value *ivarOffset =
918 llvm::Instruction *CallInstruction;
924 if (llvm::CallInst *call = dyn_cast<llvm::CallInst>(CallInstruction))
934 EmitReturnOfRValue(RV, propType);
942 case PropertyImplStrategy::CopyStruct:
944 strategy.hasStrongMember());
947 case PropertyImplStrategy::Expression:
948 case PropertyImplStrategy::SetPropertyAndExpressionGet: {
991 llvm_unreachable(
"bad evaluation kind");
995 llvm_unreachable(
"bad @property implementation strategy!");
1047 llvm::Constant *AtomicHelperFn) {
1053 llvm::Value *ivarAddr =
1070 llvm::Value *copyCppAtomicObjectFn =
1082 if (!setter)
return true;
1092 if (
CallExpr *call = dyn_cast<CallExpr>(setter)) {
1094 = dyn_cast_or_null<FunctionDecl>(call->getCalleeDecl()))
1095 if (callee->isTrivial())
1100 assert(isa<ExprWithCleanups>(setter));
1113 llvm::Constant *AtomicHelperFn) {
1121 if (!AtomicHelperFn)
1131 PropertyImplStrategy strategy(CGM, propImpl);
1132 switch (strategy.getKind()) {
1133 case PropertyImplStrategy::Native: {
1135 if (strategy.getIvarSize().isZero())
1138 llvm::Value *argAddr = LocalDeclMap[*setterMethod->
param_begin()];
1142 llvm::Value *ivarAddr = ivarLValue.
getAddress();
1146 llvm::Type *bitcastType =
1148 getContext().toBits(strategy.getIvarSize()));
1149 bitcastType = bitcastType->getPointerTo();
1152 argAddr =
Builder.CreateBitCast(argAddr, bitcastType);
1153 ivarAddr =
Builder.CreateBitCast(ivarAddr, bitcastType);
1156 llvm::Value *load =
Builder.CreateLoad(argAddr);
1159 llvm::StoreInst *store =
Builder.CreateStore(load, ivarAddr);
1160 store->setAlignment(strategy.getIvarAlignment().getQuantity());
1161 store->setAtomic(llvm::Unordered);
1165 case PropertyImplStrategy::GetSetProperty:
1166 case PropertyImplStrategy::SetPropertyAndExpressionGet: {
1168 llvm::Value *setOptimizedPropertyFn =
nullptr;
1169 llvm::Value *setPropertyFn =
nullptr;
1172 setOptimizedPropertyFn =
1176 if (!setOptimizedPropertyFn) {
1183 if (!setPropertyFn) {
1195 llvm::Value *ivarOffset =
1197 llvm::Value *arg = LocalDeclMap[*setterMethod->
param_begin()];
1203 if (setOptimizedPropertyFn) {
1228 case PropertyImplStrategy::CopyStruct:
1232 case PropertyImplStrategy::Expression:
1245 &selfLoad,
true,
true);
1248 QualType argType = argDecl->getType().getNonReferenceType();
1258 if (ivarRef.getType()->isObjCObjectPointerType()) {
1259 if (argLoad.getType()->isObjCObjectPointerType())
1261 else if (argLoad.getType()->isBlockPointerType())
1265 }
else if (ivarRef.getType()->isBlockPointerType()) {
1266 if (argLoad.getType()->isBlockPointerType())
1270 }
else if (ivarRef.getType()->isPointerType()) {
1274 ivarRef.getType(), argCK, &argLoad,
1276 Expr *finalArg = &argLoad;
1279 finalArg = &argCast;
1294 llvm::Constant *AtomicHelperFn =
1298 assert(OMD &&
"Invalid call to generate setter (empty method)");
1312 bool useEHCleanupForArray;
1314 DestroyIvar(llvm::Value *addr,
const ObjCIvarDecl *ivar,
1316 bool useEHCleanupForArray)
1317 : addr(addr), ivar(ivar), destroyer(destroyer),
1318 useEHCleanupForArray(useEHCleanupForArray) {}
1324 flags.isForNormalCleanup() && useEHCleanupForArray);
1350 if (!dtorKind)
continue;
1366 CGF.
EHStack.pushCleanup<DestroyIvar>(cleanupKind,
self, ivar, destroyer,
1384 for (
const auto *IvarInit : IMP->
inits()) {
1385 FieldDecl *Field = IvarInit->getAnyMember();
1397 llvm::Value *SelfAsId =
1420 return FDTTy->getDecl()->hasObjectMember();
1440 llvm::Constant *EnumerationMutationFn =
1443 if (!EnumerationMutationFn) {
1461 llvm::AllocaInst *StatePtr =
CreateMemTemp(StateTy,
"state.ptr");
1465 static const unsigned NumItems = 16;
1478 llvm::APInt(32, NumItems),
1480 llvm::Value *ItemsPtr =
CreateMemTemp(ItemsTy,
"items.ptr");
1483 llvm::Value *Collection;
1512 llvm::Constant *
Count = llvm::ConstantInt::get(UnsignedLongLTy, NumItems);
1523 llvm::Value *initialBufferLimit = CountRV.
getScalarVal();
1528 llvm::Value *zero = llvm::Constant::getNullValue(UnsignedLongLTy);
1535 Builder.CreateICmpEQ(initialBufferLimit, zero,
"iszero"), EmptyBB,
1545 llvm::Value *StateMutationsPtrPtr =
Builder.CreateStructGEP(
1546 StatePtr->getAllocatedType(), StatePtr, 2,
"mutationsptr.ptr");
1547 llvm::Value *StateMutationsPtr =
Builder.CreateLoad(StateMutationsPtrPtr,
1550 llvm::Value *initialMutations =
1551 Builder.CreateLoad(StateMutationsPtr,
"forcoll.initial-mutations");
1559 llvm::PHINode *index =
Builder.CreatePHI(UnsignedLongLTy, 3,
"forcoll.index");
1560 index->addIncoming(zero, LoopInitBB);
1563 llvm::PHINode *count =
Builder.CreatePHI(UnsignedLongLTy, 3,
"forcoll.count");
1564 count->addIncoming(initialBufferLimit, LoopInitBB);
1571 StateMutationsPtr =
Builder.CreateLoad(StateMutationsPtrPtr,
"mutationsptr");
1572 llvm::Value *currentMutations
1573 =
Builder.CreateLoad(StateMutationsPtr,
"statemutations");
1576 llvm::BasicBlock *WasNotMutatedBB =
createBasicBlock(
"forcoll.notmutated");
1578 Builder.CreateCondBr(
Builder.CreateICmpEQ(currentMutations, initialMutations),
1579 WasNotMutatedBB, WasMutatedBB);
1584 Builder.CreateBitCast(Collection,
1600 bool elementIsVariable;
1607 const VarDecl* D = cast<VarDecl>(SD->getSingleDecl());
1612 elementIsVariable =
true;
1617 elementLValue =
LValue();
1618 elementType = cast<Expr>(S.
getElement())->getType();
1619 elementIsVariable =
false;
1621 llvm::Type *convertedElementType =
ConvertType(elementType);
1626 llvm::Value *StateItemsPtr =
Builder.CreateStructGEP(
1627 StatePtr->getAllocatedType(), StatePtr, 1,
"stateitems.ptr");
1628 llvm::Value *EnumStateItems =
1629 Builder.CreateLoad(StateItemsPtr,
"stateitems");
1632 llvm::Value *CurrentItemPtr =
1633 Builder.CreateGEP(EnumStateItems, index,
"currentitem.ptr");
1634 llvm::Value *CurrentItem =
Builder.CreateLoad(CurrentItemPtr);
1637 CurrentItem =
Builder.CreateBitCast(CurrentItem, convertedElementType,
1642 if (!elementIsVariable) {
1651 if (elementIsVariable)
1655 BreakContinueStack.push_back(BreakContinue(LoopEnd, AfterBody));
1660 BreakContinueStack.pop_back();
1671 llvm::Value *indexPlusOne
1672 =
Builder.CreateAdd(index, llvm::ConstantInt::get(UnsignedLongLTy, 1));
1679 Builder.CreateICmpULT(indexPlusOne, count), LoopBodyBB, FetchMoreBB,
1682 index->addIncoming(indexPlusOne, AfterBody.
getBlock());
1683 count->addIncoming(count, AfterBody.
getBlock());
1698 index->addIncoming(zero,
Builder.GetInsertBlock());
1699 count->addIncoming(refetchCount,
Builder.GetInsertBlock());
1702 EmptyBB, LoopBodyBB);
1707 if (!elementIsVariable) {
1710 llvm::Value *null = llvm::Constant::getNullValue(convertedElementType);
1741 llvm::Value *value) {
1747 CallObjCRelease(llvm::Value *
object) : object(object) {}
1748 llvm::Value *object;
1760 llvm::Value *
object) {
1768 llvm::Value *value) {
1777 llvm::FunctionType *fnType =
1778 llvm::FunctionType::get(CGM.
VoidTy,
None,
true);
1789 llvm::FunctionType *
type,
1793 if (llvm::Function *f = dyn_cast<llvm::Function>(fn)) {
1798 f->setLinkage(llvm::Function::ExternalWeakLinkage);
1799 }
else if (fnName ==
"objc_retain" || fnName ==
"objc_release") {
1802 f->addFnAttr(llvm::Attribute::NonLazyBind);
1814 llvm::Constant *&fn,
1816 bool isTailCall =
false) {
1817 if (isa<llvm::ConstantPointerNull>(value))
return value;
1820 llvm::FunctionType *fnType =
1826 llvm::Type *origType = value->getType();
1832 call->setTailCall();
1835 return CGF.
Builder.CreateBitCast(call, origType);
1842 llvm::Constant *&fn,
1845 llvm::FunctionType *fnType =
1851 llvm::Type *origType = addr->getType();
1859 result = CGF.
Builder.CreateBitCast(result,
1870 llvm::Constant *&fn,
1873 assert(cast<llvm::PointerType>(addr->getType())->
getElementType()
1874 == value->getType());
1879 llvm::FunctionType *fnType
1880 = llvm::FunctionType::get(CGF.
Int8PtrTy, argTypes,
false);
1884 llvm::Type *origType = value->getType();
1886 llvm::Value *args[] = {
1892 if (ignored)
return nullptr;
1894 return CGF.
Builder.CreateBitCast(result, origType);
1902 llvm::Constant *&fn,
1904 assert(dst->getType() == src->getType());
1909 llvm::FunctionType *fnType
1910 = llvm::FunctionType::get(CGF.
Builder.getVoidTy(), argTypes,
false);
1914 llvm::Value *args[] = {
1950 "objc_retainBlock");
1956 if (!mandatory && isa<llvm::Instruction>(result)) {
1957 llvm::CallInst *call
1958 = cast<llvm::CallInst>(result->stripPointerCasts());
1961 call->setMetadata(
"clang.arc.copy_on_escape",
1977 llvm::InlineAsm *&marker
1985 if (assembly.empty()) {
1990 llvm::FunctionType *
type =
1991 llvm::FunctionType::get(
VoidTy,
false);
1993 marker = llvm::InlineAsm::get(type, assembly,
"",
true);
1999 llvm::NamedMDNode *metadata =
2000 CGM.
getModule().getOrInsertNamedMetadata(
2001 "clang.arc.retainAutoreleasedReturnValueMarker");
2002 assert(metadata->getNumOperands() <= 1);
2003 if (metadata->getNumOperands() == 0) {
2004 metadata->addOperand(llvm::MDNode::get(
2016 "objc_retainAutoreleasedReturnValue");
2023 if (isa<llvm::ConstantPointerNull>(value))
return;
2027 llvm::FunctionType *fnType =
2039 call->setMetadata(
"clang.imprecise_release",
2056 llvm::PointerType *addrTy = cast<llvm::PointerType>(addr->getType());
2057 llvm::Value *null = llvm::ConstantPointerNull::get(
2058 cast<llvm::PointerType>(addrTy->getElementType()));
2063 llvm::Value *value =
Builder.CreateLoad(addr);
2072 assert(cast<llvm::PointerType>(addr->getType())->
getElementType()
2073 == value->getType());
2078 llvm::FunctionType *fnType
2079 = llvm::FunctionType::get(
Builder.getVoidTy(), argTypes,
false);
2083 llvm::Value *args[] = {
2089 if (ignored)
return nullptr;
2097 llvm::Value *newValue,
2134 "objc_autorelease");
2143 "objc_autoreleaseReturnValue",
2153 "objc_retainAutoreleaseReturnValue",
2163 llvm::Value *value) {
2167 if (isa<llvm::ConstantPointerNull>(value))
return value;
2169 llvm::Type *origType = value->getType();
2173 return Builder.CreateBitCast(value, origType);
2182 "objc_retainAutorelease");
2197 "objc_loadWeakRetained");
2207 "objc_storeWeak", ignored);
2219 if (isa<llvm::ConstantPointerNull>(value) &&
2221 Builder.CreateStore(value, addr);
2227 "objc_initWeak",
true);
2235 llvm::FunctionType *fnType =
2269 llvm::FunctionType *fnType =
2270 llvm::FunctionType::get(
Int8PtrTy,
false);
2284 llvm::FunctionType *fnType =
2311 AllocSel, Receiver, Args);
2320 InitSel, Receiver, Args);
2356 CallObjCAutoreleasePoolObject(llvm::Value *token) :
Token(token) {}
2365 CallObjCMRRAutoreleasePoolObject(llvm::Value *token) :
Token(token) {}
2397 llvm_unreachable(
"impossible lifetime!");
2430 isa<BinaryOperator>(e) &&
2431 cast<BinaryOperator>(e)->getOpcode() ==
BO_Assign)
2438 llvm::Value *value);
2448 llvm::Value *value) {
2449 if (llvm::CallInst *call = dyn_cast<llvm::CallInst>(value)) {
2450 CGBuilderTy::InsertPoint ip = CGF.
Builder.saveIP();
2453 CGF.
Builder.SetInsertPoint(call->getParent(),
2454 ++llvm::BasicBlock::iterator(call));
2459 }
else if (llvm::InvokeInst *invoke = dyn_cast<llvm::InvokeInst>(value)) {
2460 CGBuilderTy::InsertPoint ip = CGF.
Builder.saveIP();
2463 llvm::BasicBlock *BB = invoke->getNormalDest();
2464 CGF.
Builder.SetInsertPoint(BB, BB->begin());
2472 }
else if (llvm::BitCastInst *bitcast = dyn_cast<llvm::BitCastInst>(value)) {
2473 llvm::Value *operand = bitcast->getOperand(0);
2475 bitcast->setOperand(0, operand);
2495 if (isa<BlockExpr>(e))
2498 if (
const CastExpr *cast = dyn_cast<CastExpr>(e)) {
2499 switch (cast->getCastKind()) {
2536 const Expr *semantic = *i;
2540 if (
const OpaqueValueExpr *ov = dyn_cast<OpaqueValueExpr>(semantic)) {
2546 if (ov == resultExpr) {
2547 assert(!OVMA::shouldBindAsLValue(ov));
2549 opaqueData = OVMA::bind(CGF, ov,
RValue::get(result.getPointer()));
2553 opaqueData = OVMA::bind(CGF, ov, ov->getSourceExpr());
2555 opaques.push_back(opaqueData);
2559 }
else if (semantic == resultExpr) {
2569 for (
unsigned i = 0, e = opaques.size(); i != e; ++i)
2570 opaques[i].unbind(CGF);
2580 assert(!isa<ExprWithCleanups>(e));
2584 llvm::Type *resultType =
nullptr;
2591 if (
const CastExpr *ce = dyn_cast<CastExpr>(e)) {
2592 switch (ce->getCastKind()) {
2595 e = ce->getSubExpr();
2602 llvm::Value *value = loadResult.getPointer();
2603 value = CGF.
Builder.CreateBitCast(value, resultType);
2604 loadResult.setPointer(value);
2618 e = ce->getSubExpr();
2626 if (resultType) result = CGF.
Builder.CreateBitCast(result, resultType);
2634 llvm::Value *result;
2645 result = subresult.getPointer();
2649 if (subresult.getInt()) {
2651 result = CGF.
Builder.CreateBitCast(result, resultType);
2660 if (resultType) result = CGF.
Builder.CreateBitCast(result, resultType);
2668 if (resultType) result = CGF.
Builder.CreateBitCast(result, resultType);
2677 }
else if (
const UnaryOperator *op = dyn_cast<UnaryOperator>(e)) {
2679 e = op->getSubExpr();
2687 }
else if (isa<CallExpr>(e) ||
2688 (isa<ObjCMessageExpr>(e) &&
2689 !cast<ObjCMessageExpr>(e)->isDelegateInitCall())) {
2691 if (resultType) result = CGF.
Builder.CreateBitCast(result, resultType);
2695 }
else if (
const PseudoObjectExpr *pseudo = dyn_cast<PseudoObjectExpr>(e)) {
2699 llvm::Value *value = result.getPointer();
2700 value = CGF.
Builder.CreateBitCast(value, resultType);
2701 result.setPointer(value);
2713 if (resultType) result = CGF.
Builder.CreateBitCast(result, resultType);
2721 llvm::Value *value = result.getPointer();
2722 if (!result.getInt())
2740 llvm::Value *value = result.getPointer();
2741 if (!result.getInt())
2756 llvm::Value *value = result.getPointer();
2757 if (result.getInt())
2765 llvm::Value *result;
2773 result = subresult.getPointer();
2774 doRetain = !subresult.getInt();
2798 std::pair<LValue,llvm::Value*>
2803 llvm::Value *value = result.getPointer();
2805 bool hasImmediateRetain = result.getInt();
2812 hasImmediateRetain =
true;
2818 if (hasImmediateRetain) {
2826 return std::pair<LValue,llvm::Value*>(lvalue, value);
2829 std::pair<LValue,llvm::Value*>
2836 return std::pair<LValue,llvm::Value*>(lvalue, value);
2858 for (
const auto *I : S.
body())
2869 llvm::FunctionType *extenderType
2871 llvm::Value *extender
2872 = llvm::InlineAsm::get(extenderType,
2897 llvm::Constant *HelperFn =
nullptr;
2922 args.push_back(&dstDecl);
2924 args.push_back(&srcDecl);
2931 llvm::Function *Fn =
2933 "__assign_helper_atomic_property_",
2948 Expr *Args[2] = { &DST, &SRC };
2951 Args, DestTy->getPointeeType(),
2957 HelperFn = llvm::ConstantExpr::getBitCast(Fn,
VoidPtrTy);
2974 llvm::Constant *HelperFn =
nullptr;
3001 args.push_back(&dstDecl);
3003 args.push_back(&srcDecl);
3010 llvm::Function *Fn =
3012 "__copy_helper_atomic_property_", &CGM.
getModule());
3026 ConstructorArgs.push_back(&SRC);
3027 ConstructorArgs.append(std::next(CXXConstExpr->arg_begin()),
3028 CXXConstExpr->arg_end());
3032 CXXConstExpr->getConstructor(),
3033 CXXConstExpr->isElidable(),
3035 CXXConstExpr->hadMultipleCandidates(),
3036 CXXConstExpr->isListInitialization(),
3037 CXXConstExpr->isStdInitListInitialization(),
3038 CXXConstExpr->requiresZeroInitialization(),
3039 CXXConstExpr->getConstructionKind(),
3055 HelperFn = llvm::ConstantExpr::getBitCast(Fn,
VoidPtrTy);
3072 llvm::Value *Val = Block;
3079 Ty, AutoreleaseSelector,
llvm::PointerType * Int8PtrPtrTy
A call to an overloaded operator written using operator syntax.
The receiver is the instance of the superclass object.
param_const_iterator param_begin() const
static bool UseOptimizedSetter(CodeGenModule &CGM)
Defines the clang::ASTContext interface.
bool isAtomic() const
isAtomic - Return true if the property is atomic.
llvm::Constant * objc_loadWeak
id objc_loadWeak(id*);
CastKind getCastKind() const
llvm::Value * EmitARCStoreStrong(LValue lvalue, llvm::Value *value, bool resultIgnored)
const internal::VariadicDynCastAllOfMatcher< Stmt, Expr > expr
Matches expressions.
The receiver is an object instance.
Smart pointer class that efficiently represents Objective-C method names.
llvm::Value * EmitARCRetainAutoreleaseScalarExpr(const Expr *expr)
static bool hasTrivialGetExpr(const ObjCPropertyImplDecl *propImpl)
void EmitARCMoveWeak(llvm::Value *dst, llvm::Value *src)
Destroyer * getDestroyer(QualType::DestructionKind destructionKind)
static bool hasUnalignedAtomics(llvm::Triple::ArchType arch)
void EmitExtendGCLifetime(llvm::Value *object)
CodeGenTypes & getTypes()
llvm::Value * EmitARCExtendBlockObject(const Expr *expr)
ObjCInterfaceDecl * getClassInterface()
bool isBitField() const
Determines whether this field is a bitfield.
DestructionKind isDestructedType() const
virtual llvm::Function * GenerateMethod(const ObjCMethodDecl *OMD, const ObjCContainerDecl *CD)=0
llvm::Module & getModule() const
QualType getClassReceiver() const
Returns the type of a class message send, or NULL if the message is not a class message.
bool isDelegateInitCall() const
ARCEntrypoints & getARCEntrypoints() const
static AggValueSlot forLValue(const LValue &LV, IsDestructed_t isDestructed, NeedsGCBarriers_t needsGC, IsAliased_t isAliased, IsZeroed_t isZeroed=IsNotZeroed)
static CXXConstructExpr * Create(const ASTContext &C, QualType T, SourceLocation Loc, CXXConstructorDecl *D, bool Elidable, ArrayRef< Expr * > Args, bool HadMultipleCandidates, bool ListInitialization, bool StdInitListInitialization, bool ZeroInitialization, ConstructionKind ConstructKind, SourceRange ParenOrBraceRange)
virtual CodeGen::RValue GenerateMessageSend(CodeGen::CodeGenFunction &CGF, ReturnValueSlot ReturnSlot, QualType ResultType, Selector Sel, llvm::Value *Receiver, const CallArgList &CallArgs, const ObjCInterfaceDecl *Class=nullptr, const ObjCMethodDecl *Method=nullptr)=0
void EmitLexicalBlockEnd(CGBuilderTy &Builder, SourceLocation Loc)
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
llvm::Value * EmitARCLoadWeak(llvm::Value *addr)
llvm::Constant * objc_autoreleaseReturnValue
id objc_autoreleaseReturnValue(id);
Implements runtime-specific code generation functions.
void addConst()
addConst - add the specified type qualifier to this QualType.
static RValue AdjustObjCObjectType(CodeGenFunction &CGF, QualType ET, RValue Result)
Adjust the type of an Objective-C object that doesn't match up due to type erasure at various points...
bool isRecordType() const
llvm::Constant * objc_copyWeak
void objc_copyWeak(id *dest, id *src);
const Decl * CurCodeDecl
CurCodeDecl - This is the inner-most code context, which includes blocks.
static Destroyer destroyARCStrongPrecise
Represents Objective-C's @throw statement.
void EmitStoreThroughLValue(RValue Src, LValue Dst, bool isInit=false)
void GenerateObjCSetter(ObjCImplementationDecl *IMP, const ObjCPropertyImplDecl *PID)
Generate an Objective-C property setter function.
const ObjCObjectType * getObjectType() const
Represents a call to a C++ constructor.
llvm::Constant * objc_retainBlock
id objc_retainBlock(id);
llvm::Value * EmitObjCMRRAutoreleasePoolPush()
llvm::Constant * GenerateObjCAtomicSetterCopyHelperFunction(const ObjCPropertyImplDecl *PID)
const LangOptions & getLangOpts() const
bool isBlockPointerType() const
llvm::Value * EmitARCRetainNonBlock(llvm::Value *value)
static llvm::Value * emitARCRetainLoadOfScalar(CodeGenFunction &CGF, LValue lvalue, QualType type)
[ARC] Consumes a retainable object pointer that has just been produced, e.g. as the return value of a...
const CGFunctionInfo & arrangeFreeFunctionDeclaration(QualType ResTy, const FunctionArgList &Args, const FunctionType::ExtInfo &Info, bool isVariadic)
void createImplicitParams(ASTContext &Context, const ObjCInterfaceDecl *ID)
llvm::Value * getAddress() const
static Destroyer destroyARCWeak
ObjCDictionaryElement getKeyValueElement(unsigned Index) const
Expr * getSetterCXXAssignment() const
const Expr * getCallee() const
ObjCLifetime getObjCLifetime() const
llvm::Constant * objc_retainAutoreleasedReturnValue
id objc_retainAutoreleasedReturnValue(id);
SourceLocation getLocStart() const LLVM_READONLY
uint64_t getProfileCount(const Stmt *S)
Get the profiler's count for the given statement.
llvm::Value * EmitObjCAutoreleasePoolPush()
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
static llvm::Constant * getNullForVariable(llvm::Value *addr)
static llvm::Value * emitARCLoadOperation(CodeGenFunction &CGF, llvm::Value *addr, llvm::Constant *&fn, StringRef fnName)
llvm::Value * EmitBlockCopyAndAutorelease(llvm::Value *Block, QualType Ty)
bool shouldUseFusedARCCalls()
llvm::Constant * getAtomicSetterHelperFnMap(QualType Ty)
llvm::Value * ReturnValue
Defines the Objective-C statement AST node classes.
ParmVarDecl - Represents a parameter to a function.
bool isObjCRetainableType() const
llvm::Value * EmitObjCDictionaryLiteral(const ObjCDictionaryLiteral *E)
const ArgInfo * const_arg_iterator
virtual llvm::Constant * GetOptimizedPropertySetFunction(bool atomic, bool copy)=0
Return the runtime function for optimized setting properties.
llvm::Value * EmitObjCThrowOperand(const Expr *expr)
llvm::Constant * getAtomicGetterHelperFnMap(QualType Ty)
static void destroyARCStrongWithStore(CodeGenFunction &CGF, llvm::Value *addr, QualType type)
Like CodeGenFunction::destroyARCStrong, but do it with a call.
ObjCProtocolDecl * getProtocol() const
void EmitCallArgs(CallArgList &Args, const T *CallArgTypeInfo, CallExpr::const_arg_iterator ArgBeg, CallExpr::const_arg_iterator ArgEnd, const FunctionDecl *CalleeDecl=nullptr, unsigned ParamsToSkip=0)
EmitCallArgs - Emit call arguments for a function.
static void emitStructGetterCall(CodeGenFunction &CGF, ObjCIvarDecl *ivar, bool isAtomic, bool hasStrong)
CGDebugInfo * getDebugInfo()
llvm::Type * ConvertType(QualType T)
ConvertType - Convert type T into a llvm::Type.
IdentifierInfo * getIdentifierInfoForSlot(unsigned argIndex) const
Retrieve the identifier at a given position in the selector.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
std::pair< LValue, llvm::Value * > EmitARCStoreAutoreleasing(const BinaryOperator *e)
llvm::Value * EmitObjCExtendObjectLifetime(QualType T, llvm::Value *Ptr)
llvm::Constant * objc_storeStrong
id objc_storeStrong(id*, id);
bool isReferenceType() const
llvm::Value * EmitARCRetainAutoreleaseReturnValue(llvm::Value *value)
ImplicitParamDecl * getCmdDecl() const
StringLiteral * getString()
void EmitARCInitWeak(llvm::Value *value, llvm::Value *addr)
llvm::Value * EmitObjCProduceObject(QualType T, llvm::Value *Ptr)
[ARC] Causes a value of block type to be copied to the heap, if it is not already there...
llvm::Value * EmitARCAutoreleaseReturnValue(llvm::Value *value)
void GenerateObjCCtorDtorMethod(ObjCImplementationDecl *IMP, ObjCMethodDecl *MD, bool ctor)
SourceLocation getLBracLoc() const
virtual llvm::Constant * GetPropertySetFunction()=0
Return the runtime function for setting properties.
CleanupKind getCleanupKind(QualType::DestructionKind kind)
i32 captured_struct **param SharedsTy A type which contains references the shared variables *param Shareds Context with the list of shared variables from the p *TaskFunction *param IfCond Not a nullptr if if clause was nullptr *otherwise *param PrivateVars List of references to private variables for the task *directive *param PrivateCopies List of private copies for each private variable in *p PrivateVars *param FirstprivateVars List of references to private variables for the *task directive *param FirstprivateCopies List of private copies for each private variable *in p FirstprivateVars *param FirstprivateInits List of references to auto generated variables *used for initialization of a single array element Used if firstprivate *variable is of array type *param Dependences List of dependences for the task construct
llvm::Value * EmitObjCBoxedExpr(const ObjCBoxedExpr *E)
llvm::Constant * objc_destroyWeak
void objc_destroyWeak(id*);
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
RREntrypoints & getRREntrypoints() const
An r-value expression (a pr-value in the C++11 taxonomy) produces a temporary value.
ComplexPairTy EmitLoadOfComplex(LValue src, SourceLocation loc)
EmitLoadOfComplex - Load a complex number from the specified l-value.
const Expr *const * const_semantics_iterator
void EmitARCDestroyStrong(llvm::Value *addr, ARCPreciseLifetime_t precise)
virtual CodeGen::RValue GenerateMessageSendSuper(CodeGen::CodeGenFunction &CGF, ReturnValueSlot ReturnSlot, QualType ResultType, Selector Sel, const ObjCInterfaceDecl *Class, bool isCategoryImpl, llvm::Value *Self, bool IsClassMessage, const CallArgList &CallArgs, const ObjCMethodDecl *Method=nullptr)=0
RValue EmitAnyExpr(const Expr *E, AggValueSlot aggSlot=AggValueSlot::ignored(), bool ignoreResult=false)
bool hasOptimizedSetter() const
Does this runtime supports optimized setter entrypoints?
llvm::Value * EmitObjCStringLiteral(const ObjCStringLiteral *E)
Emits an instance of NSConstantString representing the object.
void Destroyer(CodeGenFunction &CGF, llvm::Value *addr, QualType ty)
Selector getNullarySelector(IdentifierInfo *ID)
ObjCMethodDecl * getBoxingMethod() const
RValue EmitCall(const CGFunctionInfo &FnInfo, llvm::Value *Callee, ReturnValueSlot ReturnValue, const CallArgList &Args, const Decl *TargetDecl=nullptr, llvm::Instruction **callOrInvoke=nullptr)
CharUnits getAlignment() const
llvm::Constant * objc_loadWeakRetained
id objc_loadWeakRetained(id*);
bool IvarTypeWithAggrGCObjects(QualType Ty)
const Qualifiers & getQuals() const
bool hasNativeARC() const
Does this runtime natively provide the ARC entrypoints?
QualType getSuperType() const
Retrieve the type referred to by 'super'.
llvm::GlobalVariable * GetAddrOfConstantCString(const std::string &Str, const char *GlobalName=nullptr, unsigned Alignment=0)
llvm::PointerType * VoidPtrTy
semantics_iterator semantics_end()
A builtin binary operation expression such as "x + y" or "x <= y".
Selector getSelector() const
Expr * getGetterCXXConstructor() const
ObjCInterfaceDecl * getInterface() const
void setAtomicGetterHelperFnMap(QualType Ty, llvm::Constant *Fn)
static OMPLinearClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, ArrayRef< Expr * > IL, Expr *Step, Expr *CalcStep)
Creates clause with a list of variables VL and a linear step Step.
void incrementProfileCounter(const Stmt *S)
Increment the profiler's counter for the given statement.
void EmitStmt(const Stmt *S)
llvm::BasicBlock * createBasicBlock(const Twine &name="", llvm::Function *parent=nullptr, llvm::BasicBlock *before=nullptr)
createBasicBlock - Create an LLVM basic block.
llvm::Value * EmitARCRetainScalarExpr(const Expr *expr)
void EmitIgnoredExpr(const Expr *E)
EmitIgnoredExpr - Emit an expression in a context which ignores the result.
static bool shouldEmitSeparateBlockRetain(const Expr *e)
static llvm::Value * emitARCRetainAfterCall(CodeGenFunction &CGF, llvm::Value *value)
static TryEmitResult tryEmitARCRetainPseudoObject(CodeGenFunction &CGF, const PseudoObjectExpr *E)
bool requiresCleanups() const
Determine whether this scope requires any cleanups.
Expr * Key
The key for the dictionary element.
virtual llvm::Constant * GetGetStructFunction()=0
GlobalDecl CurGD
CurGD - The GlobalDecl for the current function being compiled.
CharUnits getTypeSizeInChars(QualType T) const
Return the size of the specified (complete) type T, in characters.
An ordinary object is located at an address in memory.
uint64_t getCurrentProfileCount()
Represents an ObjC class declaration.
SourceLocation getLocEnd() const LLVM_READONLY
PropertyAttributeKind getPropertyAttributes() const
static TryEmitResult tryEmitARCRetainScalarExpr(CodeGenFunction &CGF, const Expr *e)
std::pair< CharUnits, CharUnits > getTypeInfoInChars(const Type *T) const
llvm::Value * EmitARCRetainAutoreleasedReturnValue(llvm::Value *value)
static FunctionDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation NLoc, DeclarationName N, QualType T, TypeSourceInfo *TInfo, StorageClass SC, bool isInlineSpecified=false, bool hasWrittenPrototype=true, bool isConstexprSpecified=false)
llvm::Value * EmitARCRetainAutoreleaseNonBlock(llvm::Value *value)
virtual StringRef getARCRetainAutoreleasedReturnValueMarker() const
llvm::CallSite EmitRuntimeCallOrInvoke(llvm::Value *callee, ArrayRef< llvm::Value * > args, const Twine &name="")
Emits a call or invoke instruction to the given runtime function.
RValue EmitObjCMessageExpr(const ObjCMessageExpr *E, ReturnValueSlot Return=ReturnValueSlot())
const ParmVarDecl *const * param_const_iterator
llvm::Constant * objc_release
void objc_release(id);
AutoVarEmission EmitAutoVarAlloca(const VarDecl &var)
std::pair< llvm::Value *, llvm::Value * > ComplexPairTy
llvm::CallInst * EmitNounwindRuntimeCall(llvm::Value *callee, const Twine &name="")
void emitDestroy(llvm::Value *addr, QualType type, Destroyer *destroyer, bool useEHCleanupForArray)
const TargetCodeGenInfo & getTargetCodeGenInfo()
Qualifiers::ObjCLifetime getObjCLifetime() const
getObjCLifetime - Returns lifetime attribute of this type.
const TargetInfo & getTarget() const
CastKind
CastKind - The kind of operation required for a conversion.
void getObjCEncodingForType(QualType T, std::string &S, const FieldDecl *Field=nullptr, QualType *NotEncodedT=nullptr) const
Emit the Objective-CC type encoding for the given type T into S.
CleanupKind getARCCleanupKind()
static AutoVarEmission invalid()
SourceLocation getBodyRBrace() const
QualType getPointeeType() const
bool isUnarySelector() const
const ObjCMethodDecl * getMethodDecl() const
static TypeEvaluationKind getEvaluationKind(QualType T)
CGObjCRuntime & getObjCRuntime()
Return a reference to the configured Objective-C runtime.
static bool shouldExtendReceiverForInnerPointerMessage(const ObjCMessageExpr *message)
llvm::Value * EmitARCStoreWeak(llvm::Value *value, llvm::Value *addr, bool ignored)
llvm::Value * EmitARCLoadWeakRetained(llvm::Value *addr)
i8* @objc_loadWeakRetained(i8** addr)
virtual llvm::Constant * GetSetStructFunction()=0
void EmitAutoVarInit(const AutoVarEmission &emission)
Enters a new scope for capturing cleanups, all of which will be executed once the scope is exited...
SetterKind getSetterKind() const
void GenerateObjCMethod(const ObjCMethodDecl *OMD)
ObjCIvarDecl * getPropertyIvarDecl() const
static void emitStructSetterCall(CodeGenFunction &CGF, ObjCMethodDecl *OMD, ObjCIvarDecl *ivar)
void SetInternalFunctionAttributes(const Decl *D, llvm::Function *F, const CGFunctionInfo &FI)
virtual void EmitThrowStmt(CodeGen::CodeGenFunction &CGF, const ObjCAtThrowStmt &S, bool ClearInsertionPoint=true)=0
llvm::Constant * objc_moveWeak
void objc_moveWeak(id *dest, id *src);
TranslationUnitDecl * getTranslationUnitDecl() const
DeclContext * getDeclContext()
ASTContext & getContext() const
llvm::BasicBlock * getBlock() const
Represents Objective-C's @synchronized statement.
ObjCSelectorExpr used for @selector in Objective-C.
llvm::Value * EmitCompoundStmtWithoutScope(const CompoundStmt &S, bool GetLast=false, AggValueSlot AVS=AggValueSlot::ignored())
static CharUnits fromQuantity(QuantityType Quantity)
fromQuantity - Construct a CharUnits quantity from a raw integer type.
void generateObjCSetterBody(const ObjCImplementationDecl *classImpl, const ObjCPropertyImplDecl *propImpl, llvm::Constant *AtomicHelperFn)
ImplicitParamDecl * getSelfDecl() const
void add(RValue rvalue, QualType type, bool needscopy=false)
virtual void EmitTryStmt(CodeGen::CodeGenFunction &CGF, const ObjCAtTryStmt &S)=0
llvm::Value * EmitARCAutorelease(llvm::Value *value)
Selector getSelector() const
llvm::LLVMContext & getLLVMContext()
unsigned getNumElements() const
getNumElements - Return number of elements of objective-c array literal.
Expr * getElement(unsigned Index)
getExpr - Return the Expr at the specified index.
bool isInstanceMethod() const
clang::ObjCRuntime ObjCRuntime
virtual llvm::Constant * GetPropertyGetFunction()=0
Return the runtime function for getting properties.
QualType getObjCIdType() const
Represents the Objective-CC id type.
LValue MakeNaturalAlignAddrLValue(llvm::Value *V, QualType T)
An expression that sends a message to the given Objective-C object or class.
The result type of a method or function.
ARCPreciseLifetime_t isARCPreciseLifetime() const
static llvm::Value * emitARCStoreOperation(CodeGenFunction &CGF, llvm::Value *addr, llvm::Value *value, llvm::Constant *&fn, StringRef fnName, bool ignored)
llvm::Constant * objc_retainAutoreleaseReturnValue
id objc_retainAutoreleaseReturnValue(id);
param_const_iterator param_end() const
void EmitAnyExprToMem(const Expr *E, llvm::Value *Location, Qualifiers Quals, bool IsInitializer)
virtual void EmitSynchronizedStmt(CodeGen::CodeGenFunction &CGF, const ObjCAtSynchronizedStmt &S)=0
bool isClassMethod() const
ArrayRef< ParmVarDecl * > parameters() const
llvm::Constant * objc_autoreleasePoolPush
void *objc_autoreleasePoolPush(void);
There is no lifetime qualification on this type.
CharUnits getTypeAlignInChars(QualType T) const
Return the ABI-specified alignment of a (complete) type T, in characters.
SelectorTable & Selectors
llvm::Constant * CreateRuntimeFunction(llvm::FunctionType *Ty, StringRef Name, llvm::AttributeSet ExtraAttrs=llvm::AttributeSet())
Create a new runtime function with the specified type and name.
ASTContext & getContext() const
Encodes a location in the source. The SourceManager can decode this to get at the full include stack...
llvm::Value * EmitObjCArrayLiteral(const ObjCArrayLiteral *E)
void EmitARCIntrinsicUse(ArrayRef< llvm::Value * > values)
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
static void emitCPPObjectAtomicGetterCall(CodeGenFunction &CGF, llvm::Value *returnAddr, ObjCIvarDecl *ivar, llvm::Constant *AtomicHelperFn)
const Type * getTypePtr() const
void EmitARCRelease(llvm::Value *value, ARCPreciseLifetime_t precise)
LValue EmitDeclRefLValue(const DeclRefExpr *E)
void EmitAggregateCopy(llvm::Value *DestPtr, llvm::Value *SrcPtr, QualType EltTy, bool isVolatile=false, CharUnits Alignment=CharUnits::Zero(), bool isAssignment=false)
llvm::Constant * objc_retain
id objc_retain(id);
bool IndirectObjCSetterArg(const CGFunctionInfo &FI)
void EmitObjCForCollectionStmt(const ObjCForCollectionStmt &S)
Stmt * getBody() const override
Retrieve the body of this method, if it has one.
QualType withConst() const
static TryEmitResult tryEmitARCRetainLoadOfScalar(CodeGenFunction &CGF, LValue lvalue, QualType type)
const CGFunctionInfo & arrangeObjCMethodDeclaration(const ObjCMethodDecl *MD)
void EmitARCCopyWeak(llvm::Value *dst, llvm::Value *src)
virtual llvm::Value * EmitNSAutoreleasePoolClassRef(CodeGenFunction &CGF)
void EmitNullInitialization(llvm::Value *DestPtr, QualType Ty)
const ObjCInterfaceDecl * getClassInterface() const
llvm::InlineAsm * retainAutoreleasedReturnValueMarker
virtual llvm::Value * GenerateProtocolRef(CodeGenFunction &CGF, const ObjCProtocolDecl *OPD)=0
static llvm::Constant * createARCRuntimeFunction(CodeGenModule &CGM, llvm::FunctionType *type, StringRef fnName)
const CodeGenOptions & getCodeGenOpts() const
llvm::Constant * objc_autoreleasePoolPop
void objc_autoreleasePoolPop(void*);
static LValue MakeAddr(llvm::Value *address, QualType type, CharUnits alignment, ASTContext &Context, llvm::MDNode *TBAAInfo=nullptr)
void StartFunction(GlobalDecl GD, QualType RetTy, llvm::Function *Fn, const CGFunctionInfo &FnInfo, const FunctionArgList &Args, SourceLocation Loc=SourceLocation(), SourceLocation StartLoc=SourceLocation())
Emit code for the start of a function.
const LangOptions & getLangOpts() const
Represents one property declaration in an Objective-C interface.
llvm::AllocaInst * CreateMemTemp(QualType T, const Twine &Name="tmp")
QualType getReturnType() const
JumpDest getJumpDestInCurrentScope(llvm::BasicBlock *Target)
Assigning into this object requires a lifetime extension.
llvm::Constant * objc_initWeak
id objc_initWeak(id*, id);
static void emitARCCopyOperation(CodeGenFunction &CGF, llvm::Value *dst, llvm::Value *src, llvm::Constant *&fn, StringRef fnName)
bool isVolatileQualified() const
Determine whether this type is volatile-qualified.
virtual llvm::Constant * GetCppAtomicObjectGetFunction()=0
llvm::Value * EmitARCRetain(QualType type, llvm::Value *value)
void enterFullExpression(const ExprWithCleanups *E)
static Destroyer destroyARCStrongImprecise
void FinishFunction(SourceLocation EndLoc=SourceLocation())
Expr * Value
The value of the dictionary element.
void EmitARCDestroyWeak(llvm::Value *addr)
void EmitObjCMRRAutoreleasePoolPop(llvm::Value *Ptr)
llvm::Value * EmitScalarExpr(const Expr *E, bool IgnoreResultAssign=false)
Expr * getInstanceReceiver()
Returns the object expression (receiver) for an instance message, or null for a message that is not a...
ObjCIvarDecl * getNextIvar()
bool isStr(const char(&Str)[StrLen]) const
Return true if this is the identifier for the specified string.
Expr * getResultExpr()
Return the result-bearing expression, or null if there is none.
void EmitObjCAtSynchronizedStmt(const ObjCAtSynchronizedStmt &S)
void ErrorUnsupported(const Stmt *S, const char *Type)
Print out an error that codegen doesn't support the specified stmt yet.
static const Type * getElementType(const Expr *BaseExpr)
llvm::Constant * objc_autorelease
id objc_autorelease(id);
static llvm::Value * emitARCValueOperation(CodeGenFunction &CGF, llvm::Value *value, llvm::Constant *&fn, StringRef fnName, bool isTailCall=false)
void GenerateObjCGetter(ObjCImplementationDecl *IMP, const ObjCPropertyImplDecl *PID)
GenerateObjCGetter - Synthesize an Objective-C property getter function.
bool isZero() const
isZero - Test whether the quantity equals zero.
unsigned char PointerAlignInBytes
void EmitObjCAutoreleasePoolPop(llvm::Value *Ptr)
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
The basic abstraction for the target Objective-C runtime.
llvm::Value * getScalarVal() const
getScalarVal() - Return the Value* of this scalar value.
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
llvm::Constant * objc_retainAutorelease
id objc_retainAutorelease(id);
QualType TypeOfSelfObject()
TypeOfSelfObject - Return type of object that this self represents.
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
Selector getSelector() const
ObjCMethodDecl * getArrayWithObjectsMethod() const
semantics_iterator semantics_begin()
llvm::Constant * GenerateObjCAtomicGetterCopyHelperFunction(const ObjCPropertyImplDecl *PID)
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
static bool hasTrivialSetExpr(const ObjCPropertyImplDecl *PID)
void EmitObjCAtThrowStmt(const ObjCAtThrowStmt &S)
static CharUnits getMaxAtomicAccessSize(CodeGenModule &CGM, llvm::Triple::ArchType arch)
void EmitStoreOfScalar(llvm::Value *Value, llvm::Value *Addr, bool Volatile, unsigned Alignment, QualType Ty, llvm::MDNode *TBAAInfo=nullptr, bool isInit=false, QualType TBAABaseTy=QualType(), uint64_t TBAAOffset=0)
void EmitAggExpr(const Expr *E, AggValueSlot AS)
ObjCMethodDecl * getDictWithObjectsMethod() const
[ARC] Reclaim a retainable object pointer object that may have been produced and autoreleased as part...
Defines the Diagnostic-related interfaces.
QualType getPointeeType() const
QualType getNonReferenceType() const
void EmitAutoVarCleanups(const AutoVarEmission &emission)
ObjCMethodDecl * getGetterMethodDecl() const
virtual llvm::Constant * EnumerationMutationFunction()=0
QualType getCanonicalType() const
const Stmt * getSubStmt() const
Represents Objective-C's collection statement.
void EmitStoreOfComplex(ComplexPairTy V, LValue dest, bool isInit)
EmitStoreOfComplex - Store a complex number into the specified l-value.
ObjCMethodDecl * getSetterMethodDecl() const
Selector getSelector(unsigned NumArgs, IdentifierInfo **IIV)
Can create any sort of selector.
[ARC] Produces a retainable object pointer so that it may be consumed, e.g. by being passed to a cons...
llvm::PointerType * Int8PtrTy
LValue EmitLValueForIvar(QualType ObjectTy, llvm::Value *Base, const ObjCIvarDecl *Ivar, unsigned CVRQualifiers)
void EmitScalarInit(const Expr *init, const ValueDecl *D, LValue lvalue, bool capturedByInit)
llvm::Value * EmitIvarOffset(const ObjCInterfaceDecl *Interface, const ObjCIvarDecl *Ivar)
llvm::Value * EmitARCRetainAutorelease(QualType type, llvm::Value *value)
Internal linkage, which indicates that the entity can be referred to from within the translation unit...
void EmitBlock(llvm::BasicBlock *BB, bool IsFinished=false)
void setAtomicSetterHelperFnMap(QualType Ty, llvm::Constant *Fn)
ARCPreciseLifetime_t
Does an ARC strong l-value have precise lifetime?
virtual llvm::Constant * GenerateConstantString(const StringLiteral *)=0
Generate a constant string object.
ObjCIvarRefExpr - A reference to an ObjC instance variable.
llvm::ConstantInt * getSize(CharUnits numChars)
Emit the given number of characters as a value of type size_t.
virtual llvm::Value * GetClass(CodeGenFunction &CGF, const ObjCInterfaceDecl *OID)=0
bool hasNonTrivialObjCLifetime() const
ObjCPropertyDecl * getPropertyDecl() const
Reading or writing from this object requires a barrier call.
bool hasAtomicCopyHelper() const
void EmitLexicalBlockStart(CGBuilderTy &Builder, SourceLocation Loc)
bool isARCPseudoStrong() const
Determine whether this variable is an ARC pseudo-__strong variable. A pseudo-__strong variable has a ...
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
llvm::Value * EmitObjCCollectionLiteral(const Expr *E, const ObjCMethodDecl *MethodWithObjects)
void EmitReturnStmt(const ReturnStmt &S)
llvm::Type * ConvertType(QualType T)
LValue EmitLValue(const Expr *E)
Represents Objective-C's @try ... @catch ... @finally statement.
bool AutoreleaseResult
In ARC, whether we should autorelease the return value.
RValue EmitLoadOfLValue(LValue V, SourceLocation Loc)
llvm::Value * EmitARCRetainBlock(llvm::Value *value, bool mandatory)
llvm::Value * EmitARCStoreStrongCall(llvm::Value *addr, llvm::Value *value, bool resultIgnored)
llvm::Constant * clang_arc_use
void clang.arc.use(...);
void generateObjCGetterBody(const ObjCImplementationDecl *classImpl, const ObjCPropertyImplDecl *propImpl, const ObjCMethodDecl *GetterMothodDecl, llvm::Constant *AtomicHelperFn)
void ForceCleanup()
Force the emission of cleanups now, instead of waiting until this object is destroyed.
llvm::Constant * objc_storeWeak
id objc_storeWeak(id*, id);
const_arg_iterator arg_begin() const
void StartObjCMethod(const ObjCMethodDecl *MD, const ObjCContainerDecl *CD)
virtual llvm::Value * GetSelector(CodeGenFunction &CGF, Selector Sel, bool lval=false)=0
SourceLocation getRBracLoc() const
static Decl::Kind getKind(const Decl *D)
virtual llvm::Constant * GetCppAtomicObjectSetFunction()=0
QualType getObjCFastEnumerationStateType()
Retrieve the record type that describes the state of an Objective-C fast enumeration loop (for...
void EmitObjCAutoreleasePoolCleanup(llvm::Value *Ptr)
A reference to a declared variable, function, enum, etc. [C99 6.5.1p2].
static RValue get(llvm::Value *V)
QualType getConstantArrayType(QualType EltTy, const llvm::APInt &ArySize, ArrayType::ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return the unique reference to the type for a constant array of the specified element type...
static llvm::Value * emitARCRetainCall(CodeGenFunction &CGF, const Expr *e)
llvm::Value * EmitLoadOfScalar(llvm::Value *Addr, bool Volatile, unsigned Alignment, QualType Ty, SourceLocation Loc, llvm::MDNode *TBAAInfo=nullptr, QualType TBAABaseTy=QualType(), uint64_t TBAAOffset=0)
const CGFunctionInfo & arrangeFreeFunctionCall(const CallArgList &Args, const FunctionType *Ty, bool ChainCall)
static AggValueSlot forAddr(llvm::Value *addr, CharUnits align, Qualifiers quals, IsDestructed_t isDestructed, NeedsGCBarriers_t needsGC, IsAliased_t isAliased, IsZeroed_t isZeroed=IsNotZeroed)
llvm::Value * LoadObjCSelf()
Qualifiers::GC getObjCGCAttrKind(QualType Ty) const
Return one of the GCNone, Weak or Strong Objective-C garbage collection attributes.
An l-value expression is a reference to an object with independent storage.
CodeGenTypes & getTypes() const
A trivial tuple used to represent a source range.
SourceLocation getLocation() const
void EmitObjCAtTryStmt(const ObjCAtTryStmt &S)
ObjCIvarDecl * all_declared_ivar_begin()
llvm::Value * EmitObjCConsumeObject(QualType T, llvm::Value *Ptr)
llvm::PointerIntPair< llvm::Value *, 1, bool > TryEmitResult
bool isConstQualified() const
Determine whether this type is const-qualified.
void assignRegionCounters(const Decl *D, llvm::Function *Fn)
The receiver is a superclass.
const ObjCObjectPointerType * getAsObjCInterfacePointerType() const
void EmitObjCAutoreleasePoolStmt(const ObjCAutoreleasePoolStmt &S)
void PopCleanupBlock(bool FallThroughIsBranchThrough=false)
ReceiverKind getReceiverKind() const
Determine the kind of receiver that this message is being sent to.
Represents Objective-C's @autoreleasepool Statement.
unsigned getNumElements() const
bool hasPointerRepresentation() const
bool hasLocalStorage() const
Expr * IgnoreParens() LLVM_READONLY
static void emitCPPObjectAtomicSetterCall(CodeGenFunction &CGF, ObjCMethodDecl *OMD, ObjCIvarDecl *ivar, llvm::Constant *AtomicHelperFn)
llvm::Value * EmitObjCSelectorExpr(const ObjCSelectorExpr *E)
Emit a selector.
static void emitCXXDestructMethod(CodeGenFunction &CGF, ObjCImplementationDecl *impl)
unsigned char PointerSizeInBytes
llvm::Value * EmitObjCProtocolExpr(const ObjCProtocolExpr *E)
llvm::FunctionType * GetFunctionType(const CGFunctionInfo &Info)
GetFunctionType - Get the LLVM function type for.