[PATCH] D35110: [Analyzer] Constraint Manager Negates Difference
Artem Dergachev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue May 29 11:16:55 PDT 2018
NoQ added inline comments.
================
Comment at: lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:191
+ }
+ if (from.isMinSignedValue()) {
+ F.add(newRanges, Range(BV.getMinValue(from), BV.getMinValue(from)));
----------------
We'll also need to merge the two adjacent segments if the original range had both a [MinSingedValue, MinSignedValue] and a [X, MaxSignedValue]:
{F6287707}
Because our immutable sets are sorted, you can conduct the check for the first and the last segment separately.
I think this code needs comments because even though it's short it's pretty hard to get right.
================
Comment at: lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:192
+ if (from.isMinSignedValue()) {
+ F.add(newRanges, Range(BV.getMinValue(from), BV.getMinValue(from)));
+ }
----------------
Return value of `add` seems to be accidentally discarded here.
I guess i'll look into adding an `__attribute__((warn_unused_result))` to these functions, because it's a super common bug.
https://reviews.llvm.org/D35110
More information about the cfe-commits
mailing list