24 using namespace clang;
34 template <
class T,
class P,
class... ToCompare>
36 return std::is_same<T, P>::value ||
isOneOf<T, ToCompare...>();
42 struct GeneralizedReturnsRetainedAttr {
44 if (
auto AA = dyn_cast<AnnotateAttr>(A))
45 return AA->getAnnotation() ==
"rc_ownership_returns_retained";
50 struct GeneralizedReturnsNotRetainedAttr {
52 if (
auto AA = dyn_cast<AnnotateAttr>(A))
53 return AA->getAnnotation() ==
"rc_ownership_returns_not_retained";
58 struct GeneralizedConsumedAttr {
60 if (
auto AA = dyn_cast<AnnotateAttr>(A))
61 return AA->getAnnotation() ==
"rc_ownership_consumed";
72 if (
isOneOf<T, CFConsumedAttr, CFReturnsRetainedAttr,
73 CFReturnsNotRetainedAttr>()) {
74 if (!TrackObjCAndCFObjects)
78 }
else if (
isOneOf<T, NSConsumedAttr, NSConsumesSelfAttr,
79 NSReturnsAutoreleasedAttr, NSReturnsRetainedAttr,
80 NSReturnsNotRetainedAttr, NSConsumesSelfAttr>()) {
82 if (!TrackObjCAndCFObjects)
85 if (
isOneOf<T, NSReturnsRetainedAttr, NSReturnsAutoreleasedAttr,
86 NSReturnsNotRetainedAttr>() &&
90 }
else if (
isOneOf<T, OSConsumedAttr, OSConsumesThisAttr,
91 OSReturnsNotRetainedAttr, OSReturnsRetainedAttr,
92 OSReturnsRetainedOnZeroAttr,
93 OSReturnsRetainedOnNonZeroAttr>()) {
97 }
else if (
isOneOf<T, GeneralizedReturnsNotRetainedAttr,
98 GeneralizedReturnsRetainedAttr,
99 GeneralizedConsumedAttr>()) {
102 llvm_unreachable(
"Unexpected attribute");
109 template <
class T1,
class T2,
class... Others>
112 if (
auto Out = hasAnyEnabledAttrOf<T1>(D, QT))
114 return hasAnyEnabledAttrOf<T2, Others...>(D, QT);
117 const RetainSummary *
118 RetainSummaryManager::getPersistentSummary(
const RetainSummary &OldSumm) {
120 if (OldSumm.isSimple()) {
121 ::llvm::FoldingSetNodeID
ID;
125 CachedSummaryNode *N = SimpleSummaries.FindNodeOrInsertPos(ID, Pos);
128 N = (CachedSummaryNode *) BPAlloc.Allocate<CachedSummaryNode>();
129 new (N) CachedSummaryNode(OldSumm);
130 SimpleSummaries.InsertNode(N, Pos);
133 return &N->getValue();
136 RetainSummary *Summ = (RetainSummary *) BPAlloc.Allocate<RetainSummary>();
137 new (Summ) RetainSummary(OldSumm);
142 StringRef ClassName) {
153 return S ==
"safeMetaCast";
162 if (Ann->getAnnotation() == rcAnnotation)
169 return FName.startswith_lower(
"retain") || FName.endswith_lower(
"retain");
173 return FName.startswith_lower(
"release") || FName.endswith_lower(
"release");
177 return FName.startswith_lower(
"autorelease") ||
178 FName.endswith_lower(
"autorelease");
182 return FName.contains_lower(
"MakeCollectable");
202 const RetainSummary *
203 RetainSummaryManager::getSummaryForOSObject(
const FunctionDecl *FD,
210 return getDefaultSummary();
214 if ((!II->getName().startswith(
"get") &&
215 !II->getName().startswith(
"Get")) ||
217 return getOSSummaryCreateRule(FD);
219 return getOSSummaryGetRule(FD);
225 if (
const auto *MD = dyn_cast<CXXMethodDecl>(FD)) {
228 if (FName ==
"release")
229 return getOSSummaryReleaseRule(FD);
231 if (FName ==
"retain")
232 return getOSSummaryRetainRule(FD);
235 return getOSSummaryFreeRule(FD);
237 if (MD->getOverloadedOperator() == OO_New)
238 return getOSSummaryCreateRule(MD);
245 const RetainSummary *RetainSummaryManager::getSummaryForObjCOrCFObject(
250 bool &AllowAnnotations) {
252 ArgEffects ScratchArgs(AF.getEmptyMap());
255 if (FName ==
"pthread_create" || FName ==
"pthread_setspecific") {
258 return getPersistentStopSummary();
259 }
else if(FName ==
"NSMakeCollectable") {
261 AllowAnnotations =
false;
263 : getPersistentStopSummary();
264 }
else if (FName ==
"CMBufferQueueDequeueAndRetain" ||
265 FName ==
"CMBufferQueueDequeueIfDataReadyAndRetain") {
271 }
else if (FName ==
"CFPlugInInstanceCreate") {
273 }
else if (FName ==
"IORegistryEntrySearchCFProperty" ||
274 (RetTyName ==
"CFMutableDictionaryRef" &&
275 (FName ==
"IOBSDNameMatching" || FName ==
"IOServiceMatching" ||
276 FName ==
"IOServiceNameMatching" ||
277 FName ==
"IORegistryEntryIDMatching" ||
278 FName ==
"IOOpenFirmwarePathMatching"))) {
283 }
else if (FName ==
"IOServiceGetMatchingService" ||
284 FName ==
"IOServiceGetMatchingServices") {
292 }
else if (FName ==
"IOServiceAddNotification" ||
293 FName ==
"IOServiceAddMatchingNotification") {
300 }
else if (FName ==
"CVPixelBufferCreateWithBytes") {
311 }
else if (FName ==
"CGBitmapContextCreateWithData") {
319 }
else if (FName ==
"CVPixelBufferCreateWithPlanarBytes") {
329 }
else if (FName ==
"VTCompressionSessionEncodeFrame") {
339 }
else if (FName ==
"dispatch_set_context" ||
340 FName ==
"xpc_connection_set_context") {
351 }
else if (FName.startswith(
"NSLog")) {
352 return getDoNothingSummary();
353 }
else if (FName.startswith(
"NS") &&
354 (FName.find(
"Insert") != StringRef::npos)) {
373 AllowAnnotations =
false;
375 return getUnarySummary(FT,
IncRef);
379 AllowAnnotations =
false;
383 AllowAnnotations =
false;
386 return getCFCreateGetRuleSummary(FD);
394 return getUnarySummary(FT,
IncRef);
396 return getCFCreateGetRuleSummary(FD);
403 return getCFCreateGetRuleSummary(FD);
406 if (FD->
hasAttr<CFAuditedTransferAttr>()) {
407 return getCFCreateGetRuleSummary(FD);
413 if (FName.startswith(
"CG") || FName.startswith(
"CF")) {
415 FName = FName.substr(FName.startswith(
"CGCF") ? 4 : 2);
418 return getUnarySummary(FT,
DecRef);
420 assert(ScratchArgs.isEmpty());
437 (StrInStrNoCase(FName,
"InsertValue") != StringRef::npos ||
438 StrInStrNoCase(FName,
"AddValue") != StringRef::npos ||
439 StrInStrNoCase(FName,
"SetValue") != StringRef::npos ||
440 StrInStrNoCase(FName,
"AppendValue") != StringRef::npos ||
441 StrInStrNoCase(FName,
"SetAttribute") != StringRef::npos)
453 const RetainSummary *
454 RetainSummaryManager::generateSummary(
const FunctionDecl *FD,
455 bool &AllowAnnotations) {
458 return getPersistentStopSummary();
462 StringRef FName = II ? II->
getName() :
"";
466 FName = FName.substr(FName.find_first_not_of(
'_'));
473 if (
const RetainSummary *S = getSummaryForOSObject(FD, FName, RetTy))
476 if (TrackObjCAndCFObjects)
477 if (
const RetainSummary *S =
478 getSummaryForObjCOrCFObject(FD, FName, RetTy, FT, AllowAnnotations))
481 if (
const auto *MD = dyn_cast<CXXMethodDecl>(FD))
484 ArgEffects(AF.getEmptyMap()),
489 return getDefaultSummary();
492 const RetainSummary *
493 RetainSummaryManager::getFunctionSummary(
const FunctionDecl *FD) {
496 return getDefaultSummary();
499 FuncSummariesTy::iterator I = FuncSummaries.find(FD);
500 if (I != FuncSummaries.end())
504 bool AllowAnnotations =
true;
505 const RetainSummary *S = generateSummary(FD, AllowAnnotations);
508 if (AllowAnnotations)
509 updateSummaryFromAnnotations(S, FD);
511 FuncSummaries[FD] = S;
540 llvm_unreachable(
"Unknown ArgEffect kind");
543 void RetainSummaryManager::updateSummaryForCall(
const RetainSummary *&S,
551 ArgEffects ScratchArgs(AF.getEmptyMap());
552 ArgEffects CustomArgEffects = S->getArgEffects();
553 for (ArgEffects::iterator I = CustomArgEffects.begin(),
554 E = CustomArgEffects.end();
557 if (Translated.
getKind() != DefEffect.getKind())
558 ScratchArgs = AF.add(ScratchArgs, I->first, Translated);
572 if (Name->isStr(
"CGBitmapContextCreateWithData") ||
573 Name->isStr(
"dispatch_data_create"))
574 RE = S->getRetEffect();
578 S = getPersistentSummary(RE, ScratchArgs, RecEffect, DefEffect);
594 if (MC->getMethodFamily() ==
OMF_init && MC->isReceiverSelfOrSuper()) {
598 const Expr *ME = MC->getOriginExpr();
602 RetainSummaryTemplate ModifiableSummaryTemplate(S, *
this);
610 const RetainSummary *
611 RetainSummaryManager::getSummary(
const CallEvent &Call,
613 const RetainSummary *Summ;
620 Summ = getFunctionSummary(cast_or_null<FunctionDecl>(Call.
getDecl()));
625 return getPersistentStopSummary();
629 Summ = getInstanceMethodSummary(Msg, ReceiverType);
631 Summ = getClassMethodSummary(Msg);
636 updateSummaryForCall(Summ, Call);
638 assert(Summ &&
"Unknown call type?");
643 const RetainSummary *
644 RetainSummaryManager::getCFCreateGetRuleSummary(
const FunctionDecl *FD) {
646 return getCFSummaryCreateRule(FD);
648 return getCFSummaryGetRule(FD);
651 bool RetainSummaryManager::isTrustedReferenceCountImplementation(
658 bool &hasTrustedImplementationAnnotation) {
664 StringRef FName = II->
getName();
665 FName = FName.substr(FName.find_first_not_of(
'_'));
669 if (II->
isStr(
"NSMakeCollectable"))
670 return BehaviorSummary::Identity;
675 if (FName ==
"CMBufferQueueDequeueAndRetain" ||
676 FName ==
"CMBufferQueueDequeueIfDataReadyAndRetain") {
686 return BehaviorSummary::Identity;
694 return BehaviorSummary::IdentityOrZero;
698 if (FDD && isTrustedReferenceCountImplementation(FDD)) {
699 hasTrustedImplementationAnnotation =
true;
700 return BehaviorSummary::Identity;
704 if (
const auto *MD = dyn_cast<CXXMethodDecl>(FD)) {
707 if (FName ==
"release" || FName ==
"retain")
708 return BehaviorSummary::NoOp;
714 const RetainSummary *
715 RetainSummaryManager::getUnarySummary(
const FunctionType* FT,
719 ArgEffects ScratchArgs(AF.getEmptyMap());
724 if (!FTP || FTP->getNumParams() != 1)
725 return getPersistentStopSummary();
729 ScratchArgs = AF.add(ScratchArgs, 0, Effect);
735 const RetainSummary *
736 RetainSummaryManager::getOSSummaryRetainRule(
const FunctionDecl *FD) {
744 const RetainSummary *
745 RetainSummaryManager::getOSSummaryReleaseRule(
const FunctionDecl *FD) {
753 const RetainSummary *
754 RetainSummaryManager::getOSSummaryFreeRule(
const FunctionDecl *FD) {
762 const RetainSummary *
763 RetainSummaryManager::getOSSummaryCreateRule(
const FunctionDecl *FD) {
768 const RetainSummary *
769 RetainSummaryManager::getOSSummaryGetRule(
const FunctionDecl *FD) {
774 const RetainSummary *
775 RetainSummaryManager::getCFSummaryCreateRule(
const FunctionDecl *FD) {
777 ArgEffects(AF.getEmptyMap()));
780 const RetainSummary *
781 RetainSummaryManager::getCFSummaryGetRule(
const FunctionDecl *FD) {
783 ArgEffects(AF.getEmptyMap()),
795 RetainSummaryManager::getRetEffectFromAnnotations(
QualType RetTy,
797 if (hasAnyEnabledAttrOf<NSReturnsRetainedAttr>(D, RetTy))
798 return ObjCAllocRetE;
800 if (
auto K = hasAnyEnabledAttrOf<CFReturnsRetainedAttr, OSReturnsRetainedAttr,
801 GeneralizedReturnsRetainedAttr>(D, RetTy))
804 if (
auto K = hasAnyEnabledAttrOf<
805 CFReturnsNotRetainedAttr, OSReturnsNotRetainedAttr,
806 GeneralizedReturnsNotRetainedAttr, NSReturnsNotRetainedAttr,
807 NSReturnsAutoreleasedAttr>(D, RetTy))
810 if (
const auto *MD = dyn_cast<CXXMethodDecl>(D))
811 for (
const auto *PD : MD->overridden_methods())
812 if (
auto RE = getRetEffectFromAnnotations(RetTy, PD))
820 static bool hasTypedefNamed(
QualType QT,
822 while (
auto *T = dyn_cast<TypedefType>(QT)) {
823 const auto &Context = T->getDecl()->getASTContext();
824 if (T->getDecl()->getIdentifier() == &Context.
Idents.
get(Name))
826 QT = T->getDecl()->getUnderlyingType();
832 if (
const auto *FD = dyn_cast<FunctionDecl>(ND)) {
834 }
else if (
const auto *MD = dyn_cast<ObjCMethodDecl>(ND)) {
835 return MD->getReturnType();
837 llvm_unreachable(
"Unexpected decl");
841 bool RetainSummaryManager::applyParamAnnotationEffect(
843 RetainSummaryTemplate &Template) {
846 hasAnyEnabledAttrOf<NSConsumedAttr, CFConsumedAttr, OSConsumedAttr,
847 GeneralizedConsumedAttr>(pd, QT)) {
850 }
else if (
auto K = hasAnyEnabledAttrOf<
851 CFReturnsRetainedAttr, OSReturnsRetainedAttr,
852 OSReturnsRetainedOnNonZeroAttr, OSReturnsRetainedOnZeroAttr,
853 GeneralizedReturnsRetainedAttr>(pd, QT)) {
858 QualType QT = getCallableReturnType(FD);
860 bool HasRetainedOnZero = pd->
hasAttr<OSReturnsRetainedOnZeroAttr>();
861 bool HasRetainedOnNonZero = pd->
hasAttr<OSReturnsRetainedOnNonZeroAttr>();
869 (hasTypedefNamed(QT,
"kern_return_t") && !HasRetainedOnNonZero);
872 if (ShouldSplit && SuccessOnZero) {
874 }
else if (ShouldSplit && (!SuccessOnZero || HasRetainedOnNonZero)) {
885 }
else if (
auto K = hasAnyEnabledAttrOf<CFReturnsNotRetainedAttr,
886 OSReturnsNotRetainedAttr,
887 GeneralizedReturnsNotRetainedAttr>(
893 if (
const auto *MD = dyn_cast<CXXMethodDecl>(FD)) {
894 for (
const auto *OD : MD->overridden_methods()) {
895 const ParmVarDecl *OP = OD->parameters()[parm_idx];
896 if (applyParamAnnotationEffect(OP, parm_idx, OD, Template))
905 RetainSummaryManager::updateSummaryFromAnnotations(
const RetainSummary *&Summ,
910 assert(Summ &&
"Must have a summary to add annotations to.");
911 RetainSummaryTemplate Template(Summ, *
this);
914 unsigned parm_idx = 0;
916 pe = FD->
param_end(); pi != pe; ++pi, ++parm_idx)
917 applyParamAnnotationEffect(*pi, parm_idx, FD, Template);
921 Template->setRetEffect(*RetE);
923 if (hasAnyEnabledAttrOf<OSConsumesThisAttr>(FD, RetTy))
928 RetainSummaryManager::updateSummaryFromAnnotations(
const RetainSummary *&Summ,
933 assert(Summ &&
"Must have a valid summary to add annotations to");
934 RetainSummaryTemplate Template(Summ, *
this);
937 if (hasAnyEnabledAttrOf<NSConsumesSelfAttr>(MD, MD->
getReturnType()))
941 unsigned parm_idx = 0;
944 applyParamAnnotationEffect(*pi, parm_idx, MD, Template);
948 Template->setRetEffect(*RetE);
951 const RetainSummary *
952 RetainSummaryManager::getStandardMethodSummary(
const ObjCMethodDecl *MD,
991 ResultEff = ObjCInitRetE;
999 ResultEff = ObjCAllocRetE;
1029 for (
unsigned i = 0, e = S.
getNumArgs(); i != e; ++i) {
1031 if (Slot.substr(Slot.size() - 8).equals_lower(
"delegate")) {
1032 if (ResultEff == ObjCInitRetE)
1042 return getDefaultSummary();
1044 return getPersistentSummary(ResultEff, ArgEffects(AF.getEmptyMap()),
1048 const RetainSummary *RetainSummaryManager::getInstanceMethodSummary(
1055 if (!ReceiverType.
isNull())
1057 ReceiverClass = PT->getInterfaceDecl();
1069 if (!Method && ReceiverClass)
1072 return getMethodSummary(S, ReceiverClass, Method, Msg.getResultType(),
1073 ObjCMethodSummaries);
1076 const RetainSummary *
1077 RetainSummaryManager::getMethodSummary(
Selector S,
1080 ObjCMethodSummariesTy &CachedSummaries) {
1083 if (!TrackObjCAndCFObjects)
1084 return getDefaultSummary();
1087 const RetainSummary *Summ = CachedSummaries.find(ID, S);
1090 Summ = getStandardMethodSummary(MD, S, RetTy);
1093 updateSummaryFromAnnotations(Summ, MD);
1102 void RetainSummaryManager::InitializeClassMethodSummaries() {
1103 ArgEffects ScratchArgs = AF.getEmptyMap();
1106 addClassMethSummary(
"NSAssertionHandler",
"currentHandler",
1112 addClassMethSummary(
"NSAutoreleasePool",
"addObject",
1118 void RetainSummaryManager::InitializeMethodSummaries() {
1120 ArgEffects ScratchArgs = AF.getEmptyMap();
1123 const RetainSummary *InitSumm = getPersistentSummary(
1133 const RetainSummary *AllocSumm = getPersistentSummary(ObjCAllocRetE,
1135 const RetainSummary *CFAllocSumm =
1140 const RetainSummary *Summ = getPersistentSummary(
1145 Summ = getPersistentSummary(NoRet, ScratchArgs,
1165 const RetainSummary *NoTrackYet =
1169 addClassMethSummary(
"NSWindow",
"alloc", NoTrackYet);
1175 addClassMethSummary(
"NSPanel",
"alloc", NoTrackYet);
1180 addClassMethSummary(
"NSNull",
"null", NoTrackYet);
1184 addClassMethSummary(
"NSAutoreleasePool",
"alloc", NoTrackYet);
1185 addClassMethSummary(
"NSAutoreleasePool",
"allocWithZone", NoTrackYet,
false);
1186 addClassMethSummary(
"NSAutoreleasePool",
"new", NoTrackYet);
1189 addInstMethSummary(
"QCRenderer", AllocSumm,
"createSnapshotImageOfType");
1190 addInstMethSummary(
"QCView", AllocSumm,
"createSnapshotImageOfType");
1195 addInstMethSummary(
"CIContext", CFAllocSumm,
"createCGImage",
"fromRect");
1196 addInstMethSummary(
"CIContext", CFAllocSumm,
"createCGImage",
"fromRect",
1197 "format",
"colorSpace");
1198 addInstMethSummary(
"CIContext", CFAllocSumm,
"createCGLayerWithSize",
"info");
1204 RetainSummaryManager M(Ctx, L.ObjCAutoRefCount,
1207 const RetainSummary *S = M.getMethodSummary(MD);
1208 CallEffects CE(S->getRetEffect(), S->getReceiverEffect());
1210 for (
unsigned i = 0; i < N; ++i) {
1211 CE.Args.push_back(S->getArg(i));
1219 RetainSummaryManager M(Ctx, L.ObjCAutoRefCount,
1222 const RetainSummary *S = M.getFunctionSummary(FD);
1225 for (
unsigned i = 0; i < N; ++i) {
1226 CE.Args.push_back(S->getArg(i));
Indicates that the tracked object is a generalized object.
Indicates that the tracked object is a CF object.
FunctionDecl * getDefinition()
Get the definition for this declaration.
Encapsulates the retain count semantics on the arguments, return value, and receiver (if any) of a fu...
Represents a function declaration or definition.
Smart pointer class that efficiently represents Objective-C method names.
ObjKind
Determines the object kind of a tracked object.
A (possibly-)qualified type.
unsigned param_size() const
static bool isOSObjectDynamicCast(StringRef S)
The argument has its reference count decreased by 1 to model a transferred bridge cast under ARC...
FunctionType - C99 6.7.5.3 - Function Declarators.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee...
All typestate tracking of the object ceases.
static RetEffect MakeOwned(ObjKind o)
Decl - This represents one declaration (or definition), e.g.
The argument has its reference count increased by 1.
bool isCocoaObjectRef(QualType T)
The argument is treated as if an -autorelease message had been sent to the referenced object...
Indicates that no retain count information is tracked for the return value.
param_const_iterator param_end() const
size_t param_size() const
bool isConsumedExpr(Expr *E) const
static RetEffect MakeNoRet()
QualType getReturnType() const
const T * getAs() const
Member-template getAs<specific type>'.
ObjCMethodDecl - Represents an instance or class method declaration.
Represents a parameter to a function.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
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.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
bool isObjCIdType() const
static bool isAutorelease(const FunctionDecl *FD, StringRef FName)
const ObjCInterfaceDecl * getReceiverInterface() const
Get the interface for the receiver.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
ArrayRef< ParmVarDecl * > parameters() const
ObjCMethodFamily getMethodFamily() const
Determines the family of this method.
The argument has its reference count decreased by 1.
bool followsCreateRule(const FunctionDecl *FD)
Represents any expression that calls an Objective-C method.
The argument is a pointer to a retain-counted object; on exit, the new value of the pointer is a +0 v...
virtual Kind getKind() const =0
Returns the kind of call this is.
bool hasNonZeroCallbackArg() const
Returns true if any of the arguments appear to represent callbacks.
Selector GetNullarySelector(StringRef name, ASTContext &Ctx)
Utility function for constructing a nullary selector.
The argument is a pointer to a retain-counted object; on exit, the new value of the pointer is a +1 v...
static bool isOSObjectSubclass(const Decl *D)
static bool hasRCAnnotation(const Decl *D, StringRef rcAnnotation)
SmallVector< BoundNodes, 1 > match(MatcherT Matcher, const NodeT &Node, ASTContext &Context)
Returns the results of matching Matcher on Node.
Represents an ObjC class declaration.
QualType getReturnType() const
param_iterator param_begin()
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
Represents a prototype with parameter type info, e.g.
The argument is treated as potentially escaping, meaning that even when its reference count hits 0 it...
This represents one expression.
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
static constexpr bool isOneOf()
StringRef getNameForSlot(unsigned argIndex) const
Retrieve the name at a given position in the selector.
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 ...
virtual const Decl * getDecl() const
Returns the declaration of the function or method that will be called.
The argument is treated as if the referenced object was deallocated.
static bool isRelease(const FunctionDecl *FD, StringRef FName)
bool isCFObjectRef(QualType T)
static RetEffect MakeNotOwned(ObjKind o)
unsigned getNumArgs() const
bool isNull() const
Return true if this QualType doesn't point to a type yet.
Represents a C function or static C++ member function call.
ArgEffectKind getKind() const
ObjCMethodFamily getMethodFamily() const
Derive the conventional family of this method.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
QualType getReturnType() const
Indicates that the tracked object is an Objective-C object.
ASTContext & getASTContext() const LLVM_READONLY
Represents a static or instance method of a struct/union/class.
static bool isMakeCollectable(StringRef FName)
Performs the combined functionality of DecRef and StopTrackingHard.
A key identifying a summary.
const ObjCMethodDecl * getDecl() const override
StringRef getName() const
Return the actual identifier string.
Selector getSelector() const
Dataflow Directional Tag Classes.
bool isRefType(QualType RetTy, StringRef Prefix, StringRef Name=StringRef())
static RetEffect MakeNoRetHard()
const internal::VariadicDynCastAllOfMatcher< Decl, CXXRecordDecl > cxxRecordDecl
Matches C++ class declarations.
static std::string getAsString(SplitQualType split, const PrintingPolicy &Policy)
const CXXRecordDecl * getParent() const
Returns the parent of this method declaration, which is the class in which this method is defined...
bool isKeywordSelector() const
QualType getCallReturnType(const ASTContext &Ctx) const
getCallReturnType - Get the return type of the call expr.
Represents an abstract call to a function or method along a particular path.
param_iterator param_end()
Represents a pointer to an Objective C object.
bool isInstanceMessage() const
static ArgEffect getStopTrackingHardEquivalent(ArgEffect E)
Indicates that the tracking object is a descendant of a referenced-counted OSObject, used in the Darwin kernel.
static bool classof(const OMPClause *T)
static bool isRetain(const FunctionDecl *FD, StringRef FName)
param_const_iterator param_begin() const
llvm::iterator_range< specific_attr_iterator< T > > specific_attrs() const
ArgEffect withKind(ArgEffectKind NewK)
No particular method family.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
All typestate tracking of the object ceases.
Represents a C++ struct/union/class.
Selector GetUnarySelector(StringRef name, ASTContext &Ctx)
Utility function for constructing an unary selector.
The argument is a pointer to a retain-counted object; on exit, the new value of the pointer is a +1 v...
static bool isOSIteratorSubclass(const Decl *D)
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
static bool isSubclass(const Decl *D, StringRef ClassName)
The argument is a pointer to a retain-counted object; on exit, the new value of the pointer is a +1 v...
bool isPointerType() const
ParentMap & getParentMap()
An ArgEffect summarizes the retain count behavior on an argument or receiver to a function or method...
This represents a decl that may have a name.
ObjCMethodDecl * getInstanceMethod(Selector Sel, bool AllowHidden=false) const
AnalysisDeclContext * getAnalysisDeclContext() const
static CallEffects getEffect(const ObjCMethodDecl *MD)
Return the CallEfect for a given Objective-C method.
const LangOptions & getLangOpts() const
Attr - This represents one attribute.
internal::Matcher< Decl > DeclarationMatcher
Types of matchers for the top-level classes in the AST class hierarchy.
RetEffect summarizes a call's retain/release behavior with respect to its return value.