26class ObjCAtSyncChecker
27 :
public Checker< check::PreStmt<ObjCAtSynchronizedStmt> > {
28 mutable std::unique_ptr<BugType> BT_null;
29 mutable std::unique_ptr<BugType> BT_undef;
39 const Expr *Ex = S->getSynchExpr();
44 if (isa<UndefinedVal>(
V)) {
47 BT_undef.reset(
new BugType(
this,
"Uninitialized value used as mutex "
48 "for @synchronized"));
49 auto report = std::make_unique<PathSensitiveBugReport>(
50 *BT_undef, BT_undef->getDescription(), N);
52 C.emitReport(std::move(report));
62 std::tie(notNullState, nullState) = state->assume(
V.castAs<
DefinedSVal>());
68 if (
ExplodedNode *N =
C.generateNonFatalErrorNode(nullState)) {
71 new BugType(
this,
"Nil value used as mutex for @synchronized() "
72 "(no synchronization will occur)"));
73 auto report = std::make_unique<PathSensitiveBugReport>(
74 *BT_null, BT_null->getDescription(), N);
77 C.emitReport(std::move(report));
87 C.addTransition(notNullState);
94bool ento::shouldRegisterObjCAtSyncChecker(
const CheckerManager &mgr) {
Defines the Objective-C statement AST node classes.
This represents one expression.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Represents Objective-C's @synchronized statement.
CHECKER * registerChecker(AT &&... Args)
Used to register checkers.
const LangOptions & getLangOpts() const
SVal - This represents a symbolic expression, which can be either an L-value or an R-value.
bool trackExpressionValue(const ExplodedNode *N, const Expr *E, PathSensitiveBugReport &R, TrackingOptions Opts={})
Attempts to add visitors to track expression value back to its point of origin.