forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 339
Static analyzer cherry picks #21 #2763
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
SavchenkoValeriy
merged 8 commits into
swiftlang:apple/stable/20210107
from
SavchenkoValeriy:april_2021_analyzer_cherry_picks
Apr 1, 2021
Merged
Static analyzer cherry picks #21 #2763
SavchenkoValeriy
merged 8 commits into
swiftlang:apple/stable/20210107
from
SavchenkoValeriy:april_2021_analyzer_cherry_picks
Apr 1, 2021
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Additionally, this patch puts an assertion checking for feasible constraints in every place where constraints are assigned to states. Differential Revision: https://reviews.llvm.org/D98948 (cherry picked from commit 3085bda)
ImmutableSet doesn't seem like the perfect fit for the RangeSet data structure. It is good for saving memory in a persistent setting, but not for the case when the population of the container is tiny. This commit replaces RangeSet implementation and redesigns the most common operations to be more efficient. Differential Revision: https://reviews.llvm.org/D86465 (cherry picked from commit 02b51e5)
(cherry picked from commit 9cd7c41)
(cherry picked from commit f8a850c)
Currently, we infer 0 if the divisible of the modulo op is 0: int a = x < 0; // a can be 0 int b = a % y; // b is either 1 % sym or 0 However, we don't when the op is / : int a = x < 0; // a can be 0 int b = a / y; // b is either 1 / sym or 0 / sym This commit fixes the discrepancy. Differential Revision: https://reviews.llvm.org/D99343 (cherry picked from commit 015c398)
It makes sense to track rvalue expressions in the case of special concrete integer values. The most notable special value is zero (later we may find other values). By tracking the origin of 0, we can provide a better explanation for users e.g. in case of division by 0 warnings. When the divisor is a product of a multiplication then now we can show which operand (or both) was (were) zero and why. Differential Revision: https://reviews.llvm.org/D99344 (cherry picked from commit efa7df1)
`allocClassWithName` allocates an object with the given type. The type is actually provided as a string argument (type's name). This creates a possibility for not particularly useful warnings from the analyzer. In order to combat with those, this patch checks for casts of the `allocClassWithName` results to types mentioned directly as its argument. All other uses of this method should be reasoned about as before. rdar://72165694 Differential Revision: https://reviews.llvm.org/D99500 (cherry picked from commit 9037730)
rdar://75020762 Differential Revision: https://reviews.llvm.org/D99274 (cherry picked from commit af7e1f0)
@swift-ci test |
haoNoQ
approved these changes
Apr 1, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Clang Static Analyzer is traditionally kept reasonably fresh on stable branches through continuous cherry-picking.