#include "clang/Analysis/DomainSpecific/CocoaConventions.h"
#include "clang/Analysis/RetainSummaryManager.h"
#include "clang/AST/Attr.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/ParentMap.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include <optional>
usingnamespaceclang;
usingnamespaceento;
template <class T>
constexpr static bool isOneOf() { … }
template <class T, class P, class... ToCompare>
constexpr static bool isOneOf() { … }
namespace {
struct GeneralizedReturnsRetainedAttr { … };
struct GeneralizedReturnsNotRetainedAttr { … };
struct GeneralizedConsumedAttr { … };
}
template <class T>
std::optional<ObjKind> RetainSummaryManager::hasAnyEnabledAttrOf(const Decl *D,
QualType QT) { … }
template <class T1, class T2, class... Others>
std::optional<ObjKind> RetainSummaryManager::hasAnyEnabledAttrOf(const Decl *D,
QualType QT) { … }
const RetainSummary *
RetainSummaryManager::getPersistentSummary(const RetainSummary &OldSumm) { … }
static bool isSubclass(const Decl *D,
StringRef ClassName) { … }
static bool isExactClass(const Decl *D, StringRef ClassName) { … }
static bool isOSObjectSubclass(const Decl *D) { … }
static bool isOSObjectDynamicCast(StringRef S) { … }
static bool isOSObjectRequiredCast(StringRef S) { … }
static bool isOSObjectThisCast(StringRef S) { … }
static bool isOSObjectPtr(QualType QT) { … }
static bool isISLObjectRef(QualType Ty) { … }
static bool isOSIteratorSubclass(const Decl *D) { … }
static bool hasRCAnnotation(const Decl *D, StringRef rcAnnotation) { … }
static bool isRetain(const FunctionDecl *FD, StringRef FName) { … }
static bool isRelease(const FunctionDecl *FD, StringRef FName) { … }
static bool isAutorelease(const FunctionDecl *FD, StringRef FName) { … }
static bool isMakeCollectable(StringRef FName) { … }
static bool isOSObjectRelated(const CXXMethodDecl *MD) { … }
bool
RetainSummaryManager::isKnownSmartPointer(QualType QT) { … }
const RetainSummary *
RetainSummaryManager::getSummaryForOSObject(const FunctionDecl *FD,
StringRef FName, QualType RetTy) { … }
const RetainSummary *RetainSummaryManager::getSummaryForObjCOrCFObject(
const FunctionDecl *FD,
StringRef FName,
QualType RetTy,
const FunctionType *FT,
bool &AllowAnnotations) { … }
const RetainSummary *
RetainSummaryManager::generateSummary(const FunctionDecl *FD,
bool &AllowAnnotations) { … }
const RetainSummary *
RetainSummaryManager::getFunctionSummary(const FunctionDecl *FD) { … }
static ArgEffect getStopTrackingHardEquivalent(ArgEffect E) { … }
const RetainSummary *
RetainSummaryManager::updateSummaryForNonZeroCallbackArg(const RetainSummary *S,
AnyCall &C) { … }
void RetainSummaryManager::updateSummaryForReceiverUnconsumedSelf(
const RetainSummary *&S) { … }
void RetainSummaryManager::updateSummaryForArgumentTypes(
const AnyCall &C, const RetainSummary *&RS) { … }
const RetainSummary *
RetainSummaryManager::getSummary(AnyCall C,
bool HasNonZeroCallbackArg,
bool IsReceiverUnconsumedSelf,
QualType ReceiverType) { … }
const RetainSummary *
RetainSummaryManager::getCFCreateGetRuleSummary(const FunctionDecl *FD) { … }
bool RetainSummaryManager::isTrustedReferenceCountImplementation(
const Decl *FD) { … }
std::optional<RetainSummaryManager::BehaviorSummary>
RetainSummaryManager::canEval(const CallExpr *CE, const FunctionDecl *FD,
bool &hasTrustedImplementationAnnotation) { … }
const RetainSummary *
RetainSummaryManager::getUnarySummary(const FunctionType* FT,
ArgEffectKind AE) { … }
const RetainSummary *
RetainSummaryManager::getOSSummaryRetainRule(const FunctionDecl *FD) { … }
const RetainSummary *
RetainSummaryManager::getOSSummaryReleaseRule(const FunctionDecl *FD) { … }
const RetainSummary *
RetainSummaryManager::getOSSummaryFreeRule(const FunctionDecl *FD) { … }
const RetainSummary *
RetainSummaryManager::getOSSummaryCreateRule(const FunctionDecl *FD) { … }
const RetainSummary *
RetainSummaryManager::getOSSummaryGetRule(const FunctionDecl *FD) { … }
const RetainSummary *
RetainSummaryManager::getCFSummaryCreateRule(const FunctionDecl *FD) { … }
const RetainSummary *
RetainSummaryManager::getCFSummaryGetRule(const FunctionDecl *FD) { … }
std::optional<RetEffect>
RetainSummaryManager::getRetEffectFromAnnotations(QualType RetTy,
const Decl *D) { … }
static bool hasTypedefNamed(QualType QT,
StringRef Name) { … }
static QualType getCallableReturnType(const NamedDecl *ND) { … }
bool RetainSummaryManager::applyParamAnnotationEffect(
const ParmVarDecl *pd, unsigned parm_idx, const NamedDecl *FD,
RetainSummaryTemplate &Template) { … }
void
RetainSummaryManager::updateSummaryFromAnnotations(const RetainSummary *&Summ,
const FunctionDecl *FD) { … }
void
RetainSummaryManager::updateSummaryFromAnnotations(const RetainSummary *&Summ,
const ObjCMethodDecl *MD) { … }
const RetainSummary *
RetainSummaryManager::getStandardMethodSummary(const ObjCMethodDecl *MD,
Selector S, QualType RetTy) { … }
const RetainSummary *
RetainSummaryManager::getClassMethodSummary(const ObjCMessageExpr *ME) { … }
const RetainSummary *RetainSummaryManager::getInstanceMethodSummary(
const ObjCMessageExpr *ME,
QualType ReceiverType) { … }
const RetainSummary *
RetainSummaryManager::getMethodSummary(Selector S,
const ObjCInterfaceDecl *ID,
const ObjCMethodDecl *MD, QualType RetTy,
ObjCMethodSummariesTy &CachedSummaries) { … }
void RetainSummaryManager::InitializeClassMethodSummaries() { … }
void RetainSummaryManager::InitializeMethodSummaries() { … }
const RetainSummary *
RetainSummaryManager::getMethodSummary(const ObjCMethodDecl *MD) { … }