[PATCH] D99797: [analyzer] Implemented RangeSet::Factory::unite function to handle intersections and adjacency

Denys Petrov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 9 10:43:04 PDT 2021


ASDenysPetrov added a comment.

@vsavchenko
Thank you for a proposed solution. It looks much easier to understand and maintain. Great! I will take it into account.

> Well, that is a nice exercise for "two pointer" problems, but can we please talk about the actual use case for it?

I'm currently working on **integral cast between ranges**. Consider the range of `int` which is casted to `char`. You've got some ranges of `int` which obviously should be corespondently represented as some other ranges of `char`.
Some examples:

  int [257, 259]  -> char [1, 3]
  int [510, 513]  -> char [-2, 1]
  int [42, 1000]  -> char [-128, 127]
  int [257, 259] U [2049, 2051]  -> char [1,3] // Here we need `unite` logic to get a casted range because both original ranges lay on the same area after trancation.


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

https://reviews.llvm.org/D99797



More information about the cfe-commits mailing list