[PATCH] D55007: [Analyzer] Constraint Manager - Calculate Effective Range for Differences

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 27 15:37:31 PDT 2019


NoQ accepted this revision.
NoQ added a comment.
This revision is now accepted and ready to land.

What i was trying to say with my last comment is that i guess i'd rather go for option (1) because with that `getRange()` remains the single source of truth, which is comfy.

I agree this shouldn't really be blocking the patch - sorry for stalling! - i'm hopefully slowly getting better at not stalling.

Generally i would have went for saving some memory and expensive ImmutableMap lookups by canonicalizing the key as much as possible.

Do we want to add the opposite test

  void effective_range_2(int m, int n) {
    assert(m - n <= 0);
    assert(n - m <= 0);
    clang_analyzer_eval(m - n == 0); // expected-warning{{TRUE}} expected-warning{{FALSE}}
    clang_analyzer_eval(n - m == 0); // expected-warning{{TRUE}} expected-warning{{FALSE}}
  }

...where the `FALSE` case corresponds to `m - n == INT_MIN`?



================
Comment at: lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:483
+
+  // If we have range set sotred for both A - B and B - A then calculate the
+  // effective range set by intersecting the range set for A - B and the
----------------
`sotred` -> `stored` :)


Repository:
  rC Clang

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

https://reviews.llvm.org/D55007





More information about the cfe-commits mailing list