28#include "llvm/Analysis/ObjCARCUtil.h"
29#include "llvm/BinaryFormat/MachO.h"
30#include "llvm/IR/Constants.h"
31#include "llvm/IR/DataLayout.h"
32#include "llvm/IR/InlineAsm.h"
55 CGM.getObjCRuntime().GenerateConstantString(E->
getString()).getPointer();
84 assert(BoxingMethod->
isClassMethod() &&
"BoxingMethod must be a class method");
92 llvm::Value *Receiver = Runtime.
GetClass(*
this, ClassDecl);
101 if (ValueType->isObjCBoxableRecordType()) {
106 llvm::Value *BitCast =
Builder.CreateBitCast(
113 llvm::Constant *GV =
CGM.GetAddrOfConstantCString(Str).getPointer();
127 Args, ClassDecl, BoxingMethod);
140 const bool CanBeExpressedAsConstant =
143 if (CanBeExpressedAsConstant) {
152 if (NumElements == 0 &&
CGM.getLangOpts().ObjCRuntime.hasEmptyCollections()) {
153 StringRef ConstantName = ALE ?
"__NSArray0__" :
"__NSDictionary0__";
155 llvm::Constant *Constant =
160 llvm::LLVMContext::MD_invariant_load,
166 llvm::APInt APNumElements(Context.getTypeSize(Context.getSizeType()),
169 QualType ElementArrayType = Context.getConstantArrayType(
182 bool TrackNeededObjects =
184 CGM.getCodeGenOpts().OptimizationLevel != 0);
187 for (uint64_t i = 0; i < NumElements; i++) {
196 if (TrackNeededObjects) {
197 NeededObjects.push_back(value);
213 if (TrackNeededObjects) {
214 NeededObjects.push_back(keyValue);
215 NeededObjects.push_back(valueValue);
234 llvm::ConstantInt::get(
CGM.getTypes().ConvertType(ArgQT), NumElements);
242 assert(InterfacePointerType &&
"Unexpected InterfacePointerType - null");
251 Receiver, Args,
Class, MethodWithObjects);
257 if (TrackNeededObjects) {
285 return CGM.getObjCRuntime().GenerateProtocolRef(*
this, E->
getProtocol());
298 if (ExpLLVMTy ==
Result.getScalarVal()->getType())
318 if (
auto opaque = dyn_cast<OpaqueValueExpr>(receiver)) {
319 if (opaque->getSourceExpr())
324 if (!ice || ice->
getCastKind() != CK_LValueToRValue)
return true;
328 if (
auto opaque = dyn_cast<OpaqueValueExpr>(receiver)) {
329 if (opaque->getSourceExpr())
343 if (!declRef)
return true;
345 if (!var)
return true;
349 return (var->hasLocalStorage() &&
350 !var->hasAttr<ObjCPreciseLifetimeAttr>());
363 llvm_unreachable(
"invalid receiver kind");
371 if (
auto CE = dyn_cast<CastExpr>(E)) {
372 if (CE->getCastKind() == CK_LValueToRValue) {
374 return CE->getSubExpr();
398 bool isClassMessage) {
400 if (!CGM.getCodeGenOpts().ObjCConvertMessagesToRuntimeCalls)
406 if (isClassMessage &&
407 Runtime.shouldUseRuntimeFunctionsForAlloc() &&
416 Args.size() == 1 && Args.front().getType()->isPointerType() &&
418 const llvm::Value* arg = Args.front().getKnownRValue().getScalarVal();
430 Runtime.shouldUseARCFunctionsForRetainRelease())
437 Runtime.shouldUseARCFunctionsForRetainRelease())
444 Runtime.shouldUseARCFunctionsForRetainRelease()) {
460 bool isClassMessage) {
461 if (std::optional<llvm::Value *> SpecializedResult =
463 Sel,
Method, isClassMessage)) {
472 llvm::UniqueVector<const ObjCProtocolDecl *> &PDs) {
479 for (
const auto *ParentPD : PD->
protocols())
483std::vector<const ObjCProtocolDecl *>
486 std::vector<const ObjCProtocolDecl *> RuntimePds;
487 llvm::DenseSet<const ObjCProtocolDecl *> NonRuntimePDs;
489 for (; begin != end; ++begin) {
490 const auto *It = *begin;
491 const auto *Can = It->getCanonicalDecl();
492 if (Can->isNonRuntimeProtocol())
493 NonRuntimePDs.insert(Can);
495 RuntimePds.push_back(Can);
499 if (NonRuntimePDs.empty())
506 llvm::UniqueVector<const ObjCProtocolDecl *> FirstImpliedProtos;
507 for (
const auto *PD : NonRuntimePDs)
512 llvm::DenseSet<const ObjCProtocolDecl *> AllImpliedProtocols;
513 for (
const auto *PD : RuntimePds) {
514 const auto *Can = PD->getCanonicalDecl();
515 AllImpliedProtocols.insert(Can);
516 Can->getImpliedProtocols(AllImpliedProtocols);
522 for (
const auto *PD : FirstImpliedProtos) {
523 PD->getImpliedProtocols(AllImpliedProtocols);
530 for (
const auto *PD : FirstImpliedProtos) {
531 if (!AllImpliedProtocols.contains(PD)) {
532 RuntimePds.push_back(PD);
542static std::optional<llvm::Value *>
545 if (!Runtime.shouldUseRuntimeFunctionForCombinedAllocInit())
561 Selector SubSel = SubOME->getSelector();
563 if (!SubOME->getType()->isObjCObjectPointerType() ||
567 llvm::Value *Receiver =
nullptr;
568 switch (SubOME->getReceiverKind()) {
570 if (!SubOME->getInstanceReceiver()->getType()->isObjCClassType())
576 QualType ReceiverType = SubOME->getClassReceiver();
579 assert(ID &&
"null interface should be impossible here");
621 CGM.getLangOpts().ObjCAutoRefCount &&
623 method->
hasAttr<NSConsumesSelfAttr>());
626 bool isSuperMessage =
false;
627 bool isClassMessage =
false;
631 llvm::Value *Receiver =
nullptr;
639 Receiver = ter.getPointer();
640 if (ter.getInt()) retainSelf =
false;
648 assert(OID &&
"Invalid Objective-C class message send");
649 Receiver = Runtime.
GetClass(*
this, OID);
650 isClassMessage =
true;
657 isSuperMessage =
true;
663 isSuperMessage =
true;
664 isClassMessage =
true;
675 method->
hasAttr<ObjCReturnsInnerPointerAttr>() &&
691 if (isDelegateInit) {
693 "delegate init calls should only be marked in ARC");
702 if (isSuperMessage) {
717 *
this, Return, ResultType, E->
getSelector(), Receiver, Args, OID,
718 method, isClassMessage);
723 if (isDelegateInit) {
731 newSelf =
Builder.CreateBitCast(newSelf, selfTy);
733 Builder.CreateStore(newSelf, selfAddr);
740struct FinishARCDealloc final : EHScopeStack::Cleanup {
775 if (OMD->
hasAttr<NoDebugAttr>())
778 llvm::Function *Fn =
CGM.getObjCRuntime().GenerateMethod(OMD, CD);
783 Fn->setVisibility(llvm::Function::HiddenVisibility);
784 if (
CGM.isObjCDirectPreconditionThunkEnabled()) {
793 Fn->setVisibility(
CGM.GetLLVMVisibility(*
V));
796 CGM.SetLLVMFunctionAttributes(OMD, FI, Fn,
false);
797 CGM.SetLLVMFunctionAttributesForDefinition(OMD, Fn);
799 CGM.SetInternalFunctionAttributes(OMD, Fn, FI);
815 CGM.getObjCRuntime().GenerateDirectMethodPrologue(*
this, Fn, OMD, CD);
819 if (
CGM.getLangOpts().ObjCAutoRefCount &&
824 if (ident->
isStr(
"dealloc"))
846 bool isAtomic,
bool hasStrong) {
884 llvm::Triple::ArchType arch) {
894 class PropertyImplStrategy {
906 SetPropertyAndExpressionGet,
916 StrategyKind
getKind()
const {
return StrategyKind(Kind); }
918 bool hasStrongMember()
const {
return HasStrong; }
919 bool isAtomic()
const {
return IsAtomic; }
920 bool isCopy()
const {
return IsCopy; }
922 CharUnits getIvarSize()
const {
return IvarSize; }
923 CharUnits getIvarAlignment()
const {
return IvarAlignment; }
925 PropertyImplStrategy(CodeGenModule &CGM,
926 const ObjCPropertyImplDecl *propImpl);
929 LLVM_PREFERRED_TYPE(StrategyKind)
931 LLVM_PREFERRED_TYPE(
bool)
932 unsigned IsAtomic : 1;
933 LLVM_PREFERRED_TYPE(
bool)
935 LLVM_PREFERRED_TYPE(
bool)
936 unsigned HasStrong : 1;
939 CharUnits IvarAlignment;
944PropertyImplStrategy::PropertyImplStrategy(
CodeGenModule &CGM,
945 const ObjCPropertyImplDecl *propImpl) {
955 QualType ivarType = ivar->
getType();
957 IvarSize = TInfo.
Width;
958 IvarAlignment = TInfo.Align;
964 Kind = IsAtomic ? GetSetProperty : SetPropertyAndExpressionGet;
977 }
else if (CGM.
getLangOpts().ObjCAutoRefCount && !IsAtomic) {
987 Kind = SetPropertyAndExpressionGet;
993 }
else if (!IsAtomic) {
994 Kind = SetPropertyAndExpressionGet;
999 Kind = GetSetProperty;
1030 HasStrong = RD->hasObjectMember();
1045 if (!IvarSize.isPowerOfTwo()) {
1050 llvm::Triple::ArchType arch =
1078 llvm::Constant *AtomicHelperFn =
1079 CodeGenFunction(
CGM).GenerateObjCAtomicGetterCopyHelperFunction(PID);
1081 assert(OMD &&
"Invalid call to generate getter (empty method)");
1091 if (!getter)
return true;
1103 if (
const CXXConstructExpr *construct = dyn_cast<CXXConstructExpr>(getter))
1104 return (construct->getConstructor()->isTrivial());
1115 llvm::Value *returnAddr,
1117 llvm::Constant *AtomicHelperFn) {
1126 llvm::Value *ivarAddr =
1134 llvm::FunctionCallee copyCppAtomicObjectFn =
1155 return llvm::PoisonValue::get(selType);
1165 llvm::Constant *AtomicHelperFn) {
1170 if (!AtomicHelperFn) {
1178 ivar, AtomicHelperFn);
1185 if (!AtomicHelperFn) {
1194 ivar, AtomicHelperFn);
1204 PropertyImplStrategy strategy(
CGM, propImpl);
1205 switch (strategy.getKind()) {
1206 case PropertyImplStrategy::Native: {
1208 if (strategy.getIvarSize().isZero())
1216 llvm::Type *bitcastType = llvm::Type::getIntNTy(
getLLVMContext(), ivarSize);
1221 llvm::LoadInst *load =
Builder.CreateLoad(ivarAddr,
"load");
1222 load->setAtomic(llvm::AtomicOrdering::Unordered);
1223 llvm::Value *ivarVal = load;
1236 uint64_t retTySize =
CGM.getDataLayout().getTypeSizeInBits(retTy);
1237 if (ivarSize > retTySize) {
1238 bitcastType = llvm::Type::getIntNTy(
getLLVMContext(), retTySize);
1240 CGM.getCodeGenOpts().isConvertingBoolWithCmp0())
1241 ivarVal =
Builder.CreateICmpNE(
1242 ivarVal, llvm::Constant::getNullValue(ivarVal->getType()));
1244 ivarVal =
Builder.CreateTrunc(ivarVal, bitcastType);
1253 case PropertyImplStrategy::GetSetProperty: {
1254 llvm::FunctionCallee getPropertyFn =
1255 CGM.getObjCRuntime().GetPropertyGetFunction();
1261 CGM.ErrorUnsupported(propImpl,
1262 "Obj-C getter requiring pointer authentication");
1266 if (!getPropertyFn) {
1267 CGM.ErrorUnsupported(propImpl,
"Obj-C getter requiring atomic copy");
1277 llvm::Value *ivarOffset =
1289 llvm::CallBase *CallInstruction;
1293 if (llvm::CallInst *call = dyn_cast<llvm::CallInst>(CallInstruction))
1294 call->setTailCall();
1303 EmitReturnOfRValue(RV, propType);
1311 case PropertyImplStrategy::CopyStruct:
1313 strategy.hasStrongMember());
1316 case PropertyImplStrategy::Expression:
1317 case PropertyImplStrategy::SetPropertyAndExpressionGet: {
1323 switch (EvaluationKind) {
1342 CGM.ErrorUnsupported(propImpl,
1343 "Obj-C getter for authenticated reference type");
1361 llvm::LoadInst *LoadInst =
Builder.CreateLoad(ivarAddr,
"load");
1362 llvm::Value *Load = LoadInst;
1375 value =
Builder.CreateBitCast(
1383 llvm_unreachable(
"bad evaluation kind");
1387 llvm_unreachable(
"bad @property implementation strategy!");
1399 llvm::Value *ivarAddr =
1438 llvm::Constant *AtomicHelperFn) {
1444 llvm::Value *ivarAddr =
1460 llvm::FunctionCallee fn =
1471 if (!setter)
return true;
1481 if (
CallExpr *call = dyn_cast<CallExpr>(setter)) {
1483 = dyn_cast_or_null<FunctionDecl>(call->getCalleeDecl()))
1484 if (callee->isTrivial())
1502 llvm::Constant *AtomicHelperFn) {
1508 if (!AtomicHelperFn) {
1527 if (!AtomicHelperFn)
1537 PropertyImplStrategy strategy(
CGM, propImpl);
1538 switch (strategy.getKind()) {
1539 case PropertyImplStrategy::Native: {
1541 if (strategy.getIvarSize().isZero())
1552 llvm::Type *castType = llvm::Type::getIntNTy(
1559 llvm::Value *load =
Builder.CreateLoad(argAddr);
1570 llvm::StoreInst *store =
Builder.CreateStore(load, ivarAddr);
1571 store->setAtomic(llvm::AtomicOrdering::Unordered);
1575 case PropertyImplStrategy::GetSetProperty:
1576 case PropertyImplStrategy::SetPropertyAndExpressionGet: {
1578 llvm::FunctionCallee setOptimizedPropertyFn =
nullptr;
1579 llvm::FunctionCallee setPropertyFn =
nullptr;
1582 setOptimizedPropertyFn =
1583 CGM.getObjCRuntime().GetOptimizedPropertySetFunction(
1584 strategy.isAtomic(), strategy.isCopy());
1585 if (!setOptimizedPropertyFn) {
1586 CGM.ErrorUnsupported(propImpl,
"Obj-C optimized setter - NYI");
1591 setPropertyFn =
CGM.getObjCRuntime().GetPropertySetFunction();
1592 if (!setPropertyFn) {
1593 CGM.ErrorUnsupported(propImpl,
"Obj-C setter requiring atomic copy");
1603 llvm::Value *ivarOffset =
1606 llvm::Value *arg =
Builder.CreateLoad(argAddr,
"arg");
1612 if (setOptimizedPropertyFn) {
1635 case PropertyImplStrategy::CopyStruct:
1639 case PropertyImplStrategy::Expression:
1652 &selfLoad,
true,
true);
1670 argCK = CK_BlockPointerToObjCPointerCast;
1672 argCK = CK_CPointerToObjCPointerCast;
1677 argCK = CK_AnyPointerToBlockPointerCast;
1682 argCK = CK_AtomicToNonAtomic;
1685 argCK = CK_NonAtomicToAtomic;
1689 Expr *finalArg = &argLoad;
1692 finalArg = &argCast;
1706 llvm::Constant *AtomicHelperFn =
1707 CodeGenFunction(
CGM).GenerateObjCAtomicSetterCopyHelperFunction(PID);
1709 assert(OMD &&
"Invalid call to generate setter (empty method)");
1718 struct DestroyIvar final : EHScopeStack::Cleanup {
1723 bool useEHCleanupForArray;
1725 DestroyIvar(llvm::Value *addr,
const ObjCIvarDecl *ivar,
1727 bool useEHCleanupForArray)
1728 : addr(addr), ivar(ivar), destroyer(destroyer),
1729 useEHCleanupForArray(useEHCleanupForArray) {}
1735 flags.isForNormalCleanup() && useEHCleanupForArray);
1761 if (!dtorKind)
continue;
1777 CGF.
EHStack.pushCleanup<DestroyIvar>(cleanupKind, self, ivar, destroyer,
1795 for (
const auto *IvarInit : IMP->
inits()) {
1796 FieldDecl *Field = IvarInit->getAnyMember();
1809 llvm::Value *SelfAsId =
1837 llvm::FunctionCallee EnumerationMutationFnPtr =
1838 CGM.getObjCRuntime().EnumerationMutationFunction();
1839 if (!EnumerationMutationFnPtr) {
1840 CGM.ErrorUnsupported(&S,
"Obj-C fast enumeration for this runtime");
1860 QualType StateTy =
CGM.getObjCFastEnumerationStateType();
1865 static const unsigned NumItems = 16;
1869 &
CGM.getContext().Idents.get(
"countByEnumeratingWithState"),
1870 &
CGM.getContext().Idents.get(
"objects"),
1871 &
CGM.getContext().Idents.get(
"count")};
1873 CGM.getContext().Selectors.getSelector(std::size(II), &II[0]);
1876 getContext().getObjCIdType(), llvm::APInt(32, NumItems),
nullptr,
1881 llvm::Value *Collection;
1910 llvm::Constant *Count = llvm::ConstantInt::get(NSUIntegerTy, NumItems);
1917 FastEnumSel, Collection, Args);
1920 llvm::Value *initialBufferLimit = CountRV.
getScalarVal();
1925 llvm::Value *zero = llvm::Constant::getNullValue(NSUIntegerTy);
1932 Builder.CreateICmpEQ(initialBufferLimit, zero,
"iszero"), EmptyBB,
1942 Address StateMutationsPtrPtr =
1943 Builder.CreateStructGEP(StatePtr, 2,
"mutationsptr.ptr");
1944 llvm::Value *StateMutationsPtr
1945 =
Builder.CreateLoad(StateMutationsPtrPtr,
"mutationsptr");
1948 llvm::Value *initialMutations =
1949 Builder.CreateAlignedLoad(UnsignedLongTy, StateMutationsPtr,
1958 llvm::PHINode *
index =
Builder.CreatePHI(NSUIntegerTy, 3,
"forcoll.index");
1959 index->addIncoming(zero, LoopInitBB);
1962 llvm::PHINode *count =
Builder.CreatePHI(NSUIntegerTy, 3,
"forcoll.count");
1963 count->addIncoming(initialBufferLimit, LoopInitBB);
1970 StateMutationsPtr =
Builder.CreateLoad(StateMutationsPtrPtr,
"mutationsptr");
1971 llvm::Value *currentMutations
1972 =
Builder.CreateAlignedLoad(UnsignedLongTy, StateMutationsPtr,
1976 llvm::BasicBlock *WasNotMutatedBB =
createBasicBlock(
"forcoll.notmutated");
1978 Builder.CreateCondBr(
Builder.CreateICmpEQ(currentMutations, initialMutations),
1979 WasNotMutatedBB, WasMutatedBB);
1985 Builder.CreateBitCast(Collection, ObjCIdType);
1999 bool elementIsVariable;
2011 elementIsVariable =
true;
2016 elementLValue =
LValue();
2018 elementIsVariable =
false;
2020 llvm::Type *convertedElementType =
ConvertType(elementType);
2026 Builder.CreateStructGEP(StatePtr, 1,
"stateitems.ptr");
2027 llvm::Value *EnumStateItems =
2028 Builder.CreateLoad(StateItemsPtr,
"stateitems");
2031 llvm::Value *CurrentItemPtr =
Builder.CreateInBoundsGEP(
2032 ObjCIdType, EnumStateItems,
index,
"currentitem.ptr");
2033 llvm::Value *CurrentItem =
2036 if (
SanOpts.has(SanitizerKind::ObjCCast)) {
2047 auto CheckOrdinal = SanitizerKind::SO_ObjCCast;
2048 auto CheckHandler = SanitizerHandler::InvalidObjCCast;
2050 auto &
C =
CGM.getContext();
2051 assert(InterfaceTy->
getDecl() &&
"No decl for ObjC interface type");
2055 CGM.getObjCRuntime().GetClass(*
this, InterfaceTy->
getDecl());
2057 llvm::Value *IsClass =
2058 CGM.getObjCRuntime()
2060 IsKindOfClassSel, CurrentItem,
2063 llvm::Constant *StaticData[] = {
2066 EmitCheck({{IsClass, CheckOrdinal}}, CheckHandler,
2072 CurrentItem =
Builder.CreateBitCast(CurrentItem, convertedElementType,
2077 if (!elementIsVariable) {
2087 if (elementIsVariable)
2091 BreakContinueStack.push_back(BreakContinue(S, LoopEnd, AfterBody));
2096 BreakContinueStack.pop_back();
2107 llvm::Value *indexPlusOne =
2108 Builder.CreateNUWAdd(
index, llvm::ConstantInt::get(NSUIntegerTy, 1));
2115 Builder.CreateICmpULT(indexPlusOne, count), LoopBodyBB, FetchMoreBB,
2119 count->addIncoming(count, AfterBody.
getBlock());
2127 FastEnumSel, Collection, Args);
2134 count->addIncoming(refetchCount,
Builder.GetInsertBlock());
2137 EmptyBB, LoopBodyBB);
2142 if (!elementIsVariable) {
2145 llvm::Value *null = llvm::Constant::getNullValue(convertedElementType);
2158 CGM.getObjCRuntime().EmitTryStmt(*
this, S);
2162 CGM.getObjCRuntime().EmitThrowStmt(*
this, S);
2167 CGM.getObjCRuntime().EmitSynchronizedStmt(*
this, S);
2171 struct CallObjCRelease final : EHScopeStack::Cleanup {
2172 CallObjCRelease(llvm::Value *
object) : object(object) {}
2173 llvm::Value *object;
2185 llvm::Value *
object) {
2193 llvm::Value *value) {
2200 llvm::Function *&fn =
CGM.getObjCEntrypoints().clang_arc_use;
2202 fn =
CGM.getIntrinsic(llvm::Intrinsic::objc_clang_arc_use);
2212 llvm::Function *&fn =
CGM.getObjCEntrypoints().clang_arc_noop_use;
2214 fn =
CGM.getIntrinsic(llvm::Intrinsic::objc_clang_arc_noop_use);
2219 if (
auto *F = dyn_cast<llvm::Function>(RTF)) {
2225 F->setLinkage(llvm::Function::ExternalWeakLinkage);
2231 llvm::FunctionCallee RTF) {
2247 llvm::Function *&fn, llvm::Intrinsic::ID IntID,
2248 llvm::CallInst::TailCallKind tailKind = llvm::CallInst::TCK_None) {
2256 llvm::Type *origType = returnType ? returnType : value->getType();
2261 call->setTailCallKind(tailKind);
2264 return CGF.
Builder.CreateBitCast(call, origType);
2270 llvm::Function *&fn,
2271 llvm::Intrinsic::ID IntID) {
2282 llvm::Function *&fn,
2283 llvm::Intrinsic::ID IntID,
2290 llvm::Type *origType = value->getType();
2292 llvm::Value *args[] = {
2297 if (ignored)
return nullptr;
2299 return CGF.
Builder.CreateBitCast(result, origType);
2305 llvm::Function *&fn,
2306 llvm::Intrinsic::ID IntID) {
2312 llvm::Value *args[] = {
2323 llvm::Type *returnType,
2324 llvm::FunctionCallee &fn,
2330 llvm::FunctionType *fnType =
2335 if (llvm::Function *f = dyn_cast<llvm::Function>(fn.getCallee()))
2336 if (fnName ==
"objc_retain")
2337 f->addFnAttr(llvm::Attribute::NonLazyBind);
2341 llvm::Type *origType = returnType ? returnType : value->getType();
2349 if (fnName ==
"objc_autorelease")
2350 if (
auto *
Call = dyn_cast<llvm::CallInst>(Inst))
2351 Call->setTailCall();
2354 return CGF.
Builder.CreateBitCast(Inst, origType);
2361 if (
type->isBlockPointerType())
2371 CGM.getObjCEntrypoints().objc_retain,
2372 llvm::Intrinsic::objc_retain);
2385 CGM.getObjCEntrypoints().objc_retainBlock,
2386 llvm::Intrinsic::objc_retainBlock);
2393 llvm::CallInst *call
2395 assert(call->getCalledOperand() ==
2396 CGM.getObjCEntrypoints().objc_retainBlock);
2398 call->setMetadata(
"clang.arc.copy_on_escape",
2399 llvm::MDNode::get(
Builder.getContext(), {}));
2408 llvm::InlineAsm *&marker
2416 if (assembly.empty()) {
2421 llvm::FunctionType *
type =
2422 llvm::FunctionType::get(CGF.
VoidTy,
false);
2424 marker = llvm::InlineAsm::get(
type, assembly,
"",
true);
2430 const char *retainRVMarkerKey = llvm::objcarc::getRVMarkerModuleFlagStr();
2431 if (!CGF.
CGM.
getModule().getModuleFlag(retainRVMarkerKey)) {
2434 retainRVMarkerKey, str);
2454 llvm::Function *&EP = IsRetainRV
2457 llvm::Intrinsic::ID IID =
2458 IsRetainRV ? llvm::Intrinsic::objc_retainAutoreleasedReturnValue
2459 : llvm::Intrinsic::objc_unsafeClaimAutoreleasedReturnValue;
2467 (
Arch == llvm::Triple::aarch64 ||
Arch == llvm::Triple::aarch64_32 ||
2468 Arch == llvm::Triple::x86_64)) {
2469 llvm::Value *bundleArgs[] = {EP};
2470 llvm::OperandBundleDef OB(
"clang.arc.attachedcall", bundleArgs);
2472 llvm::CallBase *newCall = llvm::CallBase::addOperandBundle(
2473 oldCall, llvm::LLVMContext::OB_clang_arc_attachedcall, OB,
2474 oldCall->getIterator());
2475 newCall->copyMetadata(*oldCall);
2476 oldCall->replaceAllUsesWith(newCall);
2477 oldCall->eraseFromParent();
2484 llvm::CallInst::TailCallKind tailKind =
2485 isNoTail ? llvm::CallInst::TCK_NoTail : llvm::CallInst::TCK_None;
2517 llvm::Function *&fn =
CGM.getObjCEntrypoints().objc_release;
2528 call->setMetadata(
"clang.imprecise_release",
2529 llvm::MDNode::get(
Builder.getContext(), {}));
2544 if (
CGM.getCodeGenOpts().OptimizationLevel == 0) {
2550 llvm::Value *value =
Builder.CreateLoad(addr);
2561 llvm::Function *&fn =
CGM.getObjCEntrypoints().objc_storeStrong;
2565 llvm::Value *args[] = {
2570 if (ignored)
return nullptr;
2578 llvm::Value *newValue,
2581 bool isBlock =
type->isBlockPointerType();
2614 CGM.getObjCEntrypoints().objc_autorelease,
2615 llvm::Intrinsic::objc_autorelease);
2623 CGM.getObjCEntrypoints().objc_autoreleaseReturnValue,
2624 llvm::Intrinsic::objc_autoreleaseReturnValue,
2625 llvm::CallInst::TCK_Tail);
2633 CGM.getObjCEntrypoints().objc_retainAutoreleaseReturnValue,
2634 llvm::Intrinsic::objc_retainAutoreleaseReturnValue,
2635 llvm::CallInst::TCK_Tail);
2644 llvm::Value *value) {
2645 if (!
type->isBlockPointerType())
2650 llvm::Type *origType = value->getType();
2654 return Builder.CreateBitCast(value, origType);
2662 CGM.getObjCEntrypoints().objc_retainAutorelease,
2663 llvm::Intrinsic::objc_retainAutorelease);
2670 CGM.getObjCEntrypoints().objc_loadWeak,
2671 llvm::Intrinsic::objc_loadWeak);
2677 CGM.getObjCEntrypoints().objc_loadWeakRetained,
2678 llvm::Intrinsic::objc_loadWeakRetained);
2687 CGM.getObjCEntrypoints().objc_storeWeak,
2688 llvm::Intrinsic::objc_storeWeak, ignored);
2701 CGM.getCodeGenOpts().OptimizationLevel == 0) {
2702 Builder.CreateStore(value, addr);
2707 CGM.getObjCEntrypoints().objc_initWeak,
2708 llvm::Intrinsic::objc_initWeak,
true);
2714 llvm::Function *&fn =
CGM.getObjCEntrypoints().objc_destroyWeak;
2726 CGM.getObjCEntrypoints().objc_moveWeak,
2727 llvm::Intrinsic::objc_moveWeak);
2735 CGM.getObjCEntrypoints().objc_copyWeak,
2736 llvm::Intrinsic::objc_copyWeak);
2757 llvm::Function *&fn =
CGM.getObjCEntrypoints().objc_autoreleasePoolPush;
2771 llvm::FunctionCallee &fn =
2772 CGM.getObjCEntrypoints().objc_autoreleasePoolPopInvoke;
2774 llvm::FunctionType *fnType =
2776 fn =
CGM.CreateRuntimeFunction(fnType,
"objc_autoreleasePoolPop");
2783 llvm::FunctionCallee &fn =
CGM.getObjCEntrypoints().objc_autoreleasePoolPop;
2806 AllocSel, Receiver, Args);
2810 II = &
CGM.getContext().Idents.get(
"init");
2815 InitSel, Receiver, Args);
2822 llvm::Type *resultType) {
2824 CGM.getObjCEntrypoints().objc_alloc,
2831 llvm::Type *resultType) {
2833 CGM.getObjCEntrypoints().objc_allocWithZone,
2834 "objc_allocWithZone");
2838 llvm::Type *resultType) {
2840 CGM.getObjCEntrypoints().objc_alloc_init,
2881 llvm::Type *returnType) {
2883 *
this, value, returnType,
2884 CGM.getObjCEntrypoints().objc_autoreleaseRuntimeFunction,
2885 "objc_autorelease");
2891 llvm::Type *returnType) {
2893 *
this, value, returnType,
2894 CGM.getObjCEntrypoints().objc_retainRuntimeFunction,
"objc_retain");
2903 llvm::FunctionCallee &fn =
2904 CGM.getObjCEntrypoints().objc_releaseRuntimeFunction;
2906 llvm::FunctionType *fnType =
2908 fn =
CGM.CreateRuntimeFunction(fnType,
"objc_release");
2911 if (llvm::Function *f = dyn_cast<llvm::Function>(fn.getCallee()))
2912 f->addFnAttr(llvm::Attribute::NonLazyBind);
2922 call->setMetadata(
"clang.imprecise_release",
2923 llvm::MDNode::get(
Builder.getContext(), {}));
2928 struct CallObjCAutoreleasePoolObject final : EHScopeStack::Cleanup {
2931 CallObjCAutoreleasePoolObject(llvm::Value *token) :
Token(token) {}
2937 struct CallObjCMRRAutoreleasePoolObject final : EHScopeStack::Cleanup {
2940 CallObjCMRRAutoreleasePoolObject(llvm::Value *token) : Token(token) {}
2942 void Emit(CodeGenFunction &CGF, Flags flags)
override {
2949 if (
CGM.getLangOpts().ObjCAutoRefCount)
2967 llvm_unreachable(
"impossible lifetime!");
2973 llvm::Value *result;
2993 !
type.isConstQualified() &&
3012 !
type.isVolatileQualified() &&
3021 if (
const auto *decl_expr = dyn_cast<DeclRefExpr>(e)) {
3032 llvm::Value *value)>
3043 CGBuilderTy::InsertPoint ip = CGF.
Builder.saveIP();
3044 auto *callBase = dyn_cast<llvm::CallBase>(value);
3046 if (callBase && llvm::objcarc::hasAttachedCallOpBundle(callBase)) {
3048 value = doFallback(CGF, value);
3049 }
else if (llvm::CallInst *call = dyn_cast<llvm::CallInst>(value)) {
3051 CGF.
Builder.SetInsertPoint(call->getParent(),
3052 ++llvm::BasicBlock::iterator(call));
3053 value = doAfterCall(CGF, value);
3054 }
else if (llvm::InvokeInst *invoke = dyn_cast<llvm::InvokeInst>(value)) {
3056 llvm::BasicBlock *BB = invoke->getNormalDest();
3057 CGF.
Builder.SetInsertPoint(BB, BB->begin());
3058 value = doAfterCall(CGF, value);
3062 }
else if (llvm::BitCastInst *bitcast = dyn_cast<llvm::BitCastInst>(value)) {
3065 CGF.
Builder.SetInsertPoint(bitcast->getParent(), bitcast->getIterator());
3066 llvm::Value *operand = bitcast->getOperand(0);
3068 bitcast->setOperand(0, operand);
3071 auto *phi = dyn_cast<llvm::PHINode>(value);
3072 if (phi && phi->getNumIncomingValues() == 2 &&
3077 llvm::Value *inVal = phi->getIncomingValue(0);
3079 phi->setIncomingValue(0, inVal);
3085 value = doFallback(CGF, value);
3122 bool allowUnsafeClaim) {
3123 if (allowUnsafeClaim &&
3124 CGM.getLangOpts().ObjCRuntime.hasARCUnsafeClaimAutoreleasedReturnValue()) {
3145 switch (
cast->getCastKind()) {
3147 case CK_LValueToRValue:
3148 case CK_ARCReclaimReturnedObject:
3149 case CK_ARCConsumeObject:
3150 case CK_ARCProduceObject:
3159 case CK_AnyPointerToBlockPointerCast:
3171template <
typename Impl,
typename Result>
class ARCExprEmitter {
3173 CodeGenFunction &CGF;
3174 Impl &asImpl() {
return *
static_cast<Impl*
>(
this); }
3176 ARCExprEmitter(CodeGenFunction &CGF) : CGF(CGF) {}
3179 Result visit(
const Expr *e);
3181 Result visitPseudoObjectExpr(
const PseudoObjectExpr *e);
3182 Result visitBlockExpr(
const BlockExpr *e);
3183 Result visitBinaryOperator(
const BinaryOperator *e);
3184 Result visitBinAssign(
const BinaryOperator *e);
3185 Result visitBinAssignUnsafeUnretained(
const BinaryOperator *e);
3186 Result visitBinAssignAutoreleasing(
const BinaryOperator *e);
3187 Result visitBinAssignWeak(
const BinaryOperator *e);
3188 Result visitBinAssignStrong(
const BinaryOperator *e);
3206template <
typename Impl,
typename Result>
3208ARCExprEmitter<Impl,Result>::visitPseudoObjectExpr(
const PseudoObjectExpr *E) {
3209 SmallVector<CodeGenFunction::OpaqueValueMappingData, 4> opaques;
3218 const Expr *semantic = *i;
3222 if (
const OpaqueValueExpr *ov = dyn_cast<OpaqueValueExpr>(semantic)) {
3228 if (ov == resultExpr) {
3229 assert(!OVMA::shouldBindAsLValue(ov));
3230 result = asImpl().visit(ov->getSourceExpr());
3231 opaqueData = OVMA::bind(CGF, ov,
3236 opaqueData = OVMA::bind(CGF, ov, ov->getSourceExpr());
3238 opaques.push_back(opaqueData);
3242 }
else if (semantic == resultExpr) {
3243 result = asImpl().visit(semantic);
3247 CGF.EmitIgnoredExpr(semantic);
3258template <
typename Impl,
typename Result>
3259Result ARCExprEmitter<Impl, Result>::visitBlockExpr(
const BlockExpr *e) {
3261 return asImpl().visitExpr(e);
3264template <
typename Impl,
typename Result>
3265Result ARCExprEmitter<Impl,Result>::visitCastExpr(
const CastExpr *e) {
3273 case CK_CPointerToObjCPointerCast:
3274 case CK_BlockPointerToObjCPointerCast:
3275 case CK_AnyPointerToBlockPointerCast:
3277 llvm::Type *resultType = CGF.ConvertType(e->
getType());
3280 return asImpl().emitBitCast(result, resultType);
3284 case CK_LValueToRValue:
3285 return asImpl().visitLValueToRValue(e->
getSubExpr());
3286 case CK_ARCConsumeObject:
3287 return asImpl().visitConsumeObject(e->
getSubExpr());
3288 case CK_ARCExtendBlockObject:
3289 return asImpl().visitExtendBlockObject(e->
getSubExpr());
3290 case CK_ARCReclaimReturnedObject:
3291 return asImpl().visitReclaimReturnedObject(e->
getSubExpr());
3295 return asImpl().visitExpr(e);
3299template <
typename Impl,
typename Result>
3301ARCExprEmitter<Impl,Result>::visitBinaryOperator(
const BinaryOperator *e) {
3304 CGF.EmitIgnoredExpr(e->
getLHS());
3305 CGF.EnsureInsertPoint();
3306 return asImpl().visit(e->
getRHS());
3309 return asImpl().visitBinAssign(e);
3312 return asImpl().visitExpr(e);
3316template <
typename Impl,
typename Result>
3317Result ARCExprEmitter<Impl,Result>::visitBinAssign(
const BinaryOperator *e) {
3320 return asImpl().visitBinAssignUnsafeUnretained(e);
3323 return asImpl().visitBinAssignWeak(e);
3326 return asImpl().visitBinAssignAutoreleasing(e);
3329 return asImpl().visitBinAssignStrong(e);
3332 return asImpl().visitExpr(e);
3334 llvm_unreachable(
"bad ObjC ownership qualifier");
3339template <
typename Impl,
typename Result>
3340Result ARCExprEmitter<Impl,Result>::
3341 visitBinAssignUnsafeUnretained(
const BinaryOperator *e) {
3349 CGF.EmitStoreThroughLValue(
RValue::get(asImpl().getValueOfResult(result)),
3355template <
typename Impl,
typename Result>
3357ARCExprEmitter<Impl,Result>::visitBinAssignAutoreleasing(
const BinaryOperator *e) {
3358 return asImpl().visitExpr(e);
3361template <
typename Impl,
typename Result>
3363ARCExprEmitter<Impl,Result>::visitBinAssignWeak(
const BinaryOperator *e) {
3364 return asImpl().visitExpr(e);
3367template <
typename Impl,
typename Result>
3369ARCExprEmitter<Impl,Result>::visitBinAssignStrong(
const BinaryOperator *e) {
3370 return asImpl().visitExpr(e);
3374template <
typename Impl,
typename Result>
3375Result ARCExprEmitter<Impl,Result>::visit(
const Expr *e) {
3386 if (
const CastExpr *ce = dyn_cast<CastExpr>(e)) {
3387 return asImpl().visitCastExpr(ce);
3390 }
else if (
auto op = dyn_cast<BinaryOperator>(e)) {
3391 return asImpl().visitBinaryOperator(op);
3402 return asImpl().visitCall(e);
3405 }
else if (
const PseudoObjectExpr *pseudo = dyn_cast<PseudoObjectExpr>(e)) {
3406 return asImpl().visitPseudoObjectExpr(pseudo);
3407 }
else if (
auto *be = dyn_cast<BlockExpr>(e))
3408 return asImpl().visitBlockExpr(be);
3410 return asImpl().visitExpr(e);
3416struct ARCRetainExprEmitter :
3417 public ARCExprEmitter<ARCRetainExprEmitter, TryEmitResult> {
3419 ARCRetainExprEmitter(CodeGenFunction &CGF) : ARCExprEmitter(CGF) {}
3422 return result.getPointer();
3426 llvm::Value *value = result.getPointer();
3427 value = CGF.Builder.CreateBitCast(value, resultType);
3428 result.setPointer(value);
3439 llvm::Value *result = CGF.EmitScalarExpr(e);
3447 if (CGF.CGM.getCodeGenOpts().ObjCAvoidHeapifyLocalBlocks &&
3449 result.setInt(
true);
3457 llvm::Value *result;
3462 result = CGF.EmitScalarExpr(e);
3469 if (subresult.getInt()) {
3474 result = subresult.getPointer();
3478 result = CGF.EmitARCRetainBlock(result,
true);
3500 llvm::Value *result = CGF.EmitScalarExpr(e);
3508 return ARCRetainExprEmitter(CGF).visit(e);
3515 llvm::Value *value = result.getPointer();
3516 if (!result.getInt())
3533 llvm::Value *value = result.getPointer();
3534 if (!result.getInt())
3548 llvm::Value *value = result.getPointer();
3549 if (result.getInt())
3557 llvm::Value *result;
3565 result = subresult.getPointer();
3566 doRetain = !subresult.getInt();
3593struct ARCUnsafeUnretainedExprEmitter :
3594 public ARCExprEmitter<ARCUnsafeUnretainedExprEmitter, llvm::Value*> {
3596 ARCUnsafeUnretainedExprEmitter(
CodeGenFunction &CGF) : ARCExprEmitter(CGF) {}
3598 llvm::Value *getValueOfResult(llvm::Value *value) {
3602 llvm::Value *emitBitCast(llvm::Value *value, llvm::Type *resultType) {
3603 return CGF.Builder.CreateBitCast(value, resultType);
3606 llvm::Value *visitLValueToRValue(
const Expr *e) {
3607 return CGF.EmitScalarExpr(e);
3612 llvm::Value *visitConsumeObject(
const Expr *e) {
3613 llvm::Value *value = CGF.EmitScalarExpr(e);
3614 return CGF.EmitObjCConsumeObject(e->
getType(), value);
3619 llvm::Value *visitExtendBlockObject(
const Expr *e) {
3620 return CGF.EmitARCExtendBlockObject(e);
3624 llvm::Value *visitReclaimReturnedObject(
const Expr *e) {
3625 return CGF.EmitARCReclaimReturnedObject(e,
true);
3630 llvm::Value *visitCall(
const Expr *e) {
3631 return CGF.EmitScalarExpr(e);
3635 llvm::Value *visitExpr(
const Expr *e) {
3636 return CGF.EmitScalarExpr(e);
3643 return ARCUnsafeUnretainedExprEmitter(CGF).visit(e);
3660std::pair<LValue,llvm::Value*>
3676 return std::pair<LValue,llvm::Value*>(std::move(lvalue), value);
3679std::pair<LValue,llvm::Value*>
3684 llvm::Value *value = result.getPointer();
3686 bool hasImmediateRetain = result.getInt();
3693 hasImmediateRetain =
true;
3699 if (hasImmediateRetain) {
3707 return std::pair<LValue,llvm::Value*>(lvalue, value);
3710std::pair<LValue,llvm::Value*>
3717 return std::pair<LValue,llvm::Value*>(lvalue, value);
3731 if (
CGM.getLangOpts().ObjCRuntime.hasNativeARC()) {
3739 for (
const auto *I : S.
body())
3750 llvm::FunctionType *extenderType
3752 llvm::InlineAsm *extender = llvm::InlineAsm::get(extenderType,
3777 CharUnits Alignment =
C.getTypeAlignInChars(Ty);
3788 llvm::Constant *HelperFn =
nullptr;
3792 if ((HelperFn =
CGM.getAtomicSetterHelperFnMap(Ty)))
3796 &
CGM.getContext().Idents.get(
"__assign_helper_atomic_property_");
3802 SrcTy =
C.getPointerType(SrcTy);
3805 ArgTys.push_back(DestTy);
3806 ArgTys.push_back(SrcTy);
3807 QualType FunctionTy =
C.getFunctionType(ReturnTy, ArgTys, {});
3811 FunctionTy,
nullptr,
SC_Static,
false,
false,
false);
3819 args.push_back(Params[0] = DstDecl);
3824 args.push_back(Params[1] = SrcDecl);
3825 FD->setParams(Params);
3828 CGM.getTypes().arrangeBuiltinFunctionDeclaration(ReturnTy, args);
3830 llvm::FunctionType *LTy =
CGM.getTypes().GetFunctionType(FI);
3832 llvm::Function *Fn =
3833 llvm::Function::Create(LTy, llvm::GlobalValue::InternalLinkage,
3834 "__assign_helper_atomic_property_",
3851 Expr *Args[2] = {DST, SRC};
3861 CGM.setAtomicSetterHelperFnMap(Ty, HelperFn);
3875 CharUnits Alignment =
C.getTypeAlignInChars(Ty);
3886 llvm::Constant *HelperFn =
nullptr;
3890 if ((HelperFn =
CGM.getAtomicGetterHelperFnMap(Ty)))
3894 &
CGM.getContext().Idents.get(
"__copy_helper_atomic_property_");
3900 SrcTy =
C.getPointerType(SrcTy);
3903 ArgTys.push_back(DestTy);
3904 ArgTys.push_back(SrcTy);
3905 QualType FunctionTy =
C.getFunctionType(ReturnTy, ArgTys, {});
3909 FunctionTy,
nullptr,
SC_Static,
false,
false,
false);
3917 args.push_back(Params[0] = DstDecl);
3922 args.push_back(Params[1] = SrcDecl);
3923 FD->setParams(Params);
3926 CGM.getTypes().arrangeBuiltinFunctionDeclaration(ReturnTy, args);
3928 llvm::FunctionType *LTy =
CGM.getTypes().GetFunctionType(FI);
3930 llvm::Function *Fn = llvm::Function::Create(
3931 LTy, llvm::GlobalValue::InternalLinkage,
"__copy_helper_atomic_property_",
3949 ConstructorArgs.push_back(SRC);
3950 ConstructorArgs.append(std::next(CXXConstExpr->
arg_begin()),
3980 CGM.setAtomicGetterHelperFnMap(Ty, HelperFn);
3996 llvm::Value *Val =
Block;
4001 Val =
Result.getScalarVal();
4003 Ty, AutoreleaseSelector,
4005 Val =
Result.getScalarVal();
4010 switch (TT.getOS()) {
4011 case llvm::Triple::Darwin:
4012 case llvm::Triple::MacOSX:
4013 return llvm::MachO::PLATFORM_MACOS;
4014 case llvm::Triple::IOS:
4015 return llvm::MachO::PLATFORM_IOS;
4016 case llvm::Triple::TvOS:
4017 return llvm::MachO::PLATFORM_TVOS;
4018 case llvm::Triple::WatchOS:
4019 return llvm::MachO::PLATFORM_WATCHOS;
4020 case llvm::Triple::XROS:
4021 return llvm::MachO::PLATFORM_XROS;
4022 case llvm::Triple::DriverKit:
4023 return llvm::MachO::PLATFORM_DRIVERKIT;
4025 return llvm::MachO::PLATFORM_UNKNOWN;
4030 const VersionTuple &Version) {
4037 auto EmitArgs = [&](
const VersionTuple &Version,
const llvm::Triple &TT) {
4038 std::optional<unsigned>
Min = Version.getMinor(),
4039 SMin = Version.getSubminor();
4042 Args.push_back(llvm::ConstantInt::get(CGM.
Int32Ty, Version.getMajor()));
4043 Args.push_back(llvm::ConstantInt::get(CGM.
Int32Ty,
Min.value_or(0)));
4044 Args.push_back(llvm::ConstantInt::get(CGM.
Int32Ty, SMin.value_or(0)));
4047 assert(!Version.empty() &&
"unexpected empty version");
4051 llvm::FunctionType *FTy = llvm::FunctionType::get(
4052 CGM.
Int32Ty, {CGM.Int32Ty, CGM.Int32Ty, CGM.Int32Ty, CGM.Int32Ty},
4058 llvm::Value *Check =
4060 return CGF.
Builder.CreateICmpNE(Check,
4061 llvm::Constant::getNullValue(CGM.
Int32Ty));
4067 if (
CGM.getTarget().getTriple().isOSDarwin())
4070 if (!
CGM.IsOSVersionAtLeastFn) {
4071 llvm::FunctionType *FTy =
4073 CGM.IsOSVersionAtLeastFn =
4074 CGM.CreateRuntimeFunction(FTy,
"__isOSVersionAtLeast");
4077 std::optional<unsigned>
Min = Version.getMinor(),
4078 SMin = Version.getSubminor();
4079 llvm::Value *Args[] = {
4080 llvm::ConstantInt::get(
CGM.Int32Ty, Version.getMajor()),
4081 llvm::ConstantInt::get(
CGM.Int32Ty,
Min.value_or(0)),
4082 llvm::ConstantInt::get(
CGM.Int32Ty, SMin.value_or(0))};
4084 llvm::Value *CallRes =
4087 return Builder.CreateICmpNE(CallRes, llvm::Constant::getNullValue(
Int32Ty));
4091 const llvm::Triple &TT,
const VersionTuple &
TargetVersion) {
4092 VersionTuple FoundationDroppedInVersion;
4093 switch (TT.getOS()) {
4094 case llvm::Triple::IOS:
4095 case llvm::Triple::TvOS:
4096 FoundationDroppedInVersion = VersionTuple(13);
4098 case llvm::Triple::WatchOS:
4099 FoundationDroppedInVersion = VersionTuple(6);
4101 case llvm::Triple::Darwin:
4102 case llvm::Triple::MacOSX:
4103 FoundationDroppedInVersion = VersionTuple(10, 15);
4105 case llvm::Triple::XROS:
4108 case llvm::Triple::DriverKit:
4112 llvm_unreachable(
"Unexpected OS");
4117void CodeGenModule::emitAtAvailableLinkGuard() {
4121 if (!Target.getTriple().isOSDarwin())
4126 Target.getTriple(), Target.getPlatformMinVersion()))
4133 llvm::Metadata *Args[2] = {llvm::MDString::get(Context,
"-framework"),
4134 llvm::MDString::get(Context,
"CoreFoundation")};
4135 LinkerOptionsMetadata.push_back(llvm::MDNode::get(Context, Args));
4138 llvm::FunctionType *FTy =
4140 llvm::FunctionCallee CFFunc =
4143 llvm::FunctionType *CheckFTy = llvm::FunctionType::get(
VoidTy, {},
false);
4145 CheckFTy,
"__clang_at_available_requires_core_foundation_framework",
4146 llvm::AttributeList(),
true);
4147 llvm::Function *CFLinkCheckFunc =
4149 if (CFLinkCheckFunc->empty()) {
4150 CFLinkCheckFunc->setLinkage(llvm::GlobalValue::LinkOnceAnyLinkage);
4151 CFLinkCheckFunc->setVisibility(llvm::GlobalValue::HiddenVisibility);
4152 CodeGenFunction CGF(*
this);
4153 CGF.Builder.SetInsertPoint(CGF.createBasicBlock(
"", CFLinkCheckFunc));
4154 CGF.EmitNounwindRuntimeCall(CFFunc,
4155 llvm::Constant::getNullValue(
VoidPtrTy));
4156 CGF.Builder.CreateUnreachable();
Defines the clang::ASTContext interface.
Defines the Diagnostic-related interfaces.
static llvm::Value * emitARCUnsafeClaimCallResult(CodeGenFunction &CGF, const Expr *e)
Given that the given expression is some sort of call (which does not return retained),...
static bool hasTrivialGetExpr(const ObjCPropertyImplDecl *propImpl)
static bool shouldRetainObjCLifetime(Qualifiers::ObjCLifetime lifetime)
static bool shouldEmitSeparateBlockRetain(const Expr *e)
Determine whether it might be important to emit a separate objc_retain_block on the result of the giv...
static std::optional< llvm::Value * > tryEmitSpecializedAllocInit(CodeGenFunction &CGF, const ObjCMessageExpr *OME)
Instead of '[[MyClass alloc] init]', try to generate 'objc_alloc_init(MyClass)'.
static llvm::Value * emitObjCValueOperation(CodeGenFunction &CGF, llvm::Value *value, llvm::Type *returnType, llvm::FunctionCallee &fn, StringRef fnName)
Perform an operation having the signature i8* (i8*) where a null input causes a no-op and returns nul...
llvm::function_ref< llvm::Value *(CodeGenFunction &CGF, llvm::Value *value)> ValueTransform
static llvm::Value * emitARCUnsafeUnretainedScalarExpr(CodeGenFunction &CGF, const Expr *e)
static llvm::Value * emitARCLoadOperation(CodeGenFunction &CGF, Address addr, llvm::Function *&fn, llvm::Intrinsic::ID IntID)
Perform an operation having the following signature: i8* (i8**)
static llvm::Constant * getNullForVariable(Address addr)
Given the address of a variable of pointer type, find the correct null to store into it.
static void emitAutoreleasedReturnValueMarker(CodeGenFunction &CGF)
static const Expr * findWeakLValue(const Expr *E)
Given an expression of ObjC pointer type, check whether it was immediately loaded from an ARC __weak ...
llvm::PointerIntPair< llvm::Value *, 1, bool > TryEmitResult
static bool hasUnalignedAtomics(llvm::Triple::ArchType arch)
Determine whether the given architecture supports unaligned atomic accesses.
static void emitARCCopyOperation(CodeGenFunction &CGF, Address dst, Address src, llvm::Function *&fn, llvm::Intrinsic::ID IntID)
Perform an operation having the following signature: void (i8**, i8**)
static void AppendFirstImpliedRuntimeProtocols(const ObjCProtocolDecl *PD, llvm::UniqueVector< const ObjCProtocolDecl * > &PDs)
static TryEmitResult tryEmitARCRetainScalarExpr(CodeGenFunction &CGF, const Expr *e)
static llvm::Value * emitOptimizedARCReturnCall(llvm::Value *value, bool IsRetainRV, CodeGenFunction &CGF)
static llvm::Value * emitCmdValueForGetterSetterBody(CodeGenFunction &CGF, ObjCMethodDecl *MD)
static llvm::Function * getARCIntrinsic(llvm::Intrinsic::ID IntID, CodeGenModule &CGM)
static bool isFoundationNeededForDarwinAvailabilityCheck(const llvm::Triple &TT, const VersionTuple &TargetVersion)
static bool shouldExtendReceiverForInnerPointerMessage(const ObjCMessageExpr *message)
Decide whether to extend the lifetime of the receiver of a returns-inner-pointer message.
static llvm::Value * emitARCStoreOperation(CodeGenFunction &CGF, Address addr, llvm::Value *value, llvm::Function *&fn, llvm::Intrinsic::ID IntID, bool ignored)
Perform an operation having the following signature: i8* (i8**, i8*)
static unsigned getBaseMachOPlatformID(const llvm::Triple &TT)
static TryEmitResult tryEmitARCRetainLoadOfScalar(CodeGenFunction &CGF, LValue lvalue, QualType type)
static void setARCRuntimeFunctionLinkage(CodeGenModule &CGM, llvm::Value *RTF)
static std::optional< llvm::Value * > tryGenerateSpecializedMessageSend(CodeGenFunction &CGF, QualType ResultType, llvm::Value *Receiver, const CallArgList &Args, Selector Sel, const ObjCMethodDecl *method, bool isClassMessage)
The ObjC runtime may provide entrypoints that are likely to be faster than an ordinary message send o...
static CharUnits getMaxAtomicAccessSize(CodeGenModule &CGM, llvm::Triple::ArchType arch)
Return the maximum size that permits atomic accesses for the given architecture.
static llvm::Value * emitARCRetainCallResult(CodeGenFunction &CGF, const Expr *e)
Given that the given expression is some sort of call (which does not return retained),...
static void emitCPPObjectAtomicGetterCall(CodeGenFunction &CGF, llvm::Value *returnAddr, ObjCIvarDecl *ivar, llvm::Constant *AtomicHelperFn)
emitCPPObjectAtomicGetterCall - Call the runtime function to copy the ivar into the resturn slot.
static llvm::Value * emitIsPlatformVersionAtLeast(CodeGenFunction &CGF, const VersionTuple &Version)
static void destroyARCStrongWithStore(CodeGenFunction &CGF, Address addr, QualType type)
Like CodeGenFunction::destroyARCStrong, but do it with a call.
static llvm::Value * emitARCRetainLoadOfScalar(CodeGenFunction &CGF, LValue lvalue, QualType type)
static void emitCXXDestructMethod(CodeGenFunction &CGF, ObjCImplementationDecl *impl)
static void emitStructGetterCall(CodeGenFunction &CGF, ObjCIvarDecl *ivar, bool isAtomic, bool hasStrong)
emitStructGetterCall - Call the runtime function to load a property into the return value slot.
static llvm::Value * emitARCValueOperation(CodeGenFunction &CGF, llvm::Value *value, llvm::Type *returnType, llvm::Function *&fn, llvm::Intrinsic::ID IntID, llvm::CallInst::TailCallKind tailKind=llvm::CallInst::TCK_None)
Perform an operation having the signature i8* (i8*) where a null input causes a no-op and returns nul...
static llvm::Value * emitARCOperationAfterCall(CodeGenFunction &CGF, llvm::Value *value, ValueTransform doAfterCall, ValueTransform doFallback)
Insert code immediately after a call.
static void emitStructSetterCall(CodeGenFunction &CGF, ObjCMethodDecl *OMD, ObjCIvarDecl *ivar)
emitStructSetterCall - Call the runtime function to store the value from the first formal parameter i...
static void emitCPPObjectAtomicSetterCall(CodeGenFunction &CGF, ObjCMethodDecl *OMD, ObjCIvarDecl *ivar, llvm::Constant *AtomicHelperFn)
emitCPPObjectAtomicSetterCall - Call the runtime function to store the value from the first formal pa...
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,...
static bool hasTrivialSetExpr(const ObjCPropertyImplDecl *PID)
static bool UseOptimizedSetter(CodeGenModule &CGM)
static Decl::Kind getKind(const Decl *D)
Result
Implement __builtin_bit_cast and related operations.
llvm::json::Object Object
Defines the Objective-C statement AST node classes.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
CharUnits getTypeAlignInChars(QualType T) const
Return the ABI-specified alignment of a (complete) type T, in characters.
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.
QualType getConstantArrayType(QualType EltTy, const llvm::APInt &ArySize, const Expr *SizeExpr, ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return the unique reference to the type for a constant array of the specified element type.
SelectorTable & Selectors
Qualifiers::GC getObjCGCAttrKind(QualType Ty) const
Return one of the GCNone, Weak or Strong Objective-C garbage collection attributes.
QualType getObjCSelType() const
Retrieve the type that corresponds to the predefined Objective-C 'SEL' type.
TypeInfoChars getTypeInfoInChars(const Type *T) const
int64_t toBits(CharUnits CharSize) const
Convert a size in characters to a size in bits.
CharUnits getTypeSizeInChars(QualType T) const
Return the size of the specified (complete) type T, in characters.
QualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
A builtin binary operation expression such as "x + y" or "x <= y".
static BinaryOperator * Create(const ASTContext &C, Expr *lhs, Expr *rhs, Opcode opc, QualType ResTy, ExprValueKind VK, ExprObjectKind OK, SourceLocation opLoc, FPOptionsOverride FPFeatures)
bool canAvoidCopyToHeap() const
const BlockDecl * getBlockDecl() const
Represents a call to a C++ constructor.
bool isElidable() const
Whether this construction is elidable.
bool hadMultipleCandidates() const
Whether the referred constructor was resolved from an overloaded set having size greater than 1.
static CXXConstructExpr * Create(const ASTContext &Ctx, QualType Ty, SourceLocation Loc, CXXConstructorDecl *Ctor, bool Elidable, ArrayRef< Expr * > Args, bool HadMultipleCandidates, bool ListInitialization, bool StdInitListInitialization, bool ZeroInitialization, CXXConstructionKind ConstructKind, SourceRange ParenOrBraceRange)
Create a C++ construction expression.
bool isStdInitListInitialization() const
Whether this constructor call was written as list-initialization, but was interpreted as forming a st...
bool requiresZeroInitialization() const
Whether this construction first requires zero-initialization before the initializer is called.
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will (ultimately) call.
bool isListInitialization() const
Whether this constructor call was written as list-initialization.
CXXConstructionKind getConstructionKind() const
Determine whether this constructor is actually constructing a base class (rather than a complete obje...
A call to an overloaded operator written using operator syntax.
static CXXOperatorCallExpr * Create(const ASTContext &Ctx, OverloadedOperatorKind OpKind, Expr *Fn, ArrayRef< Expr * > Args, QualType Ty, ExprValueKind VK, SourceLocation OperatorLoc, FPOptionsOverride FPFeatures, ADLCallKind UsesADL=NotADL, bool IsReversed=false)
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
CastKind getCastKind() const
CharUnits - This is an opaque type for sizes expressed in character units.
bool isZero() const
isZero - Test whether the quantity equals zero.
static CharUnits fromQuantity(QuantityType Quantity)
fromQuantity - Construct a CharUnits quantity from a raw integer type.
Like RawAddress, an abstract representation of an aligned address, but the pointer contained in this ...
llvm::Value * emitRawPointer(CodeGenFunction &CGF) const
Return the pointer contained in this class after authenticating it and adding offset to it if necessa...
llvm::Type * getElementType() const
Return the type of the values stored in this address.
Address withElementType(llvm::Type *ElemTy) const
Return address with different element type, but same pointer and alignment.
llvm::PointerType * getType() const
Return the type of the pointer value.
static AggValueSlot forLValue(const LValue &LV, IsDestructed_t isDestructed, NeedsGCBarriers_t needsGC, IsAliased_t isAliased, Overlap_t mayOverlap, IsZeroed_t isZeroed=IsNotZeroed, IsSanitizerChecked_t isChecked=IsNotSanitizerChecked)
static AggValueSlot forAddr(Address addr, Qualifiers quals, IsDestructed_t isDestructed, NeedsGCBarriers_t needsGC, IsAliased_t isAliased, Overlap_t mayOverlap, IsZeroed_t isZeroed=IsNotZeroed, IsSanitizerChecked_t isChecked=IsNotSanitizerChecked)
forAddr - Make a slot for an aggregate value.
llvm::LoadInst * CreateLoad(Address Addr, const llvm::Twine &Name="")
All available information about a concrete callee.
static CGCallee forDirect(llvm::Constant *functionPtr, const CGCalleeInfo &abstractInfo=CGCalleeInfo())
This class gathers all debug information during compilation and is responsible for emitting to llvm g...
void EmitLexicalBlockEnd(CGBuilderTy &Builder, SourceLocation Loc)
Emit metadata to indicate the end of a new lexical block and pop the current block.
void EmitLexicalBlockStart(CGBuilderTy &Builder, SourceLocation Loc)
Emit metadata to indicate the beginning of a new lexical block and push the block onto the stack.
CGFunctionInfo - Class to encapsulate the information about a function definition.
Implements runtime-specific code generation functions.
virtual llvm::FunctionCallee GetCppAtomicObjectGetFunction()=0
API for atomic copying of qualified aggregates with non-trivial copy assignment (c++) in getter.
virtual llvm::FunctionCallee GetCppAtomicObjectSetFunction()=0
API for atomic copying of qualified aggregates with non-trivial copy assignment (c++) in setter.
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
Generate an Objective-C message send operation.
CodeGen::RValue GeneratePossiblySpecializedMessageSend(CodeGenFunction &CGF, ReturnValueSlot Return, QualType ResultType, Selector Sel, llvm::Value *Receiver, const CallArgList &Args, const ObjCInterfaceDecl *OID, const ObjCMethodDecl *Method, bool isClassMessage)
Generate an Objective-C message send operation.
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
Generate an Objective-C message send operation to the super class initiated in a method for Class and...
virtual llvm::FunctionCallee GetGetStructFunction()=0
virtual llvm::Value * GetClass(CodeGenFunction &CGF, const ObjCInterfaceDecl *OID)=0
GetClass - Return a reference to the class for the given interface decl.
virtual llvm::Value * EmitNSAutoreleasePoolClassRef(CodeGenFunction &CGF)
virtual llvm::FunctionCallee GetSetStructFunction()=0
std::vector< const ObjCProtocolDecl * > GetRuntimeProtocolList(ObjCProtocolDecl::protocol_iterator begin, ObjCProtocolDecl::protocol_iterator end)
Walk the list of protocol references from a class, category or protocol to traverse the DAG formed fr...
CallArgList - Type for representing both the value and type of arguments in a call.
void add(RValue rvalue, QualType type)
An abstract representation of regular/ObjC call/message targets.
static AutoVarEmission invalid()
A non-RAII class containing all the information about a bound opaque value.
Enters a new scope for capturing cleanups, all of which will be executed once the scope is exited.
void ForceCleanup(std::initializer_list< llvm::Value ** > ValuesToReload={})
Force the emission of cleanups now, instead of waiting until this object is destroyed.
bool requiresCleanups() const
Determine whether this scope requires any cleanups.
CodeGenFunction - This class organizes the per-function state that is used while generating LLVM code...
llvm::Value * EmitObjCConsumeObject(QualType T, llvm::Value *Ptr)
Produce the code for a CK_ARCConsumeObject.
GlobalDecl CurGD
CurGD - The GlobalDecl for the current function being compiled.
llvm::Value * EmitObjCAutorelease(llvm::Value *value, llvm::Type *returnType)
Autorelease the given object.
RValue EmitObjCMessageExpr(const ObjCMessageExpr *E, ReturnValueSlot Return=ReturnValueSlot())
void EmitARCMoveWeak(Address dst, Address src)
void @objc_moveWeak(i8** dest, i8** src) Disregards the current value in dest.
llvm::Value * EmitARCRetainAutoreleaseReturnValue(llvm::Value *value)
Do a fused retain/autorelease of the given object.
void emitDestroy(Address addr, QualType type, Destroyer *destroyer, bool useEHCleanupForArray)
emitDestroy - Immediately perform the destruction of the given object.
JumpDest getJumpDestInCurrentScope(llvm::BasicBlock *Target)
The given basic block lies in the current EH scope, but may be a target of a potentially scope-crossi...
llvm::Value * EmitARCReclaimReturnedObject(const Expr *e, bool allowUnsafeClaim)
std::pair< LValue, llvm::Value * > EmitARCStoreAutoreleasing(const BinaryOperator *e)
llvm::Value * EmitARCUnsafeUnretainedScalarExpr(const Expr *expr)
EmitARCUnsafeUnretainedScalarExpr - Semantically equivalent to immediately releasing the resut of Emi...
llvm::Value * EmitObjCSelectorExpr(const ObjCSelectorExpr *E)
Emit a selector.
SanitizerSet SanOpts
Sanitizers enabled for this function.
void EmitNullInitialization(Address DestPtr, QualType Ty)
EmitNullInitialization - Generate code to set a value of the given type to null, If the type contains...
void EmitARCInitWeak(Address addr, llvm::Value *value)
i8* @objc_initWeak(i8** addr, i8* value) Returns value.
llvm::Value * EmitObjCDictionaryLiteral(const ObjCDictionaryLiteral *E)
llvm::Type * ConvertType(QualType T)
static Destroyer destroyARCWeak
llvm::Value * EmitObjCProtocolExpr(const ObjCProtocolExpr *E)
llvm::CallBase * EmitCallOrInvoke(llvm::FunctionCallee Callee, ArrayRef< llvm::Value * > Args, const Twine &Name="")
Emits a call or invoke instruction to the given function, depending on the current state of the EH st...
llvm::CallBase * EmitRuntimeCallOrInvoke(llvm::FunctionCallee callee, ArrayRef< llvm::Value * > args, const Twine &name="")
Emits a call or invoke instruction to the given runtime function.
ComplexPairTy EmitLoadOfComplex(LValue src, SourceLocation loc)
EmitLoadOfComplex - Load a complex number from the specified l-value.
llvm::Value * EmitARCAutoreleaseReturnValue(llvm::Value *value)
Autorelease the given object.
llvm::Value * EmitARCRetain(QualType type, llvm::Value *value)
Produce the code to do a retain.
CleanupKind getARCCleanupKind()
Retrieves the default cleanup kind for an ARC cleanup.
llvm::Value * EmitARCAutorelease(llvm::Value *value)
Autorelease the given object.
llvm::Value * EmitARCRetainAutoreleaseScalarExpr(const Expr *expr)
bool shouldUseFusedARCCalls()
void EmitARCDestroyWeak(Address addr)
void @objc_destroyWeak(i8** addr) Essentially objc_storeWeak(addr, nil).
void EmitObjCRelease(llvm::Value *value, ARCPreciseLifetime_t precise)
Release the given object.
llvm::Value * EmitObjCAllocInit(llvm::Value *value, llvm::Type *resultType)
void EmitObjCAtThrowStmt(const ObjCAtThrowStmt &S)
llvm::Constant * EmitCheckSourceLocation(SourceLocation Loc)
Emit a description of a source location in a format suitable for passing to a runtime sanitizer handl...
void EmitObjCAutoreleasePoolCleanup(llvm::Value *Ptr)
void EmitAutoVarInit(const AutoVarEmission &emission)
llvm::BasicBlock * createBasicBlock(const Twine &name="", llvm::Function *parent=nullptr, llvm::BasicBlock *before=nullptr)
createBasicBlock - Create an LLVM basic block.
llvm::Value * EmitObjCArrayLiteral(const ObjCArrayLiteral *E)
const LangOptions & getLangOpts() const
llvm::Value * EmitARCRetainAutorelease(QualType type, llvm::Value *value)
Do a fused retain/autorelease of the given object.
llvm::Value * EmitARCStoreStrong(LValue lvalue, llvm::Value *value, bool resultIgnored)
Store into a strong object.
llvm::Value * EmitARCRetainAutoreleasedReturnValue(llvm::Value *value)
Retain the given object which is the result of a function call.
void StartObjCMethod(const ObjCMethodDecl *MD, const ObjCContainerDecl *CD)
StartObjCMethod - Begin emission of an ObjCMethod.
LValue MakeNaturalAlignAddrLValue(llvm::Value *V, QualType T, KnownNonNull_t IsKnownNonNull=NotKnownNonNull)
AutoVarEmission EmitAutoVarAlloca(const VarDecl &var)
EmitAutoVarAlloca - Emit the alloca and debug information for a local variable.
llvm::Value * EmitARCUnsafeClaimAutoreleasedReturnValue(llvm::Value *value)
Claim a possibly-autoreleased return value at +0.
llvm::Value * EmitObjCMRRAutoreleasePoolPush()
Produce the code to do an MRR version objc_autoreleasepool_push.
LValue EmitLValueForIvar(QualType ObjectTy, llvm::Value *Base, const ObjCIvarDecl *Ivar, unsigned CVRQualifiers)
void GenerateObjCCtorDtorMethod(ObjCImplementationDecl *IMP, ObjCMethodDecl *MD, bool ctor)
llvm::Value * EmitObjCAllocWithZone(llvm::Value *value, llvm::Type *returnType)
Allocate the given objc object.
@ TCK_Store
Checking the destination of a store. Must be suitably sized and aligned.
llvm::Value * EmitObjCThrowOperand(const Expr *expr)
const Decl * CurCodeDecl
CurCodeDecl - This is the inner-most code context, which includes blocks.
Destroyer * getDestroyer(QualType::DestructionKind destructionKind)
llvm::AssertingVH< llvm::Instruction > AllocaInsertPt
AllocaInsertPoint - This is an instruction in the entry block before which we prefer to insert alloca...
void EmitARCRelease(llvm::Value *value, ARCPreciseLifetime_t precise)
Release the given object.
std::pair< LValue, llvm::Value * > EmitARCStoreUnsafeUnretained(const BinaryOperator *e, bool ignored)
llvm::Constant * EmitCheckTypeDescriptor(QualType T)
Emit a description of a type in a format suitable for passing to a runtime sanitizer handler.
void GenerateObjCGetter(ObjCImplementationDecl *IMP, const ObjCPropertyImplDecl *PID)
GenerateObjCGetter - Synthesize an Objective-C property getter function.
llvm::Value * EmitIvarOffsetAsPointerDiff(const ObjCInterfaceDecl *Interface, const ObjCIvarDecl *Ivar)
void EmitAggregateCopy(LValue Dest, LValue Src, QualType EltTy, AggValueSlot::Overlap_t MayOverlap, bool isVolatile=false)
EmitAggregateCopy - Emit an aggregate copy.
Address EmitCompoundStmtWithoutScope(const CompoundStmt &S, bool GetLast=false, AggValueSlot AVS=AggValueSlot::ignored())
llvm::Value * EmitBlockCopyAndAutorelease(llvm::Value *Block, QualType Ty)
RValue EmitLoadOfLValue(LValue V, SourceLocation Loc)
EmitLoadOfLValue - Given an expression that represents a value lvalue, this method emits the address ...
void EmitARCDestroyStrong(Address addr, ARCPreciseLifetime_t precise)
Destroy a __strong variable.
void DeactivateCleanupBlock(EHScopeStack::stable_iterator Cleanup, llvm::Instruction *DominatingIP)
DeactivateCleanupBlock - Deactivates the given cleanup block.
void pushFullExprCleanup(CleanupKind kind, As... A)
pushFullExprCleanup - Push a cleanup to be run at the end of the current full-expression.
QualType TypeOfSelfObject()
TypeOfSelfObject - Return type of object that this self represents.
static Destroyer destroyARCStrongImprecise
void EmitObjCAutoreleasePoolStmt(const ObjCAutoreleasePoolStmt &S)
llvm::BasicBlock * getInvokeDest()
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.
llvm::Value * EmitObjCBoxedExpr(const ObjCBoxedExpr *E)
EmitObjCBoxedExpr - This routine generates code to call the appropriate expression boxing method.
void generateObjCSetterBody(const ObjCImplementationDecl *classImpl, const ObjCPropertyImplDecl *propImpl, llvm::Constant *AtomicHelperFn)
void EmitCheck(ArrayRef< std::pair< llvm::Value *, SanitizerKind::SanitizerOrdinal > > Checked, SanitizerHandler Check, ArrayRef< llvm::Constant * > StaticArgs, ArrayRef< llvm::Value * > DynamicArgs, const TrapReason *TR=nullptr)
Create a basic block that will either trap or call a handler function in the UBSan runtime with the p...
void EmitExtendGCLifetime(llvm::Value *object)
EmitExtendGCLifetime - Given a pointer to an Objective-C object, make sure it survives garbage collec...
LValue EmitDeclRefLValue(const DeclRefExpr *E)
void callCStructCopyConstructor(LValue Dst, LValue Src)
llvm::Value * EmitARCRetainBlock(llvm::Value *value, bool mandatory)
Retain the given block, with _Block_copy semantics.
llvm::Value * EmitObjCCollectionLiteral(const Expr *E, const ObjCMethodDecl *MethodWithObjects)
CGDebugInfo * getDebugInfo()
llvm::Value * emitScalarConstant(const ConstantEmission &Constant, Expr *E)
llvm::Value * EmitARCRetainScalarExpr(const Expr *expr)
EmitARCRetainScalarExpr - Semantically equivalent to EmitARCRetainObject(e->getType(),...
void EmitObjCAtTryStmt(const ObjCAtTryStmt &S)
RValue EmitCall(const CGFunctionInfo &CallInfo, const CGCallee &Callee, ReturnValueSlot ReturnValue, const CallArgList &Args, llvm::CallBase **CallOrInvoke, bool IsMustTail, SourceLocation Loc, bool IsVirtualFunctionPointerThunk=false)
EmitCall - Generate a call of the given function, expecting the given result type,...
CGPointerAuthInfo EmitPointerAuthInfo(const PointerAuthSchema &Schema, llvm::Value *StorageAddress, GlobalDecl SchemaDecl, QualType SchemaType)
Emit the concrete pointer authentication informaton for the given authentication schema.
SmallVector< llvm::OperandBundleDef, 1 > getBundlesForFunclet(llvm::Value *Callee)
llvm::Value * EmitObjCAlloc(llvm::Value *value, llvm::Type *returnType)
Allocate the given objc object.
llvm::Value * LoadObjCSelf()
LoadObjCSelf - Load the value of self.
void GenerateObjCMethod(const ObjCMethodDecl *OMD)
Generate an Objective-C method.
void callCStructMoveAssignmentOperator(LValue Dst, LValue Src)
llvm::Value * EmitARCLoadWeakRetained(Address addr)
i8* @objc_loadWeakRetained(i8** addr)
llvm::Value * emitPointerAuthResign(llvm::Value *Pointer, QualType PointerType, const CGPointerAuthInfo &CurAuthInfo, const CGPointerAuthInfo &NewAuthInfo, bool IsKnownNonNull)
llvm::CallInst * EmitNounwindRuntimeCall(llvm::FunctionCallee callee, const Twine &name="")
ASTContext & getContext() const
llvm::Value * EmitLoadOfScalar(Address Addr, bool Volatile, QualType Ty, SourceLocation Loc, AlignmentSource Source=AlignmentSource::Type, bool isNontemporal=false)
EmitLoadOfScalar - Load a scalar value from an address, taking care to appropriately convert from the...
void emitARCMoveAssignWeak(QualType Ty, Address DstAddr, Address SrcAddr)
void Destroyer(CodeGenFunction &CGF, Address addr, QualType ty)
void EmitStoreOfComplex(ComplexPairTy V, LValue dest, bool isInit)
EmitStoreOfComplex - Store a complex number into the specified l-value.
const Decl * CurFuncDecl
CurFuncDecl - Holds the Decl for the current outermost non-closure context.
void EmitAutoVarCleanups(const AutoVarEmission &emission)
void EmitStoreThroughLValue(RValue Src, LValue Dst, bool isInit=false)
EmitStoreThroughLValue - Store the specified rvalue into the specified lvalue, where both are guarant...
llvm::Constant * GenerateObjCAtomicSetterCopyHelperFunction(const ObjCPropertyImplDecl *PID)
GenerateObjCAtomicSetterCopyHelperFunction - Given a c++ object type with non-trivial copy assignment...
void EmitObjCAtSynchronizedStmt(const ObjCAtSynchronizedStmt &S)
void EmitARCNoopIntrinsicUse(ArrayRef< llvm::Value * > values)
Emit a call to "clang.arc.noop.use", which consumes the result of a call that has operand bundle "cla...
void EmitAnyExprToMem(const Expr *E, Address Location, Qualifiers Quals, bool IsInitializer)
EmitAnyExprToMem - Emits the code necessary to evaluate an arbitrary expression into the given memory...
RValue EmitAnyExpr(const Expr *E, AggValueSlot aggSlot=AggValueSlot::ignored(), bool ignoreResult=false)
EmitAnyExpr - Emit code to compute the specified expression which can have any type.
void EmitStmt(const Stmt *S, ArrayRef< const Attr * > Attrs={})
EmitStmt - Emit the code for the statement.
bool AutoreleaseResult
In ARC, whether we should autorelease the return value.
CleanupKind getCleanupKind(QualType::DestructionKind kind)
llvm::CallInst * EmitRuntimeCall(llvm::FunctionCallee callee, const Twine &name="")
uint64_t getCurrentProfileCount()
Get the profiler's current count.
llvm::Value * EmitARCRetainNonBlock(llvm::Value *value)
Retain the given object, with normal retain semantics.
llvm::Type * ConvertTypeForMem(QualType T)
void generateObjCGetterBody(const ObjCImplementationDecl *classImpl, const ObjCPropertyImplDecl *propImpl, const ObjCMethodDecl *GetterMothodDecl, llvm::Constant *AtomicHelperFn)
llvm::Value * EmitARCRetainAutoreleaseNonBlock(llvm::Value *value)
Do a fused retain/autorelease of the given object.
llvm::Value * EmitObjCAutoreleasePoolPush()
Produce the code to do a objc_autoreleasepool_push.
void GenerateObjCSetter(ObjCImplementationDecl *IMP, const ObjCPropertyImplDecl *PID)
GenerateObjCSetter - Synthesize an Objective-C property setter function for the given property.
llvm::Value * EmitARCLoadWeak(Address addr)
i8* @objc_loadWeak(i8** addr) Essentially objc_autorelease(objc_loadWeakRetained(addr)).
CodeGenTypes & getTypes() const
static TypeEvaluationKind getEvaluationKind(QualType T)
getEvaluationKind - Return the TypeEvaluationKind of QualType T.
llvm::Constant * GenerateObjCAtomicGetterCopyHelperFunction(const ObjCPropertyImplDecl *PID)
RawAddress CreateMemTemp(QualType T, const Twine &Name="tmp", RawAddress *Alloca=nullptr)
CreateMemTemp - Create a temporary memory object of the given type, with appropriate alignmen and cas...
llvm::Value * EmitObjCExtendObjectLifetime(QualType T, llvm::Value *Ptr)
AggValueSlot::Overlap_t getOverlapForReturnValue()
Determine whether a return value slot may overlap some other object.
void EmitAggExpr(const Expr *E, AggValueSlot AS)
EmitAggExpr - Emit the computation of the specified expression of aggregate type.
llvm::Value * EmitBuiltinAvailable(const VersionTuple &Version)
llvm::Value * EmitScalarExpr(const Expr *E, bool IgnoreResultAssign=false)
EmitScalarExpr - Emit the computation of the specified expression of LLVM scalar type,...
void EmitCallArgs(CallArgList &Args, PrototypeWrapper Prototype, llvm::iterator_range< CallExpr::const_arg_iterator > ArgRange, AbstractCallee AC=AbstractCallee(), unsigned ParamsToSkip=0, EvaluationOrder Order=EvaluationOrder::Default)
EmitCallArgs - Emit call arguments for a function.
LValue MakeAddrLValue(Address Addr, QualType T, AlignmentSource Source=AlignmentSource::Type)
void EmitReturnStmt(const ReturnStmt &S)
EmitReturnStmt - Note that due to GCC extensions, this can have an operand if the function returns vo...
void FinishFunction(SourceLocation EndLoc=SourceLocation())
FinishFunction - Complete IR generation of the current function.
llvm::Value * EmitARCStoreStrongCall(Address addr, llvm::Value *value, bool resultIgnored)
Store into a strong object.
uint64_t getProfileCount(const Stmt *S)
Get the profiler's count for the given statement.
Address GetAddrOfLocalVar(const VarDecl *VD)
GetAddrOfLocalVar - Return the address of a local variable.
llvm::Value * EmitObjCStringLiteral(const ObjCStringLiteral *E)
Emits an instance of NSConstantString representing the object.
std::pair< llvm::Value *, llvm::Value * > ComplexPairTy
Address ReturnValue
ReturnValue - The temporary alloca to hold the return value.
ConstantEmission tryEmitAsConstant(const DeclRefExpr *RefExpr)
Try to emit a reference to the given value without producing it as an l-value.
void EmitObjCMRRAutoreleasePoolPop(llvm::Value *Ptr)
Produce the code to do a primitive release.
LValue EmitLValue(const Expr *E, KnownNonNull_t IsKnownNonNull=NotKnownNonNull)
EmitLValue - Emit code to compute a designator that specifies the location of the expression.
llvm::Value * EmitARCExtendBlockObject(const Expr *expr)
llvm::Value * EmitARCStoreWeak(Address addr, llvm::Value *value, bool ignored)
i8* @objc_storeWeak(i8** addr, i8* value) Returns value.
llvm::LLVMContext & getLLVMContext()
static Destroyer destroyARCStrongPrecise
void incrementProfileCounter(const Stmt *S, llvm::Value *StepV=nullptr)
Increment the profiler's counter for the given statement by StepV.
void EmitObjCForCollectionStmt(const ObjCForCollectionStmt &S)
void EmitObjCAutoreleasePoolPop(llvm::Value *Ptr)
Produce the code to do a primitive release.
llvm::Value * EmitObjCRetainNonBlock(llvm::Value *value, llvm::Type *returnType)
Retain the given object, with normal retain semantics.
void EmitARCCopyWeak(Address dst, Address src)
void @objc_copyWeak(i8** dest, i8** src) Disregards the current value in dest.
void emitARCCopyAssignWeak(QualType Ty, Address DstAddr, Address SrcAddr)
static Destroyer emitARCIntrinsicUse
void EmitARCIntrinsicUse(ArrayRef< llvm::Value * > values)
Given a number of pointers, inform the optimizer that they're being intrinsically used up until this ...
void EmitStoreOfScalar(llvm::Value *Value, Address Addr, bool Volatile, QualType Ty, AlignmentSource Source=AlignmentSource::Type, bool isInit=false, bool isNontemporal=false)
EmitStoreOfScalar - Store a scalar value to an address, taking care to appropriately convert from the...
void EmitBlock(llvm::BasicBlock *BB, bool IsFinished=false)
EmitBlock - Emit the given block.
This class organizes the cross-function state that is used while generating LLVM code.
llvm::Module & getModule() const
llvm::FunctionCallee CreateRuntimeFunction(llvm::FunctionType *Ty, StringRef Name, llvm::AttributeList ExtraAttrs=llvm::AttributeList(), bool Local=false, bool AssumeConvergent=false)
Create or return a runtime function declaration with the specified type and name.
void addCompilerUsedGlobal(llvm::GlobalValue *GV)
Add a global to a list to be added to the llvm.compiler.used metadata.
const LangOptions & getLangOpts() const
const TargetInfo & getTarget() const
ObjCEntrypoints & getObjCEntrypoints() const
const llvm::Triple & getTriple() const
ASTContext & getContext() const
const TargetCodeGenInfo & getTargetCodeGenInfo()
const CodeGenOptions & getCodeGenOpts() const
llvm::LLVMContext & getLLVMContext()
llvm::Function * getIntrinsic(unsigned IID, ArrayRef< llvm::Type * > Tys={})
CGObjCRuntime & getObjCRuntime()
Return a reference to the configured Objective-C runtime.
llvm::FunctionCallee IsPlatformVersionAtLeastFn
llvm::ConstantInt * getSize(CharUnits numChars)
Emit the given number of characters as a value of type size_t.
This class organizes the cross-module state that is used while lowering AST types to LLVM types.
llvm::Type * ConvertType(QualType T)
ConvertType - Convert type T into a llvm::Type.
const CGFunctionInfo & arrangeBuiltinFunctionCall(QualType resultType, const CallArgList &args)
llvm::Constant * tryEmitAbstract(const Expr *E, QualType T)
Try to emit the result of the given expression as an abstract constant.
FunctionArgList - Type for representing both the decl and type of parameters to a function.
LValue - This represents an lvalue references.
CharUnits getAlignment() const
llvm::Value * getPointer(CodeGenFunction &CGF) const
const Qualifiers & getQuals() const
Address getAddress() const
ARCPreciseLifetime_t isARCPreciseLifetime() const
RValue - This trivial value class is used to represent the result of an expression that is evaluated.
static RValue get(llvm::Value *V)
llvm::Value * getScalarVal() const
getScalarVal() - Return the Value* of this scalar value.
ReturnValueSlot - Contains the address where the return value of a function can be stored,...
virtual StringRef getARCRetainAutoreleasedReturnValueMarker() const
Retrieve the address of a function to call immediately before calling objc_retainAutoreleasedReturnVa...
virtual bool markARCOptimizedReturnCallsAsNoTail() const
Determine whether a call to objc_retainAutoreleasedReturnValue or objc_unsafeClaimAutoreleasedReturnV...
CompoundStmt - This represents a group of statements like { stmt stmt }.
SourceLocation getLBracLoc() const
SourceLocation getRBracLoc() const
A reference to a declared variable, function, enum, etc.
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
SourceLocation getBodyRBrace() const
getBodyRBrace - Gets the right brace of the body, if a body exists.
SourceLocation getLocation() const
DeclContext * getDeclContext()
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
This represents one expression.
Expr * IgnoreParenCasts() LLVM_READONLY
Skip past any parentheses and casts which might surround this expression until reaching a fixed point...
Expr * IgnoreParens() LLVM_READONLY
Skip past any parentheses which might surround this expression until reaching a fixed point.
Represents difference between two FPOptions values.
Represents a member of a struct/union/class.
bool isBitField() const
Determines whether this field is a bitfield.
Represents a function declaration or definition.
static FunctionDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation NLoc, DeclarationName N, QualType T, TypeSourceInfo *TInfo, StorageClass SC, bool UsesFPIntrin=false, bool isInlineSpecified=false, bool hasWrittenPrototype=true, ConstexprSpecKind ConstexprKind=ConstexprSpecKind::Unspecified, const AssociatedConstraint &TrailingRequiresClause={})
GlobalDecl - represents a global declaration.
One of these records is kept for each identifier that is lexed.
bool isStr(const char(&Str)[StrLen]) const
Return true if this is the identifier for the specified string.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
clang::ObjCRuntime ObjCRuntime
This represents a decl that may have a name.
@ VisibilityForValue
Do an LV computation for, ultimately, a non-type declaration.
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp,...
Expr * getElement(unsigned Index)
getElement - Return the Element at the specified index.
unsigned getNumElements() const
getNumElements - Return number of elements of objective-c array literal.
ObjCMethodDecl * getArrayWithObjectsMethod() const
Represents Objective-C's @synchronized statement.
Represents Objective-C's @throw statement.
Represents Objective-C's @try ... @catch ... @finally statement.
Represents Objective-C's @autoreleasepool Statement.
const Stmt * getSubStmt() const
ObjCBoxedExpr - used for generalized expression boxing.
ObjCMethodDecl * getBoxingMethod() const
ObjCContainerDecl - Represents a container for method declarations.
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
unsigned getNumElements() const
getNumElements - Return number of elements of objective-c dictionary literal.
ObjCMethodDecl * getDictWithObjectsMethod() const
ObjCDictionaryElement getKeyValueElement(unsigned Index) const
Represents Objective-C's collection statement.
SourceLocation getBeginLoc() const LLVM_READONLY
const ObjCInterfaceDecl * getClassInterface() const
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Represents an ObjC class declaration.
ObjCIvarDecl * all_declared_ivar_begin()
all_declared_ivar_begin - return first ivar declared in this class, its extensions and its implementa...
ObjCInterfaceDecl * getSuperClass() const
Represents typeof(type), a C23 feature and GCC extension, or `typeof_unqual(type),...
ObjCInterfaceDecl * getDecl() const
Get the declaration of this interface.
ObjCIvarDecl - Represents an ObjC instance variable.
ObjCIvarDecl * getNextIvar()
ObjCIvarRefExpr - A reference to an ObjC instance variable.
An expression that sends a message to the given Objective-C object or class.
bool isDelegateInitCall() const
isDelegateInitCall - Answers whether this message send has been tagged as a "delegate init call",...
Expr * getInstanceReceiver()
Returns the object expression (receiver) for an instance message, or null for a message that is not a...
Selector getSelector() const
@ SuperInstance
The receiver is the instance of the superclass object.
@ Instance
The receiver is an object instance.
@ SuperClass
The receiver is a superclass.
@ Class
The receiver is a class.
QualType getClassReceiver() const
Returns the type of a class message send, or NULL if the message is not a class message.
llvm::iterator_range< arg_iterator > arguments()
QualType getSuperType() const
Retrieve the type referred to by 'super'.
const ObjCMethodDecl * getMethodDecl() const
ReceiverKind getReceiverKind() const
Determine the kind of receiver that this message is being sent to.
ObjCMethodDecl - Represents an instance or class method declaration.
ImplicitParamDecl * getSelfDecl() const
ArrayRef< ParmVarDecl * > parameters() const
const ObjCPropertyDecl * findPropertyDecl(bool CheckOverrides=true) const
Returns the property associated with this method's selector.
param_const_iterator param_end() const
param_const_iterator param_begin() const
Stmt * getBody() const override
Retrieve the body of this method, if it has one.
SourceLocation getEndLoc() const LLVM_READONLY
const ParmVarDecl *const * param_const_iterator
SourceLocation getBeginLoc() const LLVM_READONLY
bool isDirectMethod() const
True if the method is tagged as objc_direct.
Selector getSelector() const
ImplicitParamDecl * getCmdDecl() const
bool isInstanceMethod() const
ObjCMethodFamily getMethodFamily() const
Determines the family of this method.
void createImplicitParams(ASTContext &Context, const ObjCInterfaceDecl *ID)
createImplicitParams - Used to lazily create the self and cmd implicit parameters.
QualType getReturnType() const
bool isClassMethod() const
ObjCInterfaceDecl * getClassInterface()
bool isExpressibleAsConstantInitializer() const
Represents a pointer to an Objective C object.
const ObjCObjectType * getObjectType() const
Gets the type pointed to by this ObjC pointer.
QualType getPointeeType() const
Gets the type pointed to by this ObjC pointer.
const ObjCInterfaceType * getInterfaceType() const
If this pointer points to an Objective C @interface type, gets the type for that interface.
Represents one property declaration in an Objective-C interface.
bool isAtomic() const
isAtomic - Return true if the property is atomic.
SetterKind getSetterKind() const
getSetterKind - Return the method used for doing assignment in the property setter.
ObjCPropertyAttribute::Kind getPropertyAttributes() const
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
ObjCIvarDecl * getPropertyIvarDecl() const
Expr * getSetterCXXAssignment() const
ObjCPropertyDecl * getPropertyDecl() const
Expr * getGetterCXXConstructor() const
ObjCMethodDecl * getSetterMethodDecl() const
ObjCMethodDecl * getGetterMethodDecl() const
Represents an Objective-C protocol declaration.
bool isNonRuntimeProtocol() const
This is true iff the protocol is tagged with the objc_non_runtime_protocol attribute.
ObjCProtocolList::iterator protocol_iterator
ObjCProtocolDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this Objective-C protocol.
protocol_range protocols() const
ObjCProtocolExpr used for protocol expression in Objective-C.
ObjCProtocolDecl * getProtocol() const
The basic abstraction for the target Objective-C runtime.
bool hasAtomicCopyHelper() const
bool hasNativeARC() const
Does this runtime natively provide the ARC entrypoints?
bool hasOptimizedSetter() const
Does this runtime supports optimized setter entrypoints?
ObjCSelectorExpr used for @selector in Objective-C.
Selector getSelector() const
ObjCStringLiteral, used for Objective-C string literals i.e.
StringLiteral * getString()
Represents a parameter to a function.
static ParmVarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, Expr *DefArg)
Pointer-authentication qualifiers.
semantics_iterator semantics_end()
semantics_iterator semantics_begin()
const Expr *const * const_semantics_iterator
Expr * getResultExpr()
Return the result-bearing expression, or null if there is none.
A (possibly-)qualified type.
bool isVolatileQualified() const
Determine whether this type is volatile-qualified.
PointerAuthQualifier getPointerAuth() const
@ DK_objc_strong_lifetime
QualType withConst() const
void addConst()
Add the const type qualifier to this QualType.
PrimitiveCopyKind isNonTrivialToPrimitiveCopy() const
Check if this is a non-trivial type that would cause a C struct transitively containing this type to ...
Qualifiers::ObjCLifetime getObjCLifetime() const
Returns lifetime attribute of this type.
QualType getNonReferenceType() const
If Type is a reference type (e.g., const int&), returns the type that the reference refers to ("const...
QualType getCanonicalType() const
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
bool hasNonTrivialObjCLifetime() const
@ PCK_Struct
The type is a struct containing a field whose type is neither PCK_Trivial nor PCK_VolatileTrivial.
The collection of all-type qualifiers we support.
@ OCL_Strong
Assigning into this object requires the old value to be released and the new value to be retained.
@ OCL_ExplicitNone
This object can be modified without requiring retains or releases.
@ OCL_None
There is no lifetime qualification on this type.
@ OCL_Weak
Reading or writing from this object requires a barrier call.
@ OCL_Autoreleasing
Assigning into this object requires a lifetime extension.
ObjCLifetime getObjCLifetime() const
void setObjCLifetime(ObjCLifetime type)
static ReturnStmt * Create(const ASTContext &Ctx, SourceLocation RL, Expr *E, const VarDecl *NRVOCandidate)
Create a return statement.
Scope - A scope is a transient data structure that is used while parsing the program.
Selector getNullarySelector(const IdentifierInfo *ID)
Selector getSelector(unsigned NumArgs, const IdentifierInfo **IIV)
Can create any sort of selector.
Smart pointer class that efficiently represents Objective-C method names.
StringRef getNameForSlot(unsigned argIndex) const
Retrieve the name at a given position in the selector.
const IdentifierInfo * getIdentifierInfoForSlot(unsigned argIndex) const
Retrieve the identifier at a given position in the selector.
bool isKeywordSelector() const
ObjCMethodFamily getMethodFamily() const
Derive the conventional family of this method.
bool isUnarySelector() const
unsigned getNumArgs() const
Encodes a location in the source.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
Stmt - This represents one statement.
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
SourceLocation getBeginLoc() const LLVM_READONLY
Exposes information about the current target.
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
Token - This structure provides full information about a lexed token.
bool isBlockPointerType() const
RecordDecl * getAsRecordDecl() const
Retrieves the RecordDecl this type refers to.
bool isPointerType() const
const T * castAs() const
Member-template castAs<specific type>.
bool isReferenceType() const
const ObjCObjectPointerType * getAsObjCInterfacePointerType() const
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isAtomicType() const
bool isObjCObjectPointerType() const
bool isObjCClassType() const
bool isRecordType() const
bool isObjCRetainableType() const
bool hasPointerRepresentation() const
Whether this type is represented natively as a pointer.
bool hasBooleanRepresentation() const
Determine whether this type has a boolean representation – i.e., it is a boolean type,...
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
static UnaryOperator * Create(const ASTContext &C, Expr *input, Opcode opc, QualType type, ExprValueKind VK, ExprObjectKind OK, SourceLocation l, bool CanOverflow, FPOptionsOverride FPFeatures)
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Represents a variable declaration or definition.
bool isARCPseudoStrong() const
Determine whether this variable is an ARC pseudo-__strong variable.
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
llvm::Function * getNonTrivialCStructCopyConstructor(CodeGenModule &CGM, CharUnits DstAlignment, CharUnits SrcAlignment, bool IsVolatile, QualType QT)
Returns the copy constructor for a C struct with non-trivially copyable fields, generating it if nece...
@ NormalCleanup
Denotes a cleanup that should run when a scope is exited using normal control flow (falling off the e...
@ EHCleanup
Denotes a cleanup that should run when a scope is exited using exceptional control flow (a throw stat...
llvm::Function * getNonTrivialCStructMoveAssignmentOperator(CodeGenModule &CGM, CharUnits DstAlignment, CharUnits SrcAlignment, bool IsVolatile, QualType QT)
Return the move assignment operator for a C struct with non-trivially copyable fields,...
ARCPreciseLifetime_t
Does an ARC strong l-value have precise lifetime?
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
const internal::VariadicDynCastAllOfMatcher< Stmt, Expr > expr
Matches expressions.
The JSON file list parser is used to communicate input to InstallAPI.
bool isa(CodeGen::Address addr)
@ OK_Ordinary
An ordinary object is located at an address in memory.
@ Self
'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
Selector GetUnarySelector(StringRef name, ASTContext &Ctx)
Utility function for constructing an unary selector.
@ Result
The result type of a method or function.
CastKind
CastKind - The kind of operation required for a conversion.
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
@ VK_LValue
An l-value expression is a reference to an object with independent storage.
U cast(CodeGen::Address addr)
@ Class
The "class" keyword introduces the elaborated-type-specifier.
A jump destination is an abstract label, branching to which may require a jump out through normal cle...
llvm::BasicBlock * getBlock() const
llvm::PointerType * VoidPtrTy
llvm::PointerType * Int8PtrPtrTy
unsigned char PointerSizeInBytes
llvm::IntegerType * Int32Ty
unsigned char PointerAlignInBytes
llvm::PointerType * Int8PtrTy
CharUnits getPointerAlign() const
llvm::Function * objc_retainAutoreleasedReturnValue
id objc_retainAutoreleasedReturnValue(id);
llvm::InlineAsm * retainAutoreleasedReturnValueMarker
A void(void) inline asm to use to mark that the return value of a call will be immediately retain.
llvm::Function * objc_unsafeClaimAutoreleasedReturnValue
id objc_unsafeClaimAutoreleasedReturnValue(id);
Expr * Value
The value of the dictionary element.
Expr * Key
The key for the dictionary element.