clang  3.9.0
Classes | Namespaces | Macros | Typedefs | Functions
RetainCountChecker.cpp File Reference
#include "AllocationDiagnostics.h"
#include "ClangSACheckers.h"
#include "SelectorExtras.h"
#include "clang/AST/Attr.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/ParentMap.h"
#include "clang/Analysis/DomainSpecific/CocoaConventions.h"
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/SourceManager.h"
#include "clang/StaticAnalyzer/Checkers/ObjCRetainCount.h"
#include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
#include "clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h"
#include "clang/StaticAnalyzer/Core/Checker.h"
#include "clang/StaticAnalyzer/Core/CheckerManager.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/FoldingSet.h"
#include "llvm/ADT/ImmutableList.h"
#include "llvm/ADT/ImmutableMap.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringExtras.h"
#include <cstdarg>
#include <utility>
Include dependency graph for RetainCountChecker.cpp:

Go to the source code of this file.

Classes

struct  llvm::FoldingSetTrait< ArgEffect >
 
struct  llvm::FoldingSetTrait< RetEffect >
 
struct  llvm::DenseMapInfo< ObjCSummaryKey >
 

Namespaces

 llvm
 DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterators.
 
 clang
 Dataflow Directional Tag Classes.
 
 clang::ento
 
 clang::ento::objc_retain
 

Macros

#define createCallEffect(D, KIND)
 

Typedefs

typedef llvm::ImmutableMap
< unsigned, ArgEffect
ArgEffects
 ArgEffects summarizes the effects of a function/method call on all of its arguments. More...
 

Functions

static const RefVal * getRefBinding (ProgramStateRef State, SymbolRef Sym)
 
static ProgramStateRef setRefBinding (ProgramStateRef State, SymbolRef Sym, RefVal Val)
 
static ProgramStateRef removeRefBinding (ProgramStateRef State, SymbolRef Sym)
 
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 (const FunctionDecl *FD, StringRef FName)
 
static ArgEffect getStopTrackingHardEquivalent (ArgEffect E)
 
static bool isNumericLiteralExpression (const Expr *E)
 
static bool isSynthesizedAccessor (const StackFrameContext *SFC)
 Returns true if this stack frame is for an Objective-C method that is a property getter or setter whose body has been synthesized by the analyzer. More...
 
static AllocationInfo GetAllocationSite (ProgramStateManager &StateMgr, const ExplodedNode *N, SymbolRef Sym)
 
static QualType GetReturnType (const Expr *RetE, ASTContext &Ctx)
 GetReturnType - Used to get the return type of a message expression or function call with the intention of affixing that type to a tracked symbol. More...
 
static ProgramStateRef updateOutParameter (ProgramStateRef State, SVal ArgVal, ArgEffect Effect)
 

Macro Definition Documentation

#define createCallEffect (   D,
  KIND 
)
Value:
ASTContext &Ctx = D->getASTContext();\
LangOptions L = Ctx.getLangOpts();\
RetainSummaryManager M(Ctx, L.GCOnly, L.ObjCAutoRefCount);\
const RetainSummary *S = M.get ## KIND ## Summary(D);\
CallEffects CE(S->getRetEffect());\
CE.Receiver = S->getReceiverEffect();\
unsigned N = D->param_size();\
for (unsigned i = 0; i < N; ++i) {\
CE.Args.push_back(S->getArg(i));\
}
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:92
const LangOptions & getLangOpts() const
Definition: ASTContext.h:604
for(auto typeArg:T->getTypeArgsAsWritten())

Definition at line 3996 of file RetainCountChecker.cpp.

Referenced by clang::ento::objc_retain::CallEffects::getEffect().

Typedef Documentation

ArgEffects summarizes the effects of a function/method call on all of its arguments.

Definition at line 73 of file RetainCountChecker.cpp.

Function Documentation

static AllocationInfo GetAllocationSite ( ProgramStateManager StateMgr,
const ExplodedNode N,
SymbolRef  Sym 
)
static
static const RefVal* getRefBinding ( ProgramStateRef  State,
SymbolRef  Sym 
)
inlinestatic

Definition at line 365 of file RetainCountChecker.cpp.

Referenced by GetAllocationSite().

static QualType GetReturnType ( const Expr RetE,
ASTContext Ctx 
)
static

GetReturnType - Used to get the return type of a message expression or function call with the intention of affixing that type to a tracked symbol.

While the return type can be queried directly from RetEx, when invoking class methods we augment to the return type to be that of a pointer to the class (as opposed it just being id).

more specific than id.

Definition at line 2908 of file RetainCountChecker.cpp.

References clang::Type::getAs(), clang::ASTContext::getObjCInterfaceType(), clang::ASTContext::getObjCObjectPointerType(), and clang::Expr::getType().

static ArgEffect getStopTrackingHardEquivalent ( ArgEffect  E)
static
static bool isAutorelease ( const FunctionDecl FD,
StringRef  FName 
)
static

Definition at line 893 of file RetainCountChecker.cpp.

static bool isMakeCollectable ( const FunctionDecl FD,
StringRef  FName 
)
static

Definition at line 897 of file RetainCountChecker.cpp.

static bool isNumericLiteralExpression ( const Expr E)
static

Definition at line 1871 of file RetainCountChecker.cpp.

References E.

static bool isRelease ( const FunctionDecl FD,
StringRef  FName 
)
static

Definition at line 889 of file RetainCountChecker.cpp.

static bool isRetain ( const FunctionDecl FD,
StringRef  FName 
)
static

Definition at line 885 of file RetainCountChecker.cpp.

static bool isSynthesizedAccessor ( const StackFrameContext SFC)
static

Returns true if this stack frame is for an Objective-C method that is a property getter or setter whose body has been synthesized by the analyzer.

Definition at line 1882 of file RetainCountChecker.cpp.

References clang::LocationContext::getAnalysisDeclContext(), clang::LocationContext::getDecl(), clang::AnalysisDeclContext::isBodyAutosynthesized(), and clang::ObjCMethodDecl::isPropertyAccessor().

static ProgramStateRef removeRefBinding ( ProgramStateRef  State,
SymbolRef  Sym 
)
static

Definition at line 375 of file RetainCountChecker.cpp.

static ProgramStateRef setRefBinding ( ProgramStateRef  State,
SymbolRef  Sym,
RefVal  Val 
)
inlinestatic

Definition at line 370 of file RetainCountChecker.cpp.

Referenced by updateOutParameter().

static ProgramStateRef updateOutParameter ( ProgramStateRef  State,
SVal  ArgVal,
ArgEffect  Effect 
)
static