#include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h"
#include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
#include "clang/StaticAnalyzer/Core/Checker.h"
#include "clang/StaticAnalyzer/Core/CheckerManager.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/CallDescription.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
usingnamespaceclang;
usingnamespaceento;
namespace {
struct LockState { … };
class PthreadLockChecker : public Checker<check::PostCall, check::DeadSymbols,
check::RegionChanges> { … };
}
REGISTER_LIST_WITH_PROGRAMSTATE(…) …
REGISTER_MAP_WITH_PROGRAMSTATE(…) …
REGISTER_MAP_WITH_PROGRAMSTATE(…) …
void PthreadLockChecker::checkPostCall(const CallEvent &Call,
CheckerContext &C) const { … }
ProgramStateRef PthreadLockChecker::resolvePossiblyDestroyedMutex(
ProgramStateRef state, const MemRegion *lockR, const SymbolRef *sym) const { … }
void PthreadLockChecker::printState(raw_ostream &Out, ProgramStateRef State,
const char *NL, const char *Sep) const { … }
void PthreadLockChecker::AcquirePthreadLock(const CallEvent &Call,
CheckerContext &C,
CheckerKind CheckKind) const { … }
void PthreadLockChecker::AcquireXNULock(const CallEvent &Call,
CheckerContext &C,
CheckerKind CheckKind) const { … }
void PthreadLockChecker::TryPthreadLock(const CallEvent &Call,
CheckerContext &C,
CheckerKind CheckKind) const { … }
void PthreadLockChecker::TryXNULock(const CallEvent &Call, CheckerContext &C,
CheckerKind CheckKind) const { … }
void PthreadLockChecker::TryFuchsiaLock(const CallEvent &Call,
CheckerContext &C,
CheckerKind CheckKind) const { … }
void PthreadLockChecker::TryC11Lock(const CallEvent &Call, CheckerContext &C,
CheckerKind CheckKind) const { … }
void PthreadLockChecker::AcquireLockAux(const CallEvent &Call,
CheckerContext &C, const Expr *MtxExpr,
SVal MtxVal, bool IsTryLock,
enum LockingSemantics Semantics,
CheckerKind CheckKind) const { … }
void PthreadLockChecker::ReleaseAnyLock(const CallEvent &Call,
CheckerContext &C,
CheckerKind CheckKind) const { … }
void PthreadLockChecker::ReleaseLockAux(const CallEvent &Call,
CheckerContext &C, const Expr *MtxExpr,
SVal MtxVal,
CheckerKind CheckKind) const { … }
void PthreadLockChecker::DestroyPthreadLock(const CallEvent &Call,
CheckerContext &C,
CheckerKind CheckKind) const { … }
void PthreadLockChecker::DestroyXNULock(const CallEvent &Call,
CheckerContext &C,
CheckerKind CheckKind) const { … }
void PthreadLockChecker::DestroyLockAux(const CallEvent &Call,
CheckerContext &C, const Expr *MtxExpr,
SVal MtxVal,
enum LockingSemantics Semantics,
CheckerKind CheckKind) const { … }
void PthreadLockChecker::InitAnyLock(const CallEvent &Call, CheckerContext &C,
CheckerKind CheckKind) const { … }
void PthreadLockChecker::InitLockAux(const CallEvent &Call, CheckerContext &C,
const Expr *MtxExpr, SVal MtxVal,
CheckerKind CheckKind) const { … }
void PthreadLockChecker::reportBug(CheckerContext &C,
std::unique_ptr<BugType> BT[],
const Expr *MtxExpr, CheckerKind CheckKind,
StringRef Desc) const { … }
void PthreadLockChecker::checkDeadSymbols(SymbolReaper &SymReaper,
CheckerContext &C) const { … }
ProgramStateRef PthreadLockChecker::checkRegionChanges(
ProgramStateRef State, const InvalidatedSymbols *Symbols,
ArrayRef<const MemRegion *> ExplicitRegions,
ArrayRef<const MemRegion *> Regions, const LocationContext *LCtx,
const CallEvent *Call) const { … }
void ento::registerPthreadLockBase(CheckerManager &mgr) { … }
bool ento::shouldRegisterPthreadLockBase(const CheckerManager &mgr) { … }
#define REGISTER_CHECKER(name) …
REGISTER_CHECKER(PthreadLockChecker)
REGISTER_CHECKER(FuchsiaLockChecker)
REGISTER_CHECKER(C11LockChecker)