Instead of checking the range manually, changed the checker to use assumeInclusiveRangeDual instead.
This patch was part of D28955.
Paths
| Differential D73062
[analyzer] Simplify BoolAssignmentChecker ClosedPublic Authored by mikhail.ramalho on Jan 20 2020, 11:33 AM.
Details
Summary Instead of checking the range manually, changed the checker to use assumeInclusiveRangeDual instead. This patch was part of D28955.
Diff Detail Event Timelinemikhail.ramalho retitled this revision from Simplify BoolAssignmentChecker to [analyzer] Simplify BoolAssignmentChecker.Jan 20 2020, 11:36 AM Herald added subscribers: dkrupp, donat.nagy, Szelethus and 4 others. · View Herald TranscriptJan 20 2020, 11:36 AM Comment Actions Thanks!!! Small patches are so nice to review.
This revision is now accepted and ready to land.Jan 27 2020, 9:36 AM Closed by commit rG88c7b1642079: [analyzer] Simplify BoolAssignmentChecker (authored by Mikhail Gadelha <mikhail.gadelha@sidia.com>). · Explain WhyJan 27 2020, 10:57 AM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 239181 clang/lib/StaticAnalyzer/Checkers/BoolAssignmentChecker.cpp
clang/test/Analysis/bool-assignment.c
clang/test/Analysis/dead-stores.m
clang/test/Analysis/misc-ps-eager-assume.m
|
I believe this should be !StIn. I.e., the right check to do is "the value is known to be not boolean" (this is definitely a buggy execution path the static analyzer managed to discover), whereas "the value is not known to be definitely boolean" is the wrong check to do (the static analyzer doesn't have enough information to conclude that the value is definitely boolean, which might be because the value may be non-boolean, but it's more likely that this happens because the static analyzer simply doesn't know enough about the program).
I think this change should fix the regressions on the test suite.