[PATCH] D103096: [analyzer] Implement cast for ranges of symbolic integers

2022-11-22 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 477233. ASDenysPetrov added a comment. Completely reworked solution. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D103096/new/ https://reviews.llvm.org/D103096 Files: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp

[PATCH] D138319: [analyzer] Prepare structures for integral cast feature introducing

2022-11-18 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov created this revision. ASDenysPetrov added reviewers: NoQ, MaskRay, martong, steakhal. ASDenysPetrov added a project: clang. Herald added subscribers: manas, StephenFan, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, xazax.hun.

[PATCH] D126481: [analyzer] Handle SymbolCast in SValBuilder

2022-10-03 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @martong > So, the intersection should be empty in the above mentioned ambiguous case, > shouldn't' it? No. My current implementation doesn't contain this check in ConstraintAssignor in favor of the solution simplification. It'll be added in the next patches.

[PATCH] D126481: [analyzer] Handle SymbolCast in SValBuilder

2022-09-28 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @martong > Then we can iterate onto the solution. What we could do is to collect the > constants and types on the way of the cast visitation and then apply the same > logic that you have in D103096 . Suppose we have found the

[PATCH] D126481: [analyzer] Handle SymbolCast in SValBuilder

2022-09-28 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. In D126481#3818769 , @martong wrote: > Yeah okay. I get it now. Thank you for your patience and your time on > elaborating the issue. > > First, I think we'd need to fabricate a test case that shows us the bug even >

[PATCH] D126481: [analyzer] Handle SymbolCast in SValBuilder

2022-09-27 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @martong wrote: I think you did get it. I'm not talking about range but about concrete int. And I see that the current behavior needs an improvement or rework. Consider next code, which I used in my example: 1. void test(int x) { 2. assert((short)x == 0);

[PATCH] D126481: [analyzer] Handle SymbolCast in SValBuilder

2022-09-26 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov reopened this revision. ASDenysPetrov added a comment. This revision is now accepted and ready to land. I've just investigated this patch deeply. I think we have wrong logic here. Assume we have `(int)(short)(int x)`. `VisitSymbolCast` will try to get the constant recursively in

[PATCH] D112621: [analyzer][solver] Introduce reasoning for not equal to operator

2022-08-29 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @manas Ping. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D112621/new/ https://reviews.llvm.org/D112621 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D131707: [analyzer][NFC] Cache the result of getLocationType in TypedValueRegion

2022-08-15 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. In D131707#3723403 , @ASDenysPetrov wrote: > @steakhal > Thank you for the review. > Could you please do testing for me, since I'm on Windows and have no prepared > testing environment as I know you do. > I'll add an

[PATCH] D131707: [analyzer][NFC] Cache the result of getLocationType in TypedValueRegion

2022-08-15 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 452689. ASDenysPetrov added a comment. Add assertion accroding to the remark. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D131707/new/ https://reviews.llvm.org/D131707 Files:

[PATCH] D131707: [analyzer][NFC] Cache the result of getLocationType in TypedValueRegion

2022-08-15 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @steakhal Thank you for the review. Could you please do testing for me, since I'm on Windows and have no prepared testing environment as I know you are. I'll add an assertion. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D131707: [analyzer]{NFC} Cache the result of getLocationType in TypedValueRegion

2022-08-11 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov created this revision. ASDenysPetrov added reviewers: steakhal, martong, NoQ, xazax.hun, isuckatcs. ASDenysPetrov added a project: clang. Herald added subscribers: manas, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware. Herald added a

[PATCH] D131514: [analyzer] [NFC] Add more test cases for equality tracking

2022-08-10 Thread Denys Petrov via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG7e2b995e0cce: [analyzer] [NFC] Add more test cases for equality tracking (authored by ASDenysPetrov). Repository: rG LLVM Github Monorepo

[PATCH] D131514: [analyzer] [NFC] Add more test cases for equality tracking

2022-08-10 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 451527. ASDenysPetrov added a comment. C-standard does not support templates. Replaced function template with the function. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D131514/new/ https://reviews.llvm.org/D131514 Files:

[PATCH] D131514: [analyzer] {NFC} Add more test cases for equality tracking

2022-08-09 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov created this revision. ASDenysPetrov added reviewers: martong, steakhal, NoQ. ASDenysPetrov added a project: clang. Herald added subscribers: manas, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, xazax.hun. Herald added a project:

[PATCH] D130372: [analyzer] Add a new factory function RangeSet::Factory::invert

2022-08-09 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. The //motivation //for this revision is lost due to the logical mistake in the later. However, this revision could be used for other improvements in the future. I will not merge it until new //motivation //has become. CHANGES SINCE LAST ACTION

[PATCH] D131006: [analyzer] Use DisequalityMap while inferring constraints

2022-08-09 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @martong This solution has an essential logical mistake. It relies on the erroneous assumption that if `x > 0 && x != y` then `y` is in range `[MIN, 0]` but that's **not** true. `x` and `y` could be `1` and `2` respectively. My idea will only work with concrete

[PATCH] D130372: [analyzer] Add a new factory function RangeSet::Factory::invert

2022-08-05 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. In D130372#3699036 , @martong wrote: > LGTM! Nice work! Thank you. I prefer to load this along with the motivation part D131006 . CHANGES SINCE LAST ACTION

[PATCH] D131006: [analyzer] Use DisequalityMap while inferring constraints

2022-08-04 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. In D131006#3699017 , @martong wrote: > Awesome! Thank you! Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:1512-1516 +if (IsFirst) { + IsFirst = false; +

[PATCH] D130372: [analyzer] Add a new factory function RangeSet::Factory::invert

2022-08-03 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added inline comments. Comment at: clang/unittests/StaticAnalyzer/RangeSetTest.cpp:1130 + // Check inverting single range. + this->checkInvert({{MIN, MAX}}, {}); + this->checkInvert({{MIN, MID}}, {{MID + 1, MAX}}); martong wrote: > ASDenysPetrov

[PATCH] D130372: [analyzer] Add a new factory function RangeSet::Factory::invert

2022-08-02 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @martong > Now I'm working on the next patch and you'll see a motivation soon. Here is the motivation but it still causes some tests failure D131006 . CHANGES SINCE LAST ACTION https://reviews.llvm.org/D130372/new/

[PATCH] D131006: [analyzer] Use DisequalityMap while inferring constraints

2022-08-02 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov created this revision. ASDenysPetrov added reviewers: martong, steakhal, NoQ. ASDenysPetrov added a project: clang. Herald added subscribers: manas, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, xazax.hun. Herald added a project:

[PATCH] D130372: [analyzer] Add a new factory function RangeSet::Factory::invert

2022-07-27 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 448161. ASDenysPetrov added a comment. Make changes according to the remarks. - Add complexity to function description. - Rewrite the loop making it deterministic. - Add back invert operation to the tests. CHANGES SINCE LAST ACTION

[PATCH] D130372: [analyzer] Add a new factory function RangeSet::Factory::invert

2022-07-27 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov marked 3 inline comments as done. ASDenysPetrov added a comment. Now I'm working on the next patch and you'll see a motivation soon. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D130372/new/ https://reviews.llvm.org/D130372

[PATCH] D130372: [analyzer] Add a new factory function RangeSet::Factory::invert

2022-07-27 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov marked 6 inline comments as done. ASDenysPetrov added a comment. @martong Thanks for review. Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:728-729 + ContainerType Result; + Result.reserve(What.size() + 1 - bool(What.getMinValue() != MIN)

[PATCH] D130372: [analyzer] Add a new factory function RangeSet::Factory::invert

2022-07-22 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov created this revision. ASDenysPetrov added reviewers: martong, NoQ, steakhal, balazske. ASDenysPetrov added a project: clang. Herald added subscribers: manas, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, xazax.hun. Herald added a

[PATCH] D130029: [analyzer][NFC] Use `SValVisitor` instead of explicit helper functions

2022-07-19 Thread Denys Petrov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGa364987368a1: [analyzer][NFC] Use `SValVisitor` instead of explicit helper functions (authored by ASDenysPetrov). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D112621: [analyzer][solver] Introduce reasoning for not equal to operator

2022-07-19 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. In D112621#3660256 , @manas wrote: > Is there any other way to formulate the expression so that it constructs `LHS > = [1, 2] U [8, 9]` and doesn't bifurcate? Try this `u1 > 0 && u1 < 10 && u1 != 3 && u1 != 4 && u1 != 5

[PATCH] D130029: [analyzer][NFC] Use `SValVisitor` instead of explicit helper functions

2022-07-18 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. In D90157#2518118 , @steakhal wrote: > Why don't you use the `SValVisitor` instead? @steakhal Finally fulfilled you suggestion :-) Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D130029: [analyzer][NFC] Use `SValVisitor` instead of explicit helper functions

2022-07-18 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov created this revision. ASDenysPetrov added reviewers: martong, NoQ, steakhal. ASDenysPetrov added a project: clang. Herald added subscribers: manas, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, xazax.hun. Herald added a project:

[PATCH] D129498: [analyzer] Add new function `clang_analyzer_value` to ExprInspectionChecker

2022-07-15 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov closed this revision. ASDenysPetrov added a comment. Closed with bc08c3cb7f8e797fee14e96eedd3dc358608ada3 Comment at: clang/test/Analysis/print-ranges.cpp:1 +// RUN: %clang_analyze_cc1

[PATCH] D112621: [analyzer][solver] Introduce reasoning for not equal to operator

2022-07-15 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @manas I'm sorry but it seems like I brought you a new work :-) I've just loaded these two patches (D129678 and D129498 ) and now you have to rebase your changes. But there is a good news as

[PATCH] D129678: [analyzer][NFC] Tidy up handler-functions in SymbolicRangeInferrer

2022-07-15 Thread Denys Petrov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG82f76c04774f: [analyzer][NFC] Tidy up handler-functions in SymbolicRangeInferrer (authored by ASDenysPetrov). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D129678: [analyzer][NFC] Tidy up handler-functions in SymbolicRangeInferrer

2022-07-14 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 444752. ASDenysPetrov added a comment. Fixed a typo that caused `constraint_manager_negate.c` and `unary-sym-expr.c` tests crashes. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D129678/new/ https://reviews.llvm.org/D129678 Files:

[PATCH] D129498: [analyzer] Add new function `clang_analyzer_value` to ExprInspectionChecker

2022-07-14 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 444689. ASDenysPetrov added a comment. Stick to name `clang_analyzer_value`. Change function name from `printRange` to `printValue`. Make description more precise in the documentation. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D129498/new/

[PATCH] D129678: Tidy up handler-functions in SymbolicRangeInferrer

2022-07-13 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov created this revision. ASDenysPetrov added reviewers: martong, steakhal, NoQ. ASDenysPetrov added a project: clang. Herald added a subscriber: rnkovacs. Herald added a project: All. ASDenysPetrov requested review of this revision. Herald added a subscriber: cfe-commits. Sorted some

[PATCH] D129498: [analyzer] Add new function `clang_analyzer_value` to ExprInspectionChecker

2022-07-13 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 444336. ASDenysPetrov added a comment. Constrained the test by adding llvm-lit `REQUIRES` command. Documented a new function at https://clang.llvm.org/docs/analyzer/developer-docs/DebugChecks.html CHANGES SINCE LAST ACTION

[PATCH] D129498: [analyzer] Add new function `clang_analyzer_value` to ExprInspectionChecker

2022-07-13 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. In D129498#3644222 , @NoQ wrote: > Looks great! > > Maybe `clang_analyzer_range()` instead? This was its first name. I refused. First, because it emits concrete integers as well and moreover we can extend it for arrays or

[PATCH] D104647: [analyzer] Support SVal::getType for pointer-to-member values

2022-07-11 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. Herald added a project: All. @vsavchenko Is this alive? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D104647/new/ https://reviews.llvm.org/D104647 ___ cfe-commits mailing

[PATCH] D112621: [analyzer][solver] Introduce reasoning for not equal to operator

2022-07-11 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @manas ? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D112621/new/ https://reviews.llvm.org/D112621 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D129498: [analyzer] Add new function `clang_analyzer_value` to ExprInspectionChecker

2022-07-11 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov created this revision. ASDenysPetrov added reviewers: martong, steakhal, NoQ, Charusso. ASDenysPetrov added a project: clang. Herald added subscribers: manas, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, xazax.hun. Herald added a

[PATCH] D103096: [analyzer] Implement cast for ranges of symbolic integers

2022-07-11 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov marked 10 inline comments as done. ASDenysPetrov added a comment. @martong Thank you for your patience. I started moving to a bit another direction that we can improving it iteratively. Just spoiling, in my latest solution a single symbol will be associated to many classes. Here

[PATCH] D129152: [Clang][unittests] Silence trucation warning with MSVC

2022-07-05 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov accepted this revision. ASDenysPetrov added a comment. This revision is now accepted and ready to land. @aganea Thank you for fixing this. `TestValues` structure impies to hold a set of values which can do some kind of convertions including truncations. This is what tests are

[PATCH] D103096: [analyzer] Implement cast for ranges of symbolic integers

2022-06-27 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov marked 4 inline comments as done. ASDenysPetrov added a comment. @martong Just FYI. I've been working on reworking this solution to using `EquivalenceClasses` for several weeks. It turned out that this is an extremely hard task to acomplish. There a lot of cast cases like:

[PATCH] D126481: [analyzer] Handle SymbolCast in SValBuilder

2022-05-30 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov accepted this revision. ASDenysPetrov added a comment. This revision is now accepted and ready to land. In D126481#3545350 , @martong wrote: > This part of the SValBuilder is responsible for **constant folding**. We need > this constant

[PATCH] D126481: [analyzer] Handle SymbolCast in SValBuilder

2022-05-27 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @martong As you said, my solution D103096 suppose to pass these and more other tests cases. So how it will help in combination with my solution D103096 ? Although, your patch is really simple

[PATCH] D103096: [analyzer] Implement cast for ranges of symbolic integers

2022-05-13 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. In D103096#3502955 , @martong wrote: > Ping Thank you, folk, for taking you time. I'll surely make corresponding changes according ещ your suggestions and notify you then. Sorry, @martong, for the late response. I'm

[PATCH] D103096: [analyzer] Implement cast for ranges of symbolic integers

2022-04-26 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 425248. ASDenysPetrov marked 4 inline comments as done. ASDenysPetrov edited the summary of this revision. ASDenysPetrov added a comment. @martong thank you for the idea. I've tried to implement it. Could you look at the patch once again, please?

[PATCH] D103096: [analyzer] Implement cast for ranges of symbolic integers

2022-04-22 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov marked 10 inline comments as done. ASDenysPetrov added a comment. Thank you for the review @martong! Your work is not less harder then mine. I'll rework and update the revision ASAP. Comment at: clang/lib/StaticAnalyzer/Checkers/ExprInspectionChecker.cpp:421-426

[PATCH] D103094: [analyzer] Implemented RangeSet::Factory::castTo function to perform promotions, truncations and conversions

2022-04-19 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 423813. ASDenysPetrov added a comment. Loaded with comment updateds according to the remarks. @martong thank you for your time for the review! CHANGES SINCE LAST ACTION https://reviews.llvm.org/D103094/new/ https://reviews.llvm.org/D103094 Files:

[PATCH] D103094: [analyzer] Implemented RangeSet::Factory::castTo function to perform promotions, truncations and conversions

2022-04-19 Thread Denys Petrov via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGe37726beb22a: [analyzer] Implemented RangeSet::Factory::castTo function to perform promotions… (authored by ASDenysPetrov). Changed prior to

[PATCH] D103094: [analyzer] Implemented RangeSet::Factory::castTo function to perform promotions, truncations and conversions

2022-04-15 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 423080. ASDenysPetrov added a comment. Updated according to suggestions. @martong thank you for the review. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D103094/new/ https://reviews.llvm.org/D103094 Files:

[PATCH] D103094: [analyzer] Implemented RangeSet::Factory::castTo function to perform promotions, truncations and conversions

2022-04-15 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:358 + assert(!isEmpty()); + return begin()->From().isUnsigned(); +} martong wrote: > Probably it is unrelated to this patch, but > Could it happen that

[PATCH] D121387: [analyzer] ClangSA should tablegen doc urls refering to the main doc page

2022-04-12 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov accepted this revision. ASDenysPetrov added a comment. Thanks! LGTM. Comment at: clang/utils/TableGen/ClangSACheckersEmitter.cpp:87-90 + std::string CheckerFullName = StringRef(getCheckerFullName(, "-")).lower(); + return

[PATCH] D122243: [analyzer][NFC] Introduce the checker package separator character

2022-04-11 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov accepted this revision. ASDenysPetrov added a comment. LGTM Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D122243/new/ https://reviews.llvm.org/D122243 ___ cfe-commits mailing list

[PATCH] D107636: [analyzer][solver] Compute adjustment for unsupported symbols as well

2022-04-11 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. Herald added a project: All. I checked the tests file on the latest sources. It passes even without your changes. Maybe this patch is already outdated. Comment at: clang/lib/StaticAnalyzer/Core/RangedConstraintManager.cpp:82-86 if

[PATCH] D112621: [analyzer][solver] Introduce reasoning for not equal to operator

2022-04-07 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. Here are my remarks. Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:1415-1416 + + Range CoarseLHS = fillGaps(LHS); + Range CoarseRHS = fillGaps(RHS); + Avoid filling the gaps, because it's completely

[PATCH] D103096: [analyzer] Implement cast for ranges of symbolic integers

2022-03-23 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. Herald added a project: All. Ping. If there is somebody interested in this? :) CHANGES SINCE LAST ACTION https://reviews.llvm.org/D103096/new/ https://reviews.llvm.org/D103096 ___ cfe-commits mailing list

[PATCH] D103094: [analyzer] Implemented RangeSet::Factory::castTo function to perform promotions, truncations and conversions

2022-03-23 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. Herald added a project: All. Ping. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D103094/new/ https://reviews.llvm.org/D103094 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D108032: [analyzer] Retrieve a character from CompoundLiteralExpr as an initializer for constant arrays.

2022-01-27 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov abandoned this revision. ASDenysPetrov added a comment. Paused for a while. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D108032/new/ https://reviews.llvm.org/D108032 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D117229: [Analyzer] Produce SymbolCast for pointer to integer cast

2022-01-20 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/SValBuilder.cpp:1088 } + +SVal clang::ento::SValBuilder::simplifySymbolCast(nonloc::SymbolVal V, ASDenysPetrov wrote: > Notify the user about the contract. Mistake. `CastTy`, not

[PATCH] D117229: [Analyzer] Produce SymbolCast for pointer to integer cast

2022-01-20 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/SValBuilder.cpp:1088 } + +SVal clang::ento::SValBuilder::simplifySymbolCast(nonloc::SymbolVal V, Notify the user about the contract. Comment at:

[PATCH] D117229: [Analyzer] Produce SymbolCast for pointer to integer cast

2022-01-13 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/SValBuilder.cpp:1022 +SVal clang::ento::SValBuilder::simplifySymbolCast(SymbolRef SE, + QualType CastTy) { And it'd be great if you

[PATCH] D105340: [analyzer] Produce SymbolCast symbols for integral types in SValBuilder::evalCast

2022-01-13 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. Thank you @martong. I'll load it ASAP. It's great to see symcasts is closer. Shame on me :) I'm mixed up in my own patches. I forgot that I separated them consciously for this purpose. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D105340/new/

[PATCH] D105340: [analyzer] Produce SymbolCast symbols for integral types in SValBuilder::evalCast

2022-01-12 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. In D105340#3232671 , @NoQ wrote: > This looks great with the option flag. Landing this patch will enable more > people to test the new mode and produce feedback on whether the constraint > solver keeps working well enough

[PATCH] D117035: [analyzer] Added more tests for scalars, enums and records for StrictAliasingChecker

2022-01-11 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov created this revision. ASDenysPetrov added reviewers: steakhal, xazax.hun, martong, NoQ. Herald added subscribers: manas, jeroen.dobbelaere, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware. ASDenysPetrov requested review of this

[PATCH] D117033: [analyzer] Added more tests for scalars and enums for StrictAliasingChecker

2022-01-11 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov created this revision. ASDenysPetrov added reviewers: NoQ, martong, steakhal, xazax.hun. ASDenysPetrov added a project: clang. Herald added subscribers: manas, jeroen.dobbelaere, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware.

[PATCH] D114718: [analyzer] Implement a new checker for Strict Aliasing Rule.

2022-01-11 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 398986. ASDenysPetrov added a comment. Improved the checker. Reworked tests. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D114718/new/ https://reviews.llvm.org/D114718 Files: clang/include/clang/StaticAnalyzer/Checkers/Checkers.td

[PATCH] D115932: [Analyzer] Create and handle SymbolCast for pointer to integral conversion

2022-01-10 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/SValBuilder.cpp:420 + auto FromTy = symRHS->getType(); + auto ToTy = RLocAsInt->getType(this->Context); + symRHS = this->getSymbolManager().getCastSymbol(symRHS, FromTy, ToTy);

[PATCH] D115932: [Analyzer] Create and handle SymbolCast for pointer to integral conversion

2022-01-10 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/SValBuilder.cpp:415-423 + // FIXME This should be done in getAsSymbol. But then getAsSymbol should be + // the member function of SValBuilder (?) + if (symRHS) +if (auto RLocAsInt =

[PATCH] D115932: [Analyzer] Create and handle SymbolCast for pointer to integral conversion

2022-01-10 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. Starting producing `SymbolCast` you should be careful. Please pay attention on my revision D105340 before doing this. I don't want you walk through the thing I fought. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST

[PATCH] D105340: [analyzer] Produce SymbolCast symbols for integral types in SValBuilder::evalCast

2021-12-21 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. Just a ping. I'd like to have this patch stack loaded somewhen :) CHANGES SINCE LAST ACTION https://reviews.llvm.org/D105340/new/ https://reviews.llvm.org/D105340 ___ cfe-commits mailing list

[PATCH] D114718: [analyzer] Implement a new checker for Strict Aliasing Rule.

2021-12-17 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @steakhal Thanks! I appreciate your comprehensive comment! I'll take everything you suggested into account. Comment at: clang/test/Analysis/Checkers/StrictAliasingChecker/strict-aliasing.cpp:2 +// RUN: %clang_cc1 -std=c++20 -analyze

[PATCH] D115883: [analyzer][NFC] Change return value of StoreManager::attemptDownCast function from SVal to Optional

2021-12-17 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov closed this revision. ASDenysPetrov added a comment. Closed with rGda8bd972a33ad642d6237b5b95b31a2a20f46a35 Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D115883: [analyzer][NFC] Change return value of StoreManager::attemptDownCast function from SVal to Optional

2021-12-17 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @xazax.hun Many thanks for the review. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D115883/new/ https://reviews.llvm.org/D115883 ___ cfe-commits mailing list

[PATCH] D115883: [analyzer][NFC] Change return value of StoreManager::attemptDownCast function from SVal to Optional

2021-12-16 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov created this revision. ASDenysPetrov added reviewers: xazax.hun, steakhal, NoQ, martong, baloghadamsoftware. ASDenysPetrov added a project: clang. Herald added subscribers: manas, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet. ASDenysPetrov requested

[PATCH] D115149: [analyzer][solver] Fix assertion on (NonLoc, Op, Loc) expressions

2021-12-15 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @martong Thanks for clarification. > TLDR, it is recommended to use the arcanist. I'm not able to use arcanist. It doesn't work on Windows (at least I've tryed several ways to set up it). BTW. I found a revision from which the

[PATCH] D115149: [analyzer][solver] Fix assertion on (NonLoc, Op, Loc) expressions

2021-12-14 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @martong wrote: > Denis, you can see in the `Revision Contents` that Diff 3 has the baseline > commit `63a6348`. When I check out `63a6348` then the newly added test file > triggers the assertion about `BO_Add`. Yes is see it: F21029827: image.png

[PATCH] D114718: [analyzer] Implement a new checker for Strict Aliasing Rule.

2021-12-14 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 394290. ASDenysPetrov added a comment. Changed handler `check::` functions. Reworked. Covered more cases. Several cases left (marked as FIXME in the test file). For the glance some of them we can't handle because of (possibly) wrong symbolic modeling.

[PATCH] D115149: [analyzer][solver] Fix assertion on (NonLoc, Op, Loc) expressions

2021-12-13 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. > @steakhal > I don't get this one. I've provided a bunch of tests, even annotated with > `no-crash` comments where we crashed prior to this change. I wasn't able to catch any crashes with your tests file //(symbol-simplification-nonloc-loc.cpp)// on the baseline

[PATCH] D99797: [analyzer] Implemented RangeSet::Factory::unite function to handle intersections and adjacency

2021-12-10 Thread Denys Petrov via Phabricator via cfe-commits
This revision was not accepted when it landed; it landed in state "Needs Review". This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG6a399bf4b3aa: [analyzer] Implemented RangeSet::Factory::unite

[PATCH] D99797: [analyzer] Implemented RangeSet::Factory::unite function to handle intersections and adjacency

2021-12-10 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 393509. ASDenysPetrov added a comment. Fixed code formatting in the unit test file according to remarks. Ready to load. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D99797/new/ https://reviews.llvm.org/D99797 Files:

[PATCH] D114718: [analyzer] Implement a new checker for Strict Aliasing Rule.

2021-12-09 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/StrictAliasingChecker.cpp:113 + QualType getOriginalType(CheckerContext , SVal V, QualType T) const { +assert(V.getAs() && "Location shall be a Loc."); +V =

[PATCH] D115149: [analyzer][solver] Fix assertion on (NonLoc, Op, Loc) expressions

2021-12-09 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/SValBuilder.cpp:463 + if (const Optional RV = rhs.getAs()) { +const auto IsCommutative = [](BinaryOperatorKind Op) { + return Op == BO_Mul || Op == BO_Add || Op == BO_And || Op == BO_Xor ||

[PATCH] D115149: [analyzer][solver] Fix assertion on (NonLoc, Op, Loc) expressions

2021-12-09 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @steakhal @NoQ wrote: > I'm confident that there's a way to get it right, simply because the program > under analysis is type-correct. If it's the simplifier, let's fix the > simplifier. I agree with your main thought. But I also believe there definitely are

[PATCH] D115149: [analyzer][solver] Fix assertion on (NonLoc, Op, Loc) expressions

2021-12-08 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. It seems like your test file passes even before your patch. I've just checked it. My last pull from the baseline was on Nov 15. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D115149/new/

[PATCH] D114718: [analyzer] Implement a new checker for Strict Aliasing Rule.

2021-12-08 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 392821. ASDenysPetrov added a comment. Improved dynamic type recognition. Provided `-fstrict-aliasing` compiler flag dependency. Still has issues with some cases (see it at the bottom of the test file). WIP. CHANGES SINCE LAST ACTION

[PATCH] D114006: [analyzer][NFC] Enable access to CodeGenOptions from analyzer's instances

2021-12-08 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 392666. ASDenysPetrov added a comment. Fixed unit test. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D114006/new/ https://reviews.llvm.org/D114006 Files: clang/include/clang/StaticAnalyzer/Core/CheckerManager.h

[PATCH] D114006: [analyzer][NFC] Enable access to CodeGenOptions from analyzer's instances

2021-12-07 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 392557. ASDenysPetrov edited the summary of this revision. ASDenysPetrov added a comment. Passed a `CodeGenOptions` reference to `CheckerManager` as well. (Adjusted to D114718 ) CHANGES SINCE LAST ACTION

[PATCH] D115149: [analyzer][solver] Fix assertion on (NonLoc, Op, Loc) expressions

2021-12-07 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/SValBuilder.cpp:463 + if (const Optional RV = rhs.getAs()) { +const auto IsCommutative = [](BinaryOperatorKind Op) { + return Op == BO_Mul || Op == BO_Add || Op == BO_And || Op == BO_Xor ||

[PATCH] D99797: [analyzer] Implemented RangeSet::Factory::unite function to handle intersections and adjacency

2021-12-03 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @martong > Nice, assiduous work! Many thanks for your time! Your work is not less assiduous! > (LHS, RHS) swaps it doesn't really matter, as the operation is comutative, but, yes, it does matter to depict the particular test case. I'll revise twise LHS-RHS's.

[PATCH] D114718: [analyzer] Implement a new checker for Strict Aliasing Rule.

2021-12-02 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @xazax.hun Updated the summary for better undersanding differencies between the Standards. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D114718/new/ https://reviews.llvm.org/D114718

[PATCH] D114718: [analyzer] Implement a new checker for Strict Aliasing Rule.

2021-11-30 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/StrictAliasingChecker.cpp:48-49 + // + // NOTE: User must provide canonical and unqualified QualType's for the + // correct result. + static bool canAccess(QualType From, QualType To,

[PATCH] D114718: [analyzer] Implement a new checker for Strict Aliasing Rule.

2021-11-29 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @rsmith, @aaron.ballman I kindly invite you to join the review process especially in a part of the Standard interpretation. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D114718/new/ https://reviews.llvm.org/D114718

[PATCH] D114718: [analyzer] Implement a new checker for Strict Aliasing Rule.

2021-11-29 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov created this revision. ASDenysPetrov added reviewers: rsmith, martong, NoQ, vsavchenko, steakhal, aaron.ballman, xazax.hun, Szelethus. ASDenysPetrov added a project: clang. Herald added subscribers: manas, jeroen.dobbelaere, dkrupp, donat.nagy, mikhail.ramalho, a.sidorin, rnkovacs,

[PATCH] D114441: [analyzer][NFC] Refactor AnalysisConsumer::getModeForDecl()

2021-11-29 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added inline comments. Comment at: clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp:599-603 + const SourceLocation Loc = [](Decl *D) -> SourceLocation { +const Stmt *Body = D->getBody(); +SourceLocation SL = Body ? Body->getBeginLoc() :

[PATCH] D110927: [analyzer] Access stored value of a constant array through a pointer to another type

2021-11-23 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov abandoned this revision. ASDenysPetrov added a comment. Temporary suspended this revision in favor of making a new checker //StrictAliasingChecker//, which would define an access to values through unpermited types as Unefined Behavior according to certain statements of the

[PATCH] D114006: [analyzer][NFC] Enable access to CodeGenOptions from analyzer's instances

2021-11-19 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. In D114006#3142313 , @martong wrote: > LGTM! Thanks, guys! I'll load it as soon as D110927 also be ready for load(I'm working on it), as this patch is just a preparatory one. CHANGES

[PATCH] D103096: [analyzer] Implement cast for ranges of symbolic integers

2021-11-19 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 388552. ASDenysPetrov added a comment. Rebased. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D103096/new/ https://reviews.llvm.org/D103096 Files: clang/include/clang/StaticAnalyzer/Checkers/SValExplainer.h

[PATCH] D103094: [analyzer] Implemented RangeSet::Factory::castTo function to perform promotions, truncations and conversions

2021-11-19 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 388512. ASDenysPetrov added a comment. Fixed missed part during rebasing in the unit test. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D103094/new/ https://reviews.llvm.org/D103094 Files:

  1   2   3   4   5   6   7   >