@@ -248,6 +248,9 @@ ExplodedNode *AllocationChecker::emitAllocationPartitionWarning(
248
248
249
249
void AllocationChecker::checkPostStmt (const CastExpr *CE,
250
250
CheckerContext &C) const {
251
+ if (!isPureCapMode (C.getASTContext ()))
252
+ return ;
253
+
251
254
if (CE->getCastKind () != CK_BitCast)
252
255
return ;
253
256
SVal SrcVal = C.getSVal (CE->getSubExpr ());
@@ -318,6 +321,9 @@ void AllocationChecker::checkPostStmt(const CastExpr *CE,
318
321
319
322
void AllocationChecker::checkPreCall (const CallEvent &Call,
320
323
CheckerContext &C) const {
324
+ if (!isPureCapMode (C.getASTContext ()))
325
+ return ;
326
+
321
327
if (IgnoreFnSet.contains (Call) || CheriBoundsFnSet.contains (Call))
322
328
return ;
323
329
@@ -360,6 +366,9 @@ void AllocationChecker::checkPreCall(const CallEvent &Call,
360
366
361
367
void AllocationChecker::checkPostCall (const CallEvent &Call,
362
368
CheckerContext &C) const {
369
+ if (!isPureCapMode (C.getASTContext ()))
370
+ return ;
371
+
363
372
if (!CheriBoundsFnSet.contains (Call))
364
373
return ;
365
374
const MemRegion *MR = C.getSVal (Call.getArgExpr (0 )).getAsRegion ();
@@ -379,6 +388,9 @@ void AllocationChecker::checkPostCall(const CallEvent &Call,
379
388
380
389
void AllocationChecker::checkBind (SVal L, SVal V, const Stmt *S,
381
390
CheckerContext &C) const {
391
+ if (!isPureCapMode (C.getASTContext ()))
392
+ return ;
393
+
382
394
const MemRegion *Dst = L.getAsRegion ();
383
395
if (!Dst || !isa<FieldRegion>(Dst))
384
396
return ;
@@ -400,6 +412,9 @@ void AllocationChecker::checkBind(SVal L, SVal V, const Stmt *S,
400
412
401
413
void AllocationChecker::checkEndFunction (const ReturnStmt *RS,
402
414
CheckerContext &C) const {
415
+ if (!isPureCapMode (C.getASTContext ()))
416
+ return ;
417
+
403
418
if (!RS)
404
419
return ;
405
420
const Expr *RV = RS->getRetValue ();
0 commit comments