[PATCH] D130372: [analyzer] Add a new factory function RangeSet::Factory::invert

Denys Petrov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 22 10:17:35 PDT 2022


ASDenysPetrov created this revision.
ASDenysPetrov added reviewers: martong, NoQ, steakhal, balazske.
ASDenysPetrov added a project: clang.
Herald added subscribers: manas, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, xazax.hun.
Herald added a project: All.
ASDenysPetrov requested review of this revision.
Herald added a subscriber: cfe-commits.

Add a new factory function `RangeSet::Factory::invert`. It performs an inversion operation on the given set and produces a new one as a result. The inversion of the set is a set containing all the values except those which are in the original one.

NOTE: User shall guarantee that the given set is not empty.

Example:
original: `int8[0, 42]` inverse: `int8[-128, -1]U[43, 127]`;
original: `int8[-128, 127]` inverse: `int8[]`;
original: `[]` inverse: `raise an assertion`.

The motivation is to extend the set of operations that can be performed on range sets. Specifically, this function is needed for the next patch in the stack.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D130372

Files:
  clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h
  clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
  clang/unittests/StaticAnalyzer/RangeSetTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130372.446893.patch
Type: text/x-patch
Size: 6335 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220722/ceecad41/attachment-0001.bin>


More information about the cfe-commits mailing list