[PATCH] D112621: [analyzer][solver] Introduce reasoning for not equal to operator

Manas Gupta via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 18 18:52:25 PDT 2022


manas marked an inline comment as done.
manas added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:1272-1273
+  // (x != y).
+  if ((ConvertedLHS.getMaxValue() < ConvertedRHS.getMinValue()) ||
+      (ConvertedLHS.getMinValue() > ConvertedRHS.getMaxValue())) {
+    return getTrueRange(T);
----------------
manas wrote:
> steakhal wrote:
> > This and the subsequent similar block could be implemented by a member function of a `RangeSet`.
> > It's highly likely that many of these `VisitBinaryOperator<Op>()` functions could benefit from reusing them in the future if we decide to handle more of them.
> I agree. I will try to find similarities which can be extracted from remaining binops and put them I a member function.
This comment is about finding intersecting Ranges in `ConvertedLHS/ConvertedRHS` which was previously done by comparing `getMinValue/getMaxValue`. Now, we use intersect family of methods for it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112621



More information about the cfe-commits mailing list