[PATCH] D99797: [analyzer] Handle intersections and adjacency in RangeSet::Factory::add function
Denys Petrov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 2 13:10:54 PDT 2021
ASDenysPetrov added a comment.
@vsavchenko FYI.
================
Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:112-113
+RangeSet RangeSet::Factory::add(RangeSet LHS, RangeSet RHS) {
+ if (LHS.isEmpty())
+ return RHS;
+ for (const Range &R : RHS)
----------------
Also optimized this particular case.
================
Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:138-139
- return makePersistent(std::move(Result));
-}
+ if (!Original.pin(From, To))
+ return getEmptySet();
----------------
This allows to add a RangeSet of any type. E.g. RangeSet(uchar) + RangeSet(int) = valid, because of `pin`
I'm wondering whether we really need it here in practice?
================
Comment at: clang/unittests/StaticAnalyzer/RangeSetTest.cpp:166
RawRangeSet RawExpected) {
- wrap(&Self::checkAddImpl<RangeSet>, RawRHS, RawLHS, RawExpected);
+ wrap(&Self::checkAddImpl<RangeSet>, RawLHS, RawRHS, RawExpected);
}
----------------
Fixed the misprint.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D99797/new/
https://reviews.llvm.org/D99797
More information about the cfe-commits
mailing list