[PATCH] D77066: [analyzer] ApiModeling: Add buffer size arg constraint

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 14 07:27:45 PDT 2020


martong added a comment.

In D77066#1953280 <https://reviews.llvm.org/D77066#1953280>, @Charusso wrote:

> Please avoid to stuff in `CheckerContext` because this facility should be used by ExprEngine/Store as well.
>  Let us reword your API: `getDynamicSizeWithOffset(ProgramStateRef, SVal, SValBuilder &)`. Of course we are trying to obtain some buffer-ish size, that is the purpose of the entire API.
>  I also could imagine something like `getDynamicSizeMul(ProgramStateRef, const MemRegion &, const MemRegion &, SValBuilder &)`, as it is very common.
>
> May it would make sense to use the API like:
>
>   getDynamicSizeWithOffset(State, MR, SVB) {
>     Offset = State->getStoreManager().getStaticOffset(MR, SVB);
>     ...
>   }
>
>
> This idea is similar to `MemRegionManager::getStaticSize(MR, SVB)`. Hopefully no-one needs dynamic offsets.


Thanks for the review! I've update the API as you suggested.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77066/new/

https://reviews.llvm.org/D77066





More information about the cfe-commits mailing list