@@ -214,6 +214,9 @@ ExplodedNode *AllocationChecker::emitAllocationPartitionWarning(
214214
215215void AllocationChecker::checkPostStmt (const CastExpr *CE,
216216 CheckerContext &C) const {
217+ if (!isPureCapMode (C.getASTContext ()))
218+ return ;
219+
217220 if (CE->getCastKind () != CK_BitCast)
218221 return ;
219222 SVal SrcVal = C.getSVal (CE->getSubExpr ());
@@ -284,6 +287,9 @@ void AllocationChecker::checkPostStmt(const CastExpr *CE,
284287
285288void AllocationChecker::checkPreCall (const CallEvent &Call,
286289 CheckerContext &C) const {
290+ if (!isPureCapMode (C.getASTContext ()))
291+ return ;
292+
287293 if (IgnoreFnSet.contains (Call) || CheriBoundsFnSet.contains (Call))
288294 return ;
289295
@@ -331,6 +337,9 @@ void AllocationChecker::checkPreCall(const CallEvent &Call,
331337
332338void AllocationChecker::checkPostCall (const CallEvent &Call,
333339 CheckerContext &C) const {
340+ if (!isPureCapMode (C.getASTContext ()))
341+ return ;
342+
334343 if (!CheriBoundsFnSet.contains (Call))
335344 return ;
336345 const MemRegion *MR = C.getSVal (Call.getArgExpr (0 )).getAsRegion ();
@@ -350,6 +359,9 @@ void AllocationChecker::checkPostCall(const CallEvent &Call,
350359
351360void AllocationChecker::checkBind (SVal L, SVal V, const Stmt *S,
352361 CheckerContext &C) const {
362+ if (!isPureCapMode (C.getASTContext ()))
363+ return ;
364+
353365 const MemRegion *Dst = L.getAsRegion ();
354366 if (!Dst || !isa<FieldRegion>(Dst))
355367 return ;
@@ -371,6 +383,9 @@ void AllocationChecker::checkBind(SVal L, SVal V, const Stmt *S,
371383
372384void AllocationChecker::checkEndFunction (const ReturnStmt *RS,
373385 CheckerContext &C) const {
386+ if (!isPureCapMode (C.getASTContext ()))
387+ return ;
388+
374389 if (!RS)
375390 return ;
376391 const Expr *RV = RS->getRetValue ();
0 commit comments