[PATCH] D106152: [analyzer] Remove test file as duplicated.

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

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

2021-07-16 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:1908-1912 +// Handle SymbolCast before actual assignment. +std::tie(Sym, NewConstraint) = +modifySymbolAndConstraints(Sym, NewConstraint); +if (!State) +

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

2021-07-16 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 359305. ASDenysPetrov added a comment. Adapted solution to ConstraintAssignor API. Added tests. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D103096/new/ https://reviews.llvm.org/D103096 Files:

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

2021-07-15 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:1908-1912 +// Handle SymbolCast before actual assignment. +std::tie(Sym, NewConstraint) = +modifySymbolAndConstraints(Sym, NewConstraint); +if (!State) +

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

2021-07-15 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 359007. ASDenysPetrov edited the summary of this revision. ASDenysPetrov added a comment. Improved `ignoreCasts` implementation. Adapted to `ConstraintAssignor`. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D103096/new/

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

2021-07-15 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @vsavchenko > It is already a pattern in other type hierarchies. I just rarely met them. And it was hard to me reading the code searching for implementation all over the places. Comment at:

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

2021-07-14 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added inline comments. Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h:293-296 +SymbolRef Sym = Operand; +while (isa(Sym)) + Sym = cast(Sym)->Operand; +return Sym; vsavchenko wrote: >

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

2021-07-14 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 358685. ASDenysPetrov added a comment. Made`ignoreCast` non-virtual . CHANGES SINCE LAST ACTION https://reviews.llvm.org/D103096/new/ https://reviews.llvm.org/D103096 Files: clang/include/clang/StaticAnalyzer/Checkers/SValExplainer.h

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

2021-07-14 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 358669. 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-07-14 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 358661. ASDenysPetrov added a comment. Rebased CHANGES SINCE LAST ACTION https://reviews.llvm.org/D103094/new/ https://reviews.llvm.org/D103094 Files: clang/include/clang/StaticAnalyzer/Core/PathSensitive/APSIntType.h

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

2021-07-14 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added inline comments. Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h:293-296 +SymbolRef Sym = Operand; +while (isa(Sym)) + Sym = cast(Sym)->Operand; +return Sym; vsavchenko wrote: >

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

2021-07-14 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 358656. ASDenysPetrov added a comment. Rebased CHANGES SINCE LAST ACTION https://reviews.llvm.org/D99797/new/ https://reviews.llvm.org/D99797 Files: clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h

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

2021-07-13 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:1203 +if (!Opts.ShouldSupportSymbolicIntegerCasts) + return VisitSymExpr(Sym); + vsavchenko wrote: > ASDenysPetrov wrote: > > vsavchenko wrote: > >

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

2021-07-13 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added inline comments. Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h:293-296 +SymbolRef Sym = Operand; +while (isa(Sym)) + Sym = cast(Sym)->Operand; +return Sym; vsavchenko wrote: >

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

2021-07-13 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added inline comments. Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h:293-296 +SymbolRef Sym = Operand; +while (isa(Sym)) + Sym = cast(Sym)->Operand; +return Sym; vsavchenko wrote: > Do you

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

2021-07-13 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:1203 +if (!Opts.ShouldSupportSymbolicIntegerCasts) + return VisitSymExpr(Sym); + vsavchenko wrote: > Why do you use `VisitSymExpr` here? You want

[PATCH] D104381: [analyzer] Added a test case for PR46264

2021-07-12 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @NoQ Just a ping Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D104381/new/ https://reviews.llvm.org/D104381 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

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

2021-07-12 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @vsavchenko I've updated the summary. I hope, I addressed your question. Currently, this patch has some issues and may not fully reflect the summary. I'll update it soon(not without your suggestions). Thanks. CHANGES SINCE LAST ACTION

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

2021-07-09 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:1241 + // Find the first constraint and exit the loop. + RSPtr = getConstraint(State, S); +} vsavchenko wrote: > Why do you get associated

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

2021-07-09 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @vsavchenko > Why did you write it this way!? I want the map contains only valid constraints at any time, so we can easely get them without traversing with all variants intersecting with each other. I'm gonna move `updateExistingConstraints ` logic to

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

2021-07-09 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @vsavchenko > I still want to hear a good explanation why is it done this way. Here `c` is > mapped to `(char)x`, and we have `[-10, 10]` directly associated with it, but > we also have `(short)x` associated with `[8, 8]`. Why can't > `VisitSymbolCast` look up

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

2021-07-09 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. Generally, with this patch we kinda have several constraints for each cast of a single symbol. And we shall care for all of that constraints and timely update them (if possible). For instance, we have `int x` and met casts of this symbol in code: int x;

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

2021-07-09 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. In D103096#2866730 , @vsavchenko wrote: > In D103096#2866704 , @ASDenysPetrov > wrote: > >> @vsavchenko > > That's not the question I'm asking. Why do you need to set constraints

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

2021-07-09 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @vsavchenko Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:2797-2799 +ProgramStateRef +RangeConstraintManager::updateExistingConstraints(ProgramStateRef State, + SymbolRef

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

2021-07-09 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 357463. ASDenysPetrov added a comment. Added more descriptive comments. Fixed `RangeConstraintManager::updateExistingConstraints` function. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D103096/new/ https://reviews.llvm.org/D103096 Files:

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

2021-07-08 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 357240. ASDenysPetrov added a comment. Added `SymExpr::ignoreCasts` method. Added descriptive comments. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D103096/new/ https://reviews.llvm.org/D103096 Files:

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

2021-07-06 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:2801-2802 + // Get a root symbol in case of SymbolCast. + while (isa(Sym)) +Sym = cast(Sym)->getOperand(); + vsavchenko wrote: > ASDenysPetrov wrote:

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

2021-07-06 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. I found some issues. Working on improvement. Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:2797-2799 +ProgramStateRef +RangeConstraintManager::updateExistingConstraints(ProgramStateRef State, +

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

2021-07-06 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 356668. ASDenysPetrov added a comment. Splitted this revision and moved `SValBuilder` related changes to separate patch D105340 . Added detailed comments. Made `NominalTypeList` //static// and as a result removed the

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

2021-07-02 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. In D105340#2855387 , @vsavchenko wrote: > Also, although the test is very extensive, it is pretty lopsided at the same > time. C-style cast is only one case out of the myriad of all explicit and, > more importantly,

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

2021-07-02 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added inline comments. Comment at: clang/test/Analysis/produce-symbolcast.cpp:1 +// RUN: %clang_analyze_cc1 -analyzer-checker=debug.ExprInspection -analyzer-config handle-integral-cast-for-ranges=true -verify %s + steakhal wrote: > vsavchenko

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

2021-07-02 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. I will update the patch soon according to your suggestions. Comment at: clang/test/Analysis/bool-assignment.c:46-50 #ifdef ANALYZER_CM_Z3 BOOL x = y; // expected-warning {{Assignment of a non-Boolean value}} #else -BOOL x = y; //

[PATCH] D104381: [analyzer] Added a test case for PR46264

2021-07-01 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. In D104381#2838902 , @NoQ wrote: > I bisected. This bug was fixed intentionally by D85817 > , forgot to close I guess. Wow! Nice! It seems that we've duplicated the test file. I think we

[PATCH] D104285: [analyzer] Retrieve value by direct index from list initialization of constant array declaration.

2021-06-29 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @chrish_ericsson_atx Thanks for the new test case. I'll handle it ASAP. > To be clear, neither this new reproducer nor the one I originally posted fail > if commit b30521c28a4d > is >

[PATCH] D104550: [analyzer] Implement getType for SVal

2021-06-25 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/SVals.cpp:154 + Optional VisitLocGotoLabel(loc::GotoLabel GL) { +return QualType{Context.VoidPtrTy}; + } NoQ wrote: > ASDenysPetrov wrote: > > vsavchenko wrote: > > >

[PATCH] D104550: [analyzer] Implement getType for SVal

2021-06-24 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. > I'm not sure what you mean here. If it is about this particular patch, it > simply adds a non-virtual method to SVal, it shouldn't affect sizeof(SVal) at > all. My fault. For some reason I thought you added a QualType as a member to SVal declaration. > I

[PATCH] D104285: [analyzer] Retrieve value by direct index from list initialization of constant array declaration.

2021-06-24 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @chrish_ericsson_atx > I don't understand -- probably I don't have enough experience with analyzer > state dumps to know what I should find surprising or better in this example. Simply saying, now `ptr[3]` returns value `4` as expected, but `arr[1][1]` still

[PATCH] D104550: [analyzer] Implement getType for SVal

2021-06-24 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. I'm in favor of this patch. It will help simplify `SValBuilder::evalCast`, which takes an optional parameter `OriginalTy` and acts differently based on whether it has been passed or has not. Since `sizeof(SVal)` became bigger (x1.5). I'm wondering of how much

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

2021-06-24 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 354225. ASDenysPetrov added a comment. Added assertions. Added two helper functions for `castTo` method. Moved some distinct code to them. Fixed clang-tidy complaints. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D103094/new/

[PATCH] D104381: [analyzer] Added a test case for PR46264

2021-06-24 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 rGe76c008c906a: [analyzer] Added a test case for PR46264 (authored by ASDenysPetrov). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST

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

2021-06-23 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. I'll update tommorow. Comment at: clang/unittests/StaticAnalyzer/RangeSetTest.cpp:120 + + template const llvm::APSInt (T X) { +static llvm::APSInt Int = APSIntTy.getZeroValue(); vsavchenko wrote: > Default to `BaseType`?

[PATCH] D104285: [analyzer] Retrieve value by direct index from list initialization of constant array declaration.

2021-06-23 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @chrish_ericsson_atx Sorry for the late reply. Thank you for reveiwing this. > I think the presence of the initializer list in the test case is not > necessary to trigger the spurious warnings Could you please provide some test cases that you think will uncover

[PATCH] D104381: [analyzer] Added a test case for PR46264

2021-06-23 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 353992. ASDenysPetrov added a comment. Updated due to comments. Confirm crash on commit `3ed8ebc2f6b8172bed48cc5986d3b7af4cfca1bc` from 24.05.2020. @NoQ ? CHANGES SINCE LAST ACTION https://reviews.llvm.org/D104381/new/

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

2021-06-23 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 353954. ASDenysPetrov added a comment. Made changes according to comments. Optimized `castTo` function for each cast case. Simplified unit test. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D103094/new/ https://reviews.llvm.org/D103094

[PATCH] D104381: [analyzer] Added a test case for PR46264

2021-06-17 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @NoQ: > I guess there might be some value in building an older Clang from around when > the bug was reported so that to see if the crash was indeed there and we're > not just reproducing it wrong. It would also allow us to understand where we > fixed it through

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

2021-06-17 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 352851. ASDenysPetrov added a comment. Updated. Removed `F` as flag. Replaced `goto` with closure. Detailed comments and fixed typos. @vsavchenko made changes according your suggestions. CHANGES SINCE LAST ACTION

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

2021-06-17 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added inline comments. Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h:245-246 +/// +/// Complexity: O(N^2) +/// where N = size(What) +RangeSet castTo(RangeSet What, APSIntType Ty);

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

2021-06-17 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @vsavchenko Repled in inlines. Preparing an update. Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h:245-246 +/// +/// Complexity: O(N^2) +/// where N = size(What) +RangeSet

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

2021-06-16 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. In D103096#2821750 , @vsavchenko wrote: > Hey, great work! I think that casts are extremely important, but it looks > like you mixed so many things into this patch. Let's make one step at a time > a split it into (at

[PATCH] D104381: [analyzer] Added a test case for PR46264

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

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

2021-06-16 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. What about this patch? CHANGES SINCE LAST ACTION https://reviews.llvm.org/D103096/new/ https://reviews.llvm.org/D103096 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D104285: [analyzer] Retrieve value by direct index from list initialization of constant array declaration.

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

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

2021-06-08 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 350579. ASDenysPetrov added a comment. Added a boolean option `handle-integral-cast-for-ranges` under `-analyzer-config` flag. Disabled the feature by default. @Noq, @steakhal How do you think whether it's neccesory to add any changes in

[PATCH] D103803: [analyzer] [NFC] Implement a wrapper SValBuilder::getCastedMemRegionVal for similar functionality on region cast

2021-06-08 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 rGd3a6181e82ca: [analyzer] [NFC] Implement a wrapper SValBuilder::getCastedMemRegionVal for… (authored by ASDenysPetrov). Repository: rG LLVM

[PATCH] D103317: [Analyzer][engine][solver] Simplify complex constraints

2021-06-07 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @vsavchenko I appologize for my immaturity and for the audacity of my infantile assumptions. I admit any constructive criticism. Thank you for referencing the theory. I will thoroughly study the domain in all. As for the **assignments** and why I brought them

[PATCH] D103803: [analyzer] [NFC] Implement a wrapper SValBuilder::getCastedMemRegionVal for similar functionality on region cast

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

[PATCH] D103317: [Analyzer][engine][solver] Simplify complex constraints

2021-06-02 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. > ! In D103317#2793797 , @vsavchenko > wrote: > I replied to you earlier that assignments are not producing constraints. The > analyzer has some sort of SSA (not really, but anyways), so every time we > reassign the

[PATCH] D103317: [Analyzer][engine][solver] Simplify complex constraints

2021-06-02 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. In D103317#2793797 , @vsavchenko wrote: > Hmm, Okay, but what about situations if you have: `a = a1 + a2` and `a = a3 + > a4 + a5` are you going to throw away one of these constraints? And if so, how > do you want to

[PATCH] D103317: [Analyzer][engine][solver] Simplify complex constraints

2021-06-02 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. In D103317#2793658 , @vsavchenko wrote: > But the problem it is generally not one-to-one relationship, so `x -> y1 + > 1`, `x -> y2 + 2`, ... , `x -> yN + N`. In my approach it can't be more then one binding for one

[PATCH] D103317: [Analyzer][engine][solver] Simplify complex constraints

2021-06-02 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. Returning to the discussion raised in D102696 , I'd like to share my vision. I think we can use much easier approach to use valid constraints at any point of time. The main idea is lazy-reasoning of the ranges. This approach: -

[PATCH] D103317: [Analyzer][engine][solver] Simplify complex constraints

2021-06-02 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp:1155-1156 -// TODO: Support SymbolCast. Support IntSymExpr when/if we actually -// start producing them. ASDenysPetrov wrote: > vsavchenko wrote: > >

[PATCH] D103317: [Analyzer][engine][solver] Simplify complex constraints

2021-06-02 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp:1155-1156 -// TODO: Support SymbolCast. Support IntSymExpr when/if we actually -// start producing them. vsavchenko wrote: > ASDenysPetrov wrote: > >

[PATCH] D103317: [Analyzer][engine][solver] Simplify complex constraints

2021-06-02 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp:1155-1156 -// TODO: Support SymbolCast. Support IntSymExpr when/if we actually -// start producing them. vsavchenko wrote: > Do we actually produce

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

2021-05-31 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @NoQ This solution only intends to make correct calculations whenever cast occures. We can mark this as //alpha// or add an argument flag to turn cast reasoning on/off, or we can even disable any part of this patch with argument settings. > But this still

[PATCH] D103319: [analyzer] Use Optional as a return type of StoreManager::castRegion

2021-05-29 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @NoQ > I guess another option is to put `loc::MemRegionVal()` inside `castRegion()`. > This way the return type `Optional` unambigously tells > that the region is always non-null if present (protected by the assertion in > the constructor of

[PATCH] D103319: [analyzer] Use Optional as a return type of StoreManager::castRegion

2021-05-29 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 rGfae3534b3056: [analyzer] Use Optional as a return type of StoreManager::castRegion (authored by ASDenysPetrov). Repository: rG LLVM Github

[PATCH] D103319: [analyzer] Use Optional as a return type of StoreManager::castRegion

2021-05-28 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 348554. ASDenysPetrov added a comment. Fixed syntax complains which caused a test fail. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D103319/new/ https://reviews.llvm.org/D103319 Files:

[PATCH] D103319: [analyzer] Use Optional as a return type of StoreManager::castRegion

2021-05-28 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 348524. ASDenysPetrov added a comment. Added a simplified test case. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D103319/new/ https://reviews.llvm.org/D103319 Files: clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h

[PATCH] D101635: [analyzer] Fix assertion in SVals.h

2021-05-28 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. Herald added a subscriber: manas. @steakhal, @NoQ Thanks for your replies. I've made a patch according your suggestions D103319 . Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D103319: [analyzer] Use Optional as a return type of StoreManager::castRegion

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

[PATCH] D92639: [analyzer] Add control flow arrows to the analyzer's HTML reports

2021-05-28 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. OK, then. Let's land it! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D92639/new/ https://reviews.llvm.org/D92639

[PATCH] D92639: [analyzer] Add control flow arrows to the analyzer's HTML reports

2021-05-27 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. Herald added a subscriber: manas. @vsavchenko How about this? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D92639/new/ https://reviews.llvm.org/D92639 ___ cfe-commits

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

2021-05-27 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 348294. ASDenysPetrov added a comment. Fixed the issue. Added more unit tests. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D99797/new/ https://reviews.llvm.org/D99797 Files:

[PATCH] D97388: [analyzer] Replace StoreManager::evalIntegralCast with SValBuilder::evalCast

2021-05-27 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov abandoned this revision. ASDenysPetrov added a comment. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D97388/new/ https://reviews.llvm.org/D97388 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D97388: [analyzer] Replace StoreManager::evalIntegralCast with SValBuilder::evalCast

2021-05-27 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 348286. ASDenysPetrov added a comment. Mistakenly erased with another patch. Restored. But anyway this revision should be //abandoned //as irrelevant any more. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D97388/new/

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

2021-05-27 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 348284. ASDenysPetrov added a comment. @vsavchenko Reworked the algorithm. I hope this is the final version. Honestly, I also have the most optimized version but it has twice more similar(but different) code and gotos. I decided not to present it.

[PATCH] D97388: [analyzer] Replace StoreManager::evalIntegralCast with SValBuilder::evalCast

2021-05-27 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 348283. ASDenysPetrov added a comment. Herald added a subscriber: manas. @vsavchenko Reworked the algorithm. I hope this is the final version. Honestly, I also have the most optimized version but it has twice more similar(but different) code and

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

2021-05-26 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:257 + // BoundCounter is 0 for outer `)`. + // BoundCounter is 1 for outer '(' or inner `)`. + // BoundCounter is 2 for inner `(`. vsavchenko wrote: >

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

2021-05-26 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @vsavchenko Thanks for your suggestions! I really appreciate it! I'll do my best on this algorithm. Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:257 + // BoundCounter is 0 for outer `)`. + // BoundCounter is 1 for outer

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

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

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

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

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

2021-05-25 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 347662. ASDenysPetrov added a comment. More minor improvements in unit tests. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D99797/new/ https://reviews.llvm.org/D99797 Files:

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

2021-05-25 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 347658. ASDenysPetrov added a comment. Minor improvements in unit tests. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D99797/new/ https://reviews.llvm.org/D99797 Files:

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

2021-05-21 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 346741. ASDenysPetrov added a comment. Herald added a subscriber: manas. Reworked the solution. Returned to Implemented two versions of the same algorithm. Most optimized (but more verbose) and generalized one (but less optimized). Added a bit more

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

2021-05-12 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @vsavchenko Thanka for the suggestions! I'll take them into account and update the patch. Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h:250 +/// guarantee this. +ContainerType unite(const

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

2021-05-11 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 34. ASDenysPetrov added a comment. Minor performance improvement. Add more comments. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D99797/new/ https://reviews.llvm.org/D99797 Files:

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

2021-05-07 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 343750. ASDenysPetrov added a comment. Minor comment fix. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D99797/new/ https://reviews.llvm.org/D99797 Files: clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h

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

2021-05-07 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:136 + +RangeSet RangeSet::Factory::unite(RangeSet LHS, RangeSet RHS) { + if (LHS.isEmpty()) vsavchenko wrote: > I'd prefer `merge` There are common namings

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

2021-05-07 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 343714. ASDenysPetrov added a comment. Updated the patch due to comments. Added more tests. Simplified and improved solution. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D99797/new/ https://reviews.llvm.org/D99797 Files:

[PATCH] D89055: [analyzer] Wrong type cast occures during pointer dereferencing after type punning

2021-04-30 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/SValBuilder.cpp:765 +R = StateMgr.getStoreManager().castRegion(ER, CastTy); +return loc::MemRegionVal(R); + } bjope wrote: > This caused some problems with

[PATCH] D101635: [analyzer] Fix assertion in SVals.h

2021-04-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. @vabridgers Thank you for a good catch! The fix looks fairly reasonable for me! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D89055: [analyzer] Wrong type cast occures during pointer dereferencing after type punning

2021-04-28 Thread Denys Petrov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGb30521c28a4d: [analyzer] Wrong type cast occurs during pointer dereferencing after type… (authored by ASDenysPetrov). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D92639: [analyzer] Add control flow arrows to the analyzer's HTML reports

2021-04-26 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. In D92639#2717134 , @vsavchenko wrote: > In D92639#2716973 , @ASDenysPetrov > wrote: > >> @vsavchenko >> I make some tests and fixes. Please, consider. > > OMG, that's so awesome!

[PATCH] D89055: [analyzer] Wrong type cast occures during pointer dereferencing after type punning

2021-04-26 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @NoQ, @steakhal, @vsavchenko I think we have met all the conditions with previous patchs to make this patch acceptable. If you think it's OK, could you, please, approve it? CHANGES SINCE LAST ACTION https://reviews.llvm.org/D89055/new/

[PATCH] D92639: [analyzer] Add control flow arrows to the analyzer's HTML reports

2021-04-26 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @vsavchenko I make some tests and fixes. Please, consider. Comment at: clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp:458 } if (event.key == "S") { var checked = document.getElementsByName("showCounterexample")[0].checked;

[PATCH] D97296: [analyzer] [NFC] Add a new parameter ProgramStateRef to SValBuilder::evalCast function

2021-04-13 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. This is the only revision in the stack which was bypass your attention. It's fairly harmless although a big one. Please, look at it. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D97296/new/ https://reviews.llvm.org/D97296

[PATCH] D97277: [analyzer] [NFC] Eliminate dispatchCast, evalCastFromNonLoc and evalCastFromLoc functions from SValBuilder

2021-04-13 Thread Denys Petrov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG01ddfa95bd14: [analyzer] [NFC] Eliminate dispatchCast, evalCastFromNonLoc and evalCastFromLoc… (authored by ASDenysPetrov). Changed prior to commit: https://reviews.llvm.org/D97277?vs=328106=337177#toc

[PATCH] D96090: [analyzer] Replace StoreManager::CastRetrievedVal with SValBuilder::evalCast

2021-04-13 Thread Denys Petrov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG7736b08c2872: [analyzer] Replace StoreManager::CastRetrievedVal with SValBuilder::evalCast (authored by ASDenysPetrov). Changed prior to commit: https://reviews.llvm.org/D96090?vs=329982=337153#toc

[PATCH] D96090: [analyzer] Replace StoreManager::CastRetrievedVal with SValBuilder::evalCast

2021-04-13 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. > Already approved a month ago D97277 :-) > That's the next step. In addition to the above: Comment at: clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp:68 +// FIXME: This function should be eliminated and

[PATCH] D90157: [analyzer] Rework SValBuilder::evalCast function into maintainable and clear way

2021-04-13 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @NoQ > Even though NFC commits don't require tests, this doesn't mean they shouldn't > add them! While developing this, I wasn't able to reproduce any regression or unpassed cases on the projects from CodeChecker list (//Bitcoin_v0.20.1, Curl_curl-7_66_0,

<    1   2   3   4   5   6   7   >