[PATCH] D41938: [Analyzer] SValBuilder Comparison Rearrangement (with Restrictions and Analyzer Option)

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 17 10:18:44 PST 2018


NoQ added a comment.

I think it'd be fine to do the rearrangement for additive ops without the option check, as we discussed. I.e., rearrange when it's either an additive op, or both the flag is set and the values are overflow-clamped. And remove the clamp checks (which are presumably heavy) for the additive ops, as they're not needed.



================
Comment at: include/clang/StaticAnalyzer/Core/AnalyzerOptions.h:591-596
+  /// Returns true if SValBuilder should rearrange comparisons of symbolic
+  /// expressions which consists of the sum of a symbol and a concrete integer
+  /// into a format where symbols are on the left side and the integer on the
+  /// right. This is only done if both concrete integers are greter or equal to
+  /// the quarter of the minimum value of the type and less or equal to the
+  /// quarter of the maximum.
----------------
Fixed some typos:
```
  /// Returns true if SValBuilder should rearrange comparisons of symbolic
  /// expressions which consist of a sum of a symbol and a concrete integer
  /// into the format where symbols are on the left-hand side and the integer is on the
  /// right. This is only done if both concrete integers are greater than or equal to
  /// the quarter of the minimum value of the type and less than or equal to the
  /// quarter of the maximum value of that type.
```
(line breaks might need fixing)


================
Comment at: test/Analysis/svalbuilder-rearrange-comparisons.c:5
+void clang_analyzer_eval(int x);
+void clang_analyzer_printState();
+
----------------
I guess you're not going to need the printState thing once these tests are settled down.


https://reviews.llvm.org/D41938





More information about the cfe-commits mailing list