#include "clang/AST/Attr.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/StmtVisitor.h"
#include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h"
#include "clang/StaticAnalyzer/Core/BugReporter/BugReporter.h"
#include "clang/StaticAnalyzer/Core/Checker.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallString.h"
usingnamespaceclang;
usingnamespaceento;
namespace {
struct ChecksFilter { … };
class IvarInvalidationCheckerImpl { … };
static bool isInvalidationMethod(const ObjCMethodDecl *M, bool LookForPartial) { … }
void IvarInvalidationCheckerImpl::containsInvalidationMethod(
const ObjCContainerDecl *D, InvalidationInfo &OutInfo, bool Partial) { … }
bool IvarInvalidationCheckerImpl::trackIvar(const ObjCIvarDecl *Iv,
IvarSet &TrackedIvars,
const ObjCIvarDecl **FirstIvarDecl) { … }
const ObjCIvarDecl *IvarInvalidationCheckerImpl::findPropertyBackingIvar(
const ObjCPropertyDecl *Prop,
const ObjCInterfaceDecl *InterfaceD,
IvarSet &TrackedIvars,
const ObjCIvarDecl **FirstIvarDecl) { … }
void IvarInvalidationCheckerImpl::printIvar(llvm::raw_svector_ostream &os,
const ObjCIvarDecl *IvarDecl,
const IvarToPropMapTy &IvarToPopertyMap) { … }
void IvarInvalidationCheckerImpl::
visit(const ObjCImplementationDecl *ImplD) const { … }
void IvarInvalidationCheckerImpl::reportNoInvalidationMethod(
CheckerNameRef CheckName, const ObjCIvarDecl *FirstIvarDecl,
const IvarToPropMapTy &IvarToPopertyMap,
const ObjCInterfaceDecl *InterfaceD, bool MissingDeclaration) const { … }
void IvarInvalidationCheckerImpl::
reportIvarNeedsInvalidation(const ObjCIvarDecl *IvarD,
const IvarToPropMapTy &IvarToPopertyMap,
const ObjCMethodDecl *MethodD) const { … }
void IvarInvalidationCheckerImpl::MethodCrawler::markInvalidated(
const ObjCIvarDecl *Iv) { … }
const Expr *IvarInvalidationCheckerImpl::MethodCrawler::peel(const Expr *E) const { … }
void IvarInvalidationCheckerImpl::MethodCrawler::checkObjCIvarRefExpr(
const ObjCIvarRefExpr *IvarRef) { … }
void IvarInvalidationCheckerImpl::MethodCrawler::checkObjCMessageExpr(
const ObjCMessageExpr *ME) { … }
void IvarInvalidationCheckerImpl::MethodCrawler::checkObjCPropertyRefExpr(
const ObjCPropertyRefExpr *PA) { … }
bool IvarInvalidationCheckerImpl::MethodCrawler::isZero(const Expr *E) const { … }
void IvarInvalidationCheckerImpl::MethodCrawler::check(const Expr *E) { … }
void IvarInvalidationCheckerImpl::MethodCrawler::VisitBinaryOperator(
const BinaryOperator *BO) { … }
void IvarInvalidationCheckerImpl::MethodCrawler::VisitObjCMessageExpr(
const ObjCMessageExpr *ME) { … }
}
namespace {
class IvarInvalidationChecker :
public Checker<check::ASTDecl<ObjCImplementationDecl> > { … };
}
void ento::registerIvarInvalidationModeling(CheckerManager &mgr) { … }
bool ento::shouldRegisterIvarInvalidationModeling(const CheckerManager &mgr) { … }
#define REGISTER_CHECKER(name) …
REGISTER_CHECKER(InstanceVariableInvalidation)
REGISTER_CHECKER(MissingInvalidationMethod)