;
34template<
class T,
class P,
class... ToCompare>
36 returnstd::is_same_v<T, P> ||
isOneOf<
T, ToCompare...>();
42structGeneralizedReturnsRetainedAttr {
43 static boolclassof(
const Attr*A) {
44 if(
autoAA = dyn_cast<AnnotateAttr>(A))
45 returnAA->getAnnotation() ==
"rc_ownership_returns_retained";
50structGeneralizedReturnsNotRetainedAttr {
51 static boolclassof(
const Attr*A) {
52 if(
autoAA = dyn_cast<AnnotateAttr>(A))
53 returnAA->getAnnotation() ==
"rc_ownership_returns_not_retained";
58structGeneralizedConsumedAttr {
59 static boolclassof(
const Attr*A) {
60 if(
autoAA = dyn_cast<AnnotateAttr>(A))
61 returnAA->getAnnotation() ==
"rc_ownership_consumed";
69std::optional<ObjKind> RetainSummaryManager::hasAnyEnabledAttrOf(
const Decl*
D,
72 if(
isOneOf<
T, CFConsumedAttr, CFReturnsRetainedAttr,
73CFReturnsNotRetainedAttr>()) {
74 if(!TrackObjCAndCFObjects)
78}
else if(
isOneOf<
T, NSConsumedAttr, NSConsumesSelfAttr,
79NSReturnsAutoreleasedAttr, NSReturnsRetainedAttr,
80NSReturnsNotRetainedAttr, NSConsumesSelfAttr>()) {
82 if(!TrackObjCAndCFObjects)
85 if(
isOneOf<
T, NSReturnsRetainedAttr, NSReturnsAutoreleasedAttr,
86NSReturnsNotRetainedAttr>() &&
90}
else if(
isOneOf<
T, OSConsumedAttr, OSConsumesThisAttr,
91OSReturnsNotRetainedAttr, OSReturnsRetainedAttr,
92OSReturnsRetainedOnZeroAttr,
93OSReturnsRetainedOnNonZeroAttr>()) {
97}
else if(
isOneOf<
T, GeneralizedReturnsNotRetainedAttr,
98GeneralizedReturnsRetainedAttr,
99GeneralizedConsumedAttr>()) {
102llvm_unreachable(
"Unexpected attribute");
109template<
classT1,
classT2,
class... Others>
110std::optional<ObjKind> RetainSummaryManager::hasAnyEnabledAttrOf(
const Decl*
D,
112 if(
autoOut = hasAnyEnabledAttrOf<T1>(
D, QT))
114 returnhasAnyEnabledAttrOf<T2, Others...>(
D, QT);
118RetainSummaryManager::getPersistentSummary(
const RetainSummary&OldSumm) {
121::llvm::FoldingSetNodeID
ID;
125CachedSummaryNode *N = SimpleSummaries.FindNodeOrInsertPos(ID, Pos);
128N = (CachedSummaryNode *) BPAlloc.Allocate<CachedSummaryNode>();
129 new(N) CachedSummaryNode(OldSumm);
130SimpleSummaries.InsertNode(N, Pos);
133 return&N->getValue();
142StringRef ClassName) {
143 using namespaceast_matchers;
150 using namespaceast_matchers;
164 returnS ==
"requiredMetaCast";
168 returnS ==
"metaCast";
177 returnStringRef(Ty.
getAsString()).starts_with(
"isl_");
186 if(Ann->getAnnotation() == rcAnnotation)
193 returnFName.starts_with_insensitive(
"retain") ||
194FName.ends_with_insensitive(
"retain");
198 returnFName.starts_with_insensitive(
"release") ||
199FName.ends_with_insensitive(
"release");
203 returnFName.starts_with_insensitive(
"autorelease") ||
204FName.ends_with_insensitive(
"autorelease");
208 returnFName.contains_insensitive(
"MakeCollectable");
235 if(II && II->
getName() ==
"smart_ptr")
236 if(
const auto*ND = dyn_cast<NamespaceDecl>(RD->getDeclContext()))
237 if(ND->getNameAsString() ==
"os")
243RetainSummaryManager::getSummaryForOSObject(
const FunctionDecl*FD,
245assert(TrackOSObjects &&
246 "Requesting a summary for an OSObject but OSObjects are not tracked");
253 returngetDefaultSummary();
258 if(FName.ends_with(
"Matching")) {
259 returngetPersistentStopSummary();
264 if((!FName.starts_with(
"get") && !FName.starts_with(
"Get")) ||
266 returngetOSSummaryCreateRule(FD);
268 returngetOSSummaryGetRule(FD);
273 if(
const auto*MD = dyn_cast<CXXMethodDecl>(FD)) {
276 if(FName ==
"release"|| FName ==
"taggedRelease")
277 returngetOSSummaryReleaseRule(FD);
279 if(FName ==
"retain"|| FName ==
"taggedRetain")
280 returngetOSSummaryRetainRule(FD);
282 if(FName ==
"free")
283 returngetOSSummaryFreeRule(FD);
285 if(MD->getOverloadedOperator() == OO_New)
286 returngetOSSummaryCreateRule(MD);
293const RetainSummary*RetainSummaryManager::getSummaryForObjCOrCFObject(
298 bool&AllowAnnotations) {
303 if(FName ==
"pthread_create"|| FName ==
"pthread_setspecific") {
307 returngetPersistentStopSummary();
308}
else if(FName ==
"NSMakeCollectable") {
310AllowAnnotations =
false;
312: getPersistentStopSummary();
313}
else if(FName ==
"CMBufferQueueDequeueAndRetain"||
314FName ==
"CMBufferQueueDequeueIfDataReadyAndRetain") {
321}
else if(FName ==
"CFPlugInInstanceCreate") {
323}
else if(FName ==
"IORegistryEntrySearchCFProperty"||
324(RetTyName ==
"CFMutableDictionaryRef"&&
325(FName ==
"IOBSDNameMatching"|| FName ==
"IOServiceMatching"||
326FName ==
"IOServiceNameMatching"||
327FName ==
"IORegistryEntryIDMatching"||
328FName ==
"IOOpenFirmwarePathMatching"))) {
333}
else if(FName ==
"IOServiceGetMatchingService"||
334FName ==
"IOServiceGetMatchingServices") {
341}
else if(FName ==
"IOServiceAddNotification"||
342FName ==
"IOServiceAddMatchingNotification") {
349}
else if(FName ==
"CVPixelBufferCreateWithBytes") {
360}
else if(FName ==
"CGBitmapContextCreateWithData") {
368}
else if(FName ==
"CVPixelBufferCreateWithPlanarBytes") {
374}
else if(FName ==
"VTCompressionSessionEncodeFrame"||
375FName ==
"VTCompressionSessionEncodeMultiImageFrame") {
385}
else if(FName ==
"dispatch_set_context"||
386FName ==
"xpc_connection_set_context") {
395}
else if(FName.starts_with(
"NSLog")) {
396 returngetDoNothingSummary();
397}
else if(FName.starts_with(
"NS") && FName.contains(
"Insert")) {
416AllowAnnotations =
false;
418 returngetUnarySummary(FT,
IncRef);
422AllowAnnotations =
false;
426AllowAnnotations =
false;
429 returngetCFCreateGetRuleSummary(FD);
437 returngetUnarySummary(FT,
IncRef);
439 returngetCFCreateGetRuleSummary(FD);
446 returngetCFCreateGetRuleSummary(FD);
449 if(FD->
hasAttr<CFAuditedTransferAttr>()) {
450 returngetCFCreateGetRuleSummary(FD);
456 if(FName.starts_with(
"CG") || FName.starts_with(
"CF")) {
458FName = FName.substr(FName.starts_with(
"CGCF") ? 4 : 2);
461 returngetUnarySummary(FT,
DecRef);
463assert(ScratchArgs.isEmpty());
480(StrInStrNoCase(FName,
"InsertValue") != StringRef::npos ||
481StrInStrNoCase(FName,
"AddValue") != StringRef::npos ||
482StrInStrNoCase(FName,
"SetValue") != StringRef::npos ||
483StrInStrNoCase(FName,
"AppendValue") != StringRef::npos ||
484StrInStrNoCase(FName,
"SetAttribute") != StringRef::npos)
497RetainSummaryManager::generateSummary(
const FunctionDecl*FD,
498 bool&AllowAnnotations) {
501 returngetPersistentStopSummary();
505StringRef FName = II ? II->
getName() :
"";
509FName = FName.substr(FName.find_first_not_of(
'_'));
516 if(
const RetainSummary*S = getSummaryForOSObject(FD, FName, RetTy))
519 if(
const auto*MD = dyn_cast<CXXMethodDecl>(FD))
527 if(TrackObjCAndCFObjects)
529getSummaryForObjCOrCFObject(FD, FName, RetTy, FT, AllowAnnotations))
532 returngetDefaultSummary();
536RetainSummaryManager::getFunctionSummary(
const FunctionDecl*FD) {
539 returngetDefaultSummary();
542FuncSummariesTy::iterator I = FuncSummaries.find(FD);
543 if(I != FuncSummaries.end())
547 boolAllowAnnotations =
true;
548 const RetainSummary*S = generateSummary(FD, AllowAnnotations);
551 if(AllowAnnotations)
552updateSummaryFromAnnotations(S, FD);
554FuncSummaries[FD] = S;
563 switch(
E.getKind()) {
583llvm_unreachable(
"Unknown ArgEffect kind");
587RetainSummaryManager::updateSummaryForNonZeroCallbackArg(
const RetainSummary*S,
593 ArgEffectsCustomArgEffects = S->getArgEffects();
594 for(ArgEffects::iterator I = CustomArgEffects.begin(),
595 E= CustomArgEffects.end();
599ScratchArgs = AF.add(ScratchArgs, I->first, Translated);
612 if(Name->isStr(
"CGBitmapContextCreateWithData") ||
613Name->isStr(
"dispatch_data_create"))
614RE = S->getRetEffect();
617 returngetPersistentSummary(RE, ScratchArgs, RecEffect, DefEffect);
620voidRetainSummaryManager::updateSummaryForReceiverUnconsumedSelf(
630voidRetainSummaryManager::updateSummaryForArgumentTypes(
634 unsignedparm_idx = 0;
635 for(
autopi =
C.param_begin(), pe =
C.param_end(); pi != pe;
656Template->addArg(AF, parm_idx,
663 boolHasNonZeroCallbackArg,
664 boolIsReceiverUnconsumedSelf,
667 switch(
C.getKind()) {
673Summ = getFunctionSummary(cast_or_null<FunctionDecl>(
C.getDecl()));
678 returngetPersistentStopSummary();
680 const auto*ME = cast_or_null<ObjCMessageExpr>(
C.getExpr());
682Summ = getMethodSummary(cast<ObjCMethodDecl>(
C.getDecl()));
683}
else if(ME->isInstanceMessage()) {
684Summ = getInstanceMethodSummary(ME, ReceiverType);
686Summ = getClassMethodSummary(ME);
692 if(HasNonZeroCallbackArg)
693Summ = updateSummaryForNonZeroCallbackArg(Summ,
C);
695 if(IsReceiverUnconsumedSelf)
696updateSummaryForReceiverUnconsumedSelf(Summ);
698updateSummaryForArgumentTypes(
C, Summ);
700assert(Summ &&
"Unknown call type?");
706RetainSummaryManager::getCFCreateGetRuleSummary(
const FunctionDecl*FD) {
708 returngetCFSummaryCreateRule(FD);
710 returngetCFSummaryGetRule(FD);
718std::optional<RetainSummaryManager::BehaviorSummary>
720 bool&hasTrustedImplementationAnnotation) {
726StringRef FName = II->
getName();
727FName = FName.substr(FName.find_first_not_of(
'_'));
731 if(II->
isStr(
"NSMakeCollectable"))
737 if(FName ==
"CMBufferQueueDequeueAndRetain"||
738FName ==
"CMBufferQueueDequeueIfDataReadyAndRetain") {
756 if(TrackOSObjects) {
762!cast<CXXMethodDecl>(FD)->isStatic()) {
769hasTrustedImplementationAnnotation =
true;
774 if(
const auto*MD = dyn_cast<CXXMethodDecl>(FD)) {
777 if(FName ==
"release"|| FName ==
"retain")
785RetainSummaryManager::getUnarySummary(
const FunctionType* FT,
795 returngetPersistentStopSummary();
799ScratchArgs = AF.add(ScratchArgs, 0, Effect);
806RetainSummaryManager::getOSSummaryRetainRule(
const FunctionDecl*FD) {
815RetainSummaryManager::getOSSummaryReleaseRule(
const FunctionDecl*FD) {
824RetainSummaryManager::getOSSummaryFreeRule(
const FunctionDecl*FD) {
833RetainSummaryManager::getOSSummaryCreateRule(
const FunctionDecl*FD) {
839RetainSummaryManager::getOSSummaryGetRule(
const FunctionDecl*FD) {
845RetainSummaryManager::getCFSummaryCreateRule(
const FunctionDecl*FD) {
851RetainSummaryManager::getCFSummaryGetRule(
const FunctionDecl*FD) {
864std::optional<RetEffect>
865RetainSummaryManager::getRetEffectFromAnnotations(
QualTypeRetTy,
867 if(hasAnyEnabledAttrOf<NSReturnsRetainedAttr>(
D, RetTy))
868 returnObjCAllocRetE;
870 if(
autoK = hasAnyEnabledAttrOf<CFReturnsRetainedAttr, OSReturnsRetainedAttr,
871GeneralizedReturnsRetainedAttr>(
D, RetTy))
874 if(
autoK = hasAnyEnabledAttrOf<
875CFReturnsNotRetainedAttr, OSReturnsNotRetainedAttr,
876GeneralizedReturnsNotRetainedAttr, NSReturnsNotRetainedAttr,
877NSReturnsAutoreleasedAttr>(
D, RetTy))
880 if(
const auto*MD = dyn_cast<CXXMethodDecl>(
D))
881 for(
const auto*PD : MD->overridden_methods())
882 if(
autoRE = getRetEffectFromAnnotations(RetTy, PD))
893 const auto&Context =
T->getDecl()->getASTContext();
894 if(
T->getDecl()->getIdentifier() == &Context.
Idents.
get(Name))
896QT =
T->getDecl()->getUnderlyingType();
902 if(
const auto*FD = dyn_cast<FunctionDecl>(ND)) {
904}
else if(
const auto*MD = dyn_cast<ObjCMethodDecl>(ND)) {
905 returnMD->getReturnType();
907llvm_unreachable(
"Unexpected decl");
911boolRetainSummaryManager::applyParamAnnotationEffect(
916hasAnyEnabledAttrOf<NSConsumedAttr, CFConsumedAttr, OSConsumedAttr,
917GeneralizedConsumedAttr>(pd, QT)) {
920}
else if(
autoK = hasAnyEnabledAttrOf<
921CFReturnsRetainedAttr, OSReturnsRetainedAttr,
922OSReturnsRetainedOnNonZeroAttr, OSReturnsRetainedOnZeroAttr,
923GeneralizedReturnsRetainedAttr>(pd, QT)) {
930 boolHasRetainedOnZero = pd->
hasAttr<OSReturnsRetainedOnZeroAttr>();
931 boolHasRetainedOnNonZero = pd->
hasAttr<OSReturnsRetainedOnNonZeroAttr>();
942 if(ShouldSplit && SuccessOnZero) {
944}
else if(ShouldSplit && (!SuccessOnZero || HasRetainedOnNonZero)) {
955}
else if(
autoK = hasAnyEnabledAttrOf<CFReturnsNotRetainedAttr,
956OSReturnsNotRetainedAttr,
957GeneralizedReturnsNotRetainedAttr>(
963 if(
const auto*MD = dyn_cast<CXXMethodDecl>(FD)) {
964 for(
const auto*OD : MD->overridden_methods()) {
965 const ParmVarDecl*OP = OD->parameters()[parm_idx];
966 if(applyParamAnnotationEffect(OP, parm_idx, OD, Template))
975RetainSummaryManager::updateSummaryFromAnnotations(
const RetainSummary*&Summ,
980assert(Summ &&
"Must have a summary to add annotations to.");
984 unsignedparm_idx = 0;
986pe = FD->
param_end(); pi != pe; ++pi, ++parm_idx)
987applyParamAnnotationEffect(*pi, parm_idx, FD, Template);
990 if(std::optional<RetEffect> RetE = getRetEffectFromAnnotations(RetTy, FD))
993 if(hasAnyEnabledAttrOf<OSConsumesThisAttr>(FD, RetTy))
998RetainSummaryManager::updateSummaryFromAnnotations(
const RetainSummary*&Summ,
1003assert(Summ &&
"Must have a valid summary to add annotations to");
1007 if(hasAnyEnabledAttrOf<NSConsumesSelfAttr>(MD, MD->
getReturnType()))
1011 unsignedparm_idx = 0;
1014applyParamAnnotationEffect(*pi, parm_idx, MD, Template);
1017 if(std::optional<RetEffect> RetE = getRetEffectFromAnnotations(RetTy, MD))
1022RetainSummaryManager::getStandardMethodSummary(
const ObjCMethodDecl*MD,
1044 switch(S.getMethodFamily()) {
1061ResultEff = ObjCInitRetE;
1069ResultEff = ObjCAllocRetE;
1098 if(S.isKeywordSelector()) {
1099 for(
unsignedi = 0, e = S.getNumArgs(); i != e; ++i) {
1100StringRef Slot = S.getNameForSlot(i);
1101 if(Slot.ends_with_insensitive(
"delegate")) {
1102 if(ResultEff == ObjCInitRetE)
1112 returngetDefaultSummary();
1114 returngetPersistentSummary(ResultEff,
ArgEffects(AF.getEmptyMap()),
1119RetainSummaryManager::getClassMethodSummary(
const ObjCMessageExpr*ME) {
1124ME->
getType(), ObjCClassMethodSummaries);
1127const RetainSummary*RetainSummaryManager::getInstanceMethodSummary(
1134 if(!ReceiverType.
isNull())
1136ReceiverClass = PT->getInterfaceDecl();
1148 if(!Method && ReceiverClass)
1151 returngetMethodSummary(S, ReceiverClass, Method, ME->
getType(),
1152ObjCMethodSummaries);
1156RetainSummaryManager::getMethodSummary(
SelectorS,
1159ObjCMethodSummariesTy &CachedSummaries) {
1162 if(!TrackObjCAndCFObjects)
1163 returngetDefaultSummary();
1169Summ = getStandardMethodSummary(MD, S, RetTy);
1172updateSummaryFromAnnotations(Summ, MD);
1181voidRetainSummaryManager::InitializeClassMethodSummaries() {
1185addClassMethSummary(
"NSAssertionHandler",
"currentHandler",
1191addClassMethSummary(
"NSAutoreleasePool",
"addObject",
1197voidRetainSummaryManager::InitializeMethodSummaries() {
1212 const RetainSummary*AllocSumm = getPersistentSummary(ObjCAllocRetE,
1224Summ = getPersistentSummary(NoRet, ScratchArgs,
1246addClassMethSummary(
"NSWindow",
"alloc", NoTrackYet);
1252addClassMethSummary(
"NSPanel",
"alloc", NoTrackYet);
1256addClassMethSummary(
"NSNull",
"null", NoTrackYet);
1260addClassMethSummary(
"NSAutoreleasePool",
"alloc", NoTrackYet);
1261addClassMethSummary(
"NSAutoreleasePool",
"allocWithZone", NoTrackYet,
false);
1262addClassMethSummary(
"NSAutoreleasePool",
"new", NoTrackYet);
1265addInstMethSummary(
"QCRenderer", AllocSumm,
"createSnapshotImageOfType");
1266addInstMethSummary(
"QCView", AllocSumm,
"createSnapshotImageOfType");
1271addInstMethSummary(
"CIContext", CFAllocSumm,
"createCGImage",
"fromRect");
1272addInstMethSummary(
"CIContext", CFAllocSumm,
"createCGImage",
"fromRect",
1273 "format",
"colorSpace");
1274addInstMethSummary(
"CIContext", CFAllocSumm,
"createCGLayerWithSize",
"info");
1278RetainSummaryManager::getMethodSummary(
const ObjCMethodDecl*MD) {
1283ObjCMethodSummariesTy *CachedSummaries;
1285CachedSummaries = &ObjCMethodSummaries;
1287CachedSummaries = &ObjCClassMethodSummaries;
1289 returngetMethodSummary(S, ID, MD, ResultTy, *CachedSummaries);
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
static bool isSubclass(const ObjCInterfaceDecl *Class, const IdentifierInfo *II)
static bool isOSObjectRelated(const CXXMethodDecl *MD)
A function is OSObject related if it is declared on a subclass of OSObject, or any of the parameters ...
static bool isISLObjectRef(QualType Ty)
static bool isRelease(const FunctionDecl *FD, StringRef FName)
static bool hasTypedefNamed(QualType QT, StringRef Name)
static bool isOSObjectRequiredCast(StringRef S)
static ArgEffect getStopTrackingHardEquivalent(ArgEffect E)
static constexpr bool isOneOf()
static bool isOSIteratorSubclass(const Decl *D)
static QualType getCallableReturnType(const NamedDecl *ND)
static bool isAutorelease(const FunctionDecl *FD, StringRef FName)
static bool isExactClass(const Decl *D, StringRef ClassName)
static bool isOSObjectPtr(QualType QT)
static bool hasRCAnnotation(const Decl *D, StringRef rcAnnotation)
static bool isOSObjectSubclass(const Decl *D)
static bool isOSObjectThisCast(StringRef S)
static bool isMakeCollectable(StringRef FName)
static bool isOSObjectDynamicCast(StringRef S)
static bool isRetain(const FunctionDecl *FD, StringRef FName)
An instance of this class corresponds to a call.
@ Destructor
An implicit C++ destructor call (called implicitly or by operator 'delete')
@ ObjCMethod
A call to an Objective-C method.
@ Deallocator
A C++ deallocation function call (operator delete), via C++ delete-expression.
@ Function
A function, function pointer, or a C++ method call.
@ Allocator
A C++ allocation function call (operator new), via C++ new-expression.
@ Constructor
An implicit or explicit C++ constructor call.
@ InheritedConstructor
A C++ inherited constructor produced by a "using T::T" directive.
@ Block
A call to an Objective-C block.
Attr - This represents one attribute.
Represents a static or instance method of a struct/union/class.
const CXXRecordDecl * getParent() const
Return the parent of this method declaration, which is the class in which this method is defined.
Represents a C++ struct/union/class.
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this call.
QualType getCallReturnType(const ASTContext &Ctx) const
getCallReturnType - Get the return type of the call expr.
Decl - This represents one declaration (or definition), e.g.
ASTContext & getASTContext() const LLVM_READONLY
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
llvm::iterator_range< specific_attr_iterator< T > > specific_attrs() const
Represents a function declaration or definition.
param_iterator param_end()
QualType getReturnType() const
ArrayRef< ParmVarDecl * > parameters() const
param_iterator param_begin()
FunctionDecl * getDefinition()
Get the definition for this declaration.
size_t param_size() const
Represents a prototype with parameter type info, e.g.
unsigned getNumParams() const
FunctionType - C99 6.7.5.3 - Function Declarators.
QualType getReturnType() const
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.
StringRef getName() const
Return the actual identifier string.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
This represents a decl that may have a name.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
ObjCMethodDecl * getInstanceMethod(Selector Sel, bool AllowHidden=false) const
Represents an ObjC class declaration.
An expression that sends a message to the given Objective-C object or class.
Selector getSelector() const
bool isInstanceMessage() const
Determine whether this is an instance message to either a computed object or to super.
ObjCInterfaceDecl * getReceiverInterface() const
Retrieve the Objective-C interface to which this message is being directed, if known.
const ObjCMethodDecl * getMethodDecl() const
ObjCMethodDecl - Represents an instance or class method declaration.
param_const_iterator param_end() const
param_const_iterator param_begin() const
Selector getSelector() const
bool isInstanceMethod() const
ObjCMethodFamily getMethodFamily() const
Determines the family of this method.
QualType getReturnType() const
ObjCInterfaceDecl * getClassInterface()
Represents a pointer to an Objective C object.
Represents a parameter to a function.
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
QualType getCanonicalType() const
static std::string getAsString(SplitQualType split, const PrintingPolicy &Policy)
Smart pointer class that efficiently represents Objective-C method names.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
bool isPointerType() const
const T * castAs() const
Member-template castAs<specific type>.
const CXXRecordDecl * getPointeeCXXRecordDecl() const
If this is a pointer or reference to a RecordType, return the CXXRecordDecl that the type refers to.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isObjCIdType() const
const T * getAs() const
Member-template getAs<specific type>'.
An ArgEffect summarizes the retain count behavior on an argument or receiver to a function or method.
ArgEffectKind getKind() const
A key identifying a summary.
RetEffect summarizes a call's retain/release behavior with respect to its return value.
static RetEffect MakeNotOwned(ObjKind o)
static RetEffect MakeOwned(ObjKind o)
@ NoRet
Indicates that no retain count information is tracked for the return value.
static RetEffect MakeNoRet()
static RetEffect MakeNoRetHard()
bool isTrustedReferenceCountImplementation(const Decl *FD)
std::optional< BehaviorSummary > canEval(const CallExpr *CE, const FunctionDecl *FD, bool &hasTrustedImplementationAnnotation)
static bool isKnownSmartPointer(QualType QT)
const RetainSummary * getSummary(AnyCall C, bool HasNonZeroCallbackArg=false, bool IsReceiverUnconsumedSelf=false, QualType ReceiverType={})
Summary for a function with respect to ownership changes.
void setRetEffect(RetEffect E)
setRetEffect - Set the effect of the return value of the call.
void addArg(ArgEffects::Factory &af, unsigned idx, ArgEffect e)
bool isSimple() const
A retain summary is simple if it has no ArgEffects other than the default.
ArgEffects getArgEffects() const
void setThisEffect(ArgEffect e)
Set the effect of the method on "this".
void setReceiverEffect(ArgEffect e)
Sets the effect on the receiver of the message.
void Profile(llvm::FoldingSetNodeID &ID) const
Profile this summary for inclusion in a FoldingSet.
internal::Matcher< Decl > DeclarationMatcher
Types of matchers for the top-level classes in the AST class hierarchy.
internal::Matcher< NamedDecl > hasName(StringRef Name)
Matches NamedDecl nodes that have the specified name.
SmallVector< BoundNodes, 1 > match(MatcherT Matcher, const NodeT &Node, ASTContext &Context)
Returns the results of matching Matcher on Node.
const internal::VariadicDynCastAllOfMatcher< Decl, CXXRecordDecl > cxxRecordDecl
Matches C++ class declarations.
bool isCocoaObjectRef(QualType T)
bool isRefType(QualType RetTy, StringRef Prefix, StringRef Name=StringRef())
bool followsCreateRule(const FunctionDecl *FD)
bool isCFObjectRef(QualType T)
llvm::ImmutableMap< unsigned, ArgEffect > ArgEffects
ArgEffects summarizes the effects of a function/method call on all of its arguments.
ObjKind
Determines the object kind of a tracked object.
@ OS
Indicates that the tracking object is a descendant of a referenced-counted OSObject,...
@ Generalized
Indicates that the tracked object is a generalized object.
@ CF
Indicates that the tracked object is a CF object.
@ AnyObj
Indicates that the tracked object could be a CF or Objective-C object.
@ ObjC
Indicates that the tracked object is an Objective-C object.
@ IncRef
The argument has its reference count increased by 1.
@ UnretainedOutParameter
The argument is a pointer to a retain-counted object; on exit, the new value of the pointer is a +0 v...
@ DoNothing
There is no effect.
@ RetainedOutParameter
The argument is a pointer to a retain-counted object; on exit, the new value of the pointer is a +1 v...
@ RetainedOutParameterOnZero
The argument is a pointer to a retain-counted object; on exit, the new value of the pointer is a +1 v...
@ MayEscape
The argument is treated as potentially escaping, meaning that even when its reference count hits 0 it...
@ StopTracking
All typestate tracking of the object ceases.
@ Dealloc
The argument is treated as if the referenced object was deallocated.
@ Autorelease
The argument is treated as if an -autorelease message had been sent to the referenced object.
@ RetainedOutParameterOnNonZero
The argument is a pointer to a retain-counted object; on exit, the new value of the pointer is a +1 v...
@ DecRef
The argument has its reference count decreased by 1.
@ StopTrackingHard
All typestate tracking of the object ceases.
@ DecRefAndStopTrackingHard
Performs the combined functionality of DecRef and StopTrackingHard.
@ DecRefBridgedTransferred
The argument has its reference count decreased by 1 to model a transferred bridge cast under ARC.
bool NoRet(InterpState &S, CodePtr OpPC)
The JSON file list parser is used to communicate input to InstallAPI.
@ OMF_None
No particular method family.
Selector GetUnarySelector(StringRef name, ASTContext &Ctx)
Utility function for constructing an unary selector.
Selector GetNullarySelector(StringRef name, ASTContext &Ctx)
Utility function for constructing a nullary selector.
const FunctionProtoType * T
@ Class
The "class" keyword introduces the elaborated-type-specifier.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4