[PATCH] D74973: [analyzer] StdLibraryFunctionsChecker refactor w/ inheritance

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 21 09:55:52 PST 2020


martong created this revision.
martong added reviewers: NoQ, Szelethus, balazske, gamesh411, baloghadamsoftware, steakhal.
Herald added subscribers: cfe-commits, Charusso, dkrupp, donat.nagy, mikhail.ramalho, a.sidorin, rnkovacs, szepet, xazax.hun, whisperity.
Herald added a project: clang.
martong added a child revision: D73898: [analyzer] StdLibraryFunctionsChecker: Add argument constraints.

Currently, ValueRange is very hard to extend with new kind of constraints.
For instance, it forcibly encapsulates relations between arguments and the
return value (ComparesToArgument) besides handling the regular value
ranges (OutOfRange, WithinRange).
ValueRange in this form is not suitable to add new constraints on
arguments like "not-null".

This refactor introduces a new base class ValueConstraint with an
abstract apply function. Descendants must override this. There are 2
descendants: RangeConstraint and ComparisonConstraint. In the following
patches I am planning to add the NotNullConstraint, and additional
virtual functions like `negate()` and `warning()`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74973

Files:
  clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74973.245899.patch
Type: text/x-patch
Size: 10139 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200221/71ed5c0f/attachment-0001.bin>


More information about the cfe-commits mailing list