#include "RetainCountDiagnostics.h"
#include "RetainCountChecker.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include <optional>
usingnamespaceclang;
usingnamespaceento;
usingnamespaceretaincountchecker;
StringRef RefCountBug::bugTypeToName(RefCountBug::RefCountBugKind BT) { … }
StringRef RefCountBug::getDescription() const { … }
RefCountBug::RefCountBug(CheckerNameRef Checker, RefCountBugKind BT)
: … { … }
static bool isNumericLiteralExpression(const Expr *E) { … }
static std::string getPrettyTypeName(QualType QT) { … }
static bool shouldGenerateNote(llvm::raw_string_ostream &os,
const RefVal *PrevT,
const RefVal &CurrV,
bool DeallocSent) { … }
static std::optional<unsigned>
findArgIdxOfSymbol(ProgramStateRef CurrSt, const LocationContext *LCtx,
SymbolRef &Sym, std::optional<CallEventRef<>> CE) { … }
static std::optional<std::string> findMetaClassAlloc(const Expr *Callee) { … }
static std::string findAllocatedObjectName(const Stmt *S, QualType QT) { … }
static void generateDiagnosticsForCallLike(ProgramStateRef CurrSt,
const LocationContext *LCtx,
const RefVal &CurrV, SymbolRef &Sym,
const Stmt *S,
llvm::raw_string_ostream &os) { … }
namespace clang {
namespace ento {
namespace retaincountchecker {
class RefCountReportVisitor : public BugReporterVisitor { … };
class RefLeakReportVisitor : public RefCountReportVisitor { … };
}
}
}
static const ExplodedNode *getCalleeNode(const ExplodedNode *Pred) { … }
static std::shared_ptr<PathDiagnosticEventPiece>
annotateConsumedSummaryMismatch(const ExplodedNode *N,
CallExitBegin &CallExitLoc,
const SourceManager &SM,
CallEventManager &CEMgr) { … }
static std::shared_ptr<PathDiagnosticEventPiece>
annotateStartParameter(const ExplodedNode *N, SymbolRef Sym,
const SourceManager &SM) { … }
PathDiagnosticPieceRef
RefCountReportVisitor::VisitNode(const ExplodedNode *N, BugReporterContext &BRC,
PathSensitiveBugReport &BR) { … }
static std::optional<std::string> describeRegion(const MemRegion *MR) { … }
Bindings;
namespace {
class VarBindingsCollector : public StoreManager::BindingsHandler { … };
}
static Bindings getAllVarBindingsForSymbol(ProgramStateManager &Manager,
const ExplodedNode *Node,
SymbolRef Sym) { … }
namespace {
struct AllocationInfo { … };
}
static AllocationInfo GetAllocationSite(ProgramStateManager &StateMgr,
const ExplodedNode *N, SymbolRef Sym) { … }
PathDiagnosticPieceRef
RefCountReportVisitor::getEndPath(BugReporterContext &BRC,
const ExplodedNode *EndN,
PathSensitiveBugReport &BR) { … }
PathDiagnosticPieceRef
RefLeakReportVisitor::getEndPath(BugReporterContext &BRC,
const ExplodedNode *EndN,
PathSensitiveBugReport &BR) { … }
RefCountReport::RefCountReport(const RefCountBug &D, const LangOptions &LOpts,
ExplodedNode *n, SymbolRef sym, bool isLeak)
: … { … }
RefCountReport::RefCountReport(const RefCountBug &D, const LangOptions &LOpts,
ExplodedNode *n, SymbolRef sym,
StringRef endText)
: … { … }
void RefLeakReport::deriveParamLocation(CheckerContext &Ctx) { … }
void RefLeakReport::deriveAllocLocation(CheckerContext &Ctx) { … }
void RefLeakReport::createDescription(CheckerContext &Ctx) { … }
void RefLeakReport::findBindingToReport(CheckerContext &Ctx,
ExplodedNode *Node) { … }
RefLeakReport::RefLeakReport(const RefCountBug &D, const LangOptions &LOpts,
ExplodedNode *N, SymbolRef Sym,
CheckerContext &Ctx)
: … { … }