[PATCH] D85984: [analyzer] Add a new checker alpha.cplusplus.CPlusPlus11Lock

2020-09-08 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @steakhal > the readability of the reports should be improved. Absolutely agree. Let's do this in the next patches :) @NoQ You've recommended to extend PthreadLockChecker with STL mutexes. I think I've done. Could you make a quick look, please? ==

[PATCH] D87138: [analyzer][NFC] Introduce refactoring of PthreadLockChecker

2020-09-08 Thread Denys Petrov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGe67405141836: [analyzer] [NFC] Introduce refactoring of PthreadLockChecker (authored by ASDenysPetrov). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D87138/n

[PATCH] D77062: [analyzer] Improve zero assumption in CStringChecke::assumeZero

2020-09-09 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. One more notification. Please, somebody look at this patch. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D77062/new/ https://reviews.llvm.org/D77062 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https:

[PATCH] D86465: [analyzer][solver] Redesign constraint ranges data structure

2020-09-10 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. Here is my five cents. I haven't done with the review yet. I'm gonna return to it a bit later. Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h:56 + bool operator==(const Range &RHS) const { return Imp

[PATCH] D85984: [analyzer] Add a new checker alpha.cplusplus.CPlusPlus11Lock

2020-12-11 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. A gentle ping :-) CHANGES SINCE LAST ACTION https://reviews.llvm.org/D85984/new/ https://reviews.llvm.org/D85984 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/

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

2020-12-11 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @steakhal Thank you for your invaluable analysis! > What do you think @ASDenysPetrov ? I think if there is any difference then I have to inspect the changes deeper. I tryed to make this changes in a way of not changing any behaviour. Let me back to this patch a bi

[PATCH] D87146: [analyzer] Implement shared semantics checks for XNU functions in PthreadLockChecker

2020-12-16 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. Hey, folk. Please, look at this revision. This is the **2nd** revision from the //stack of 3//. Its aim is preparing the field for the **3rd** revision (also welcome to review). The **1st** one has been closed. CHANGES SINCE LAST ACTION https://reviews.llvm.org

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

2020-12-21 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 313114. ASDenysPetrov added a comment. @steakhal I've precisely inspected your reports and find the bug. I've fixed it. I also verified all the rest and find some other vulnerabilities and fixed them as well. Thank you for your testing, and I would as

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

2020-12-22 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. Thank to @steakhal for the new tests. //All// previous result differences have **gone** in `FFMPEG` and `twin` but a new //one// **appeared** in `PostgreSQL`. /src/common/d2s.c Line 895 Memory copy function overflows the destination buffer alpha.unix.cstring.Ou

[PATCH] D77062: [analyzer] Improve zero assumption in CStringChecke::assumeZero

2020-10-01 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @steakhal > @ASDenysPetrov Do you still want to rework the API of the `assumeZero`? This patch more looks like NFC, being just refactored. Actually I see that if we find and fix the root cause, we can freely refuse this patch. Another thing I see is that this patc

[PATCH] D77062: [analyzer] Improve zero assumption in CStringChecke::assumeZero

2020-10-02 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @steakhal > Till then, I recommend you to follow my effort at D88477 > . I'm aleady on this way. I'm debugging the Store. I think we load a wrong type because we store a wrong type. CHANGES SINCE LAST ACTION https://reviews.ll

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

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

[PATCH] D88477: [analyzer] Overwrite cast type in getBinding only if that was null originally

2020-10-08 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @NoQ @steakhal Hi, guys. I've just uploaded a patch for solving this and related D77062 . Welcome to review D89055 . Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://rev

[PATCH] D87547: [MinGW][clang-shlib] Build by default on MinGW

2020-10-09 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. Hi, @mati865 Currently I got an error while building with GCC10 on Win10. [2325/2656] Linking CXX shared library bin\libclang-cpp.dll FAILED: bin/libclang-cpp.dll lib/libclang

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

2020-10-09 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @NoQ > Can we collapse this function further towards this goal? Say, why not pump > every region //unconditionally// through `castRegion()`? Does > `dispatchCast()` use `castRegion()` internally - and if it does, why are > there so many branches in this function?

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

2020-10-09 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @NoQ BTW, what you think we should do with D77062 and D88477 then? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D89055/new/ https://reviews.llvm.or

[PATCH] D87547: [MinGW][clang-shlib] Build by default on MinGW

2020-10-09 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. In D87547#2322325 , @mati865 wrote: > @ASDenysPetrov what CMake options do you use? > I'm unable to reproduce this error with Clang+LLD and GCC+Binutils from MSYS2. Sorry for not mentioning that. This is my cmd: cmake -GN

[PATCH] D89225: [MinGW][clang-shlib] Build only when LLVM_LINK_LLVM_DYLIB is enabled

2020-10-12 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. It works for me. Well done! I've applied your patch and tried this: cmake -GNinja ../llvm -DLLVM_LIT_ARGS=-sv -DLLVM_LINK_LLVM_DYLIB=ON -DLLVM_ENABLE_PROJECTS=clang -DLLVM_TAR

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

2020-10-12 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 297579. ASDenysPetrov added a comment. Updat patch due to suggestions and fixed formating. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D89055/new/ https://reviews.llvm.org/D89055 Files: clang/lib/StaticAnalyzer/Core/Store.cpp clang/test/

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

2020-10-13 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 297822. ASDenysPetrov added a comment. Updated. Removed a new test file, moved the test to an existing file instead. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D89055/new/ https://reviews.llvm.org/D89055 Files: clang/lib/StaticAnalyzer/Co

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

2020-10-13 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @NoQ > Can we collapse this function further towards this goal? Say, why not pump > every region unconditionally through castRegion()? Does dispatchCast() use > castRegion() internally - and if it does, why are there so many branches in > this function? I've mad

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

2020-10-15 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 298388. ASDenysPetrov added a comment. Updated. Moved `castRegion()` to `SValBuilder`. Actually it wasn't so hard as I thought :) CHANGES SINCE LAST ACTION https://reviews.llvm.org/D89055/new/ https://reviews.llvm.org/D89055 Files: clang/include

[PATCH] D87146: [analyzer] Implement shared semantics checks for XNU functions in PthreadLockChecker

2020-12-01 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. Just a ping. Let me, please, do smth with this revision. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D87146/new/ https://reviews.llvm.org/D87146 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://l

[PATCH] D85984: [analyzer] Add a new checker alpha.cplusplus.CPlusPlus11Lock

2020-12-01 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 308781. ASDenysPetrov added a comment. @NoQ , considered your suggestions about the case of recursive mutexes. Implemented this feature. Now this works like below: recursive_mutex rm; rm.lock(); rm.lock(); // no-warning recursive_timed_mutex rt

[PATCH] D89987: [analyzer] [NFC] Rename SymbolRef to SymExprRef

2020-12-02 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @steakhal > Losing **git blame** would have a signifficant impact in deed, however we > always have the option to add the renaming commit to the > `.git-blame-ignore-revs`. Using this git feature I can see no more obstacles to implement the renaming. Moreover LL

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

2020-10-17 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @NoQ > The new code should obviously be restricted into evalCastFromLoc() because if > it's a region it's a Loc. The first I tryed was `evalCastFromLoc()`, but it turned out that `SVal` which binds to a pointer can be `NonLoc` as well through violation of pointin

[PATCH] D77062: [analyzer] [NFC] Simplify CStringChecke::assumeZero function

2020-10-19 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 299018. ASDenysPetrov retitled this revision from "[analyzer] Improve zero assumption in CStringChecke::assumeZero" to "[analyzer] [NFC] Simplify CStringChecke::assumeZero function". ASDenysPetrov edited the summary of this revision. ASDenysPetrov added

[PATCH] D89982: [analyzer] [NFC] Simplify SVal::getAsLocSymbol function using existing functions

2020-10-22 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov created this revision. ASDenysPetrov added reviewers: krememek, vsavchenko, NoQ, martong, steakhal. ASDenysPetrov added a project: clang. Herald added subscribers: cfe-commits, Charusso, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware,

[PATCH] D89987: [analyzer] [NFC] Rename SymbolRef to SymExprRef

2020-10-23 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @OikawaKirie > Different from ProgramStateRef which is an alias to IntrusiveRefCntPtr, or > StoreRef which is a wrapper object, an alias to a const SymExpr * makes no > sense to me. Yes. I omit this, because in such case we should go further and rename all those

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

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

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

2020-10-26 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. In D89055#2336709 , @NoQ wrote: > Ugh, sorry, no, that's `evalCast()`. Like `evalBinOp()` etc. My bad. Can we > also use `evalCast()`? I dived into `evalCast()`. Initially I had to figure it out and rework it to find the r

[PATCH] D89982: [analyzer] [NFC] Simplify SVal::getAsLocSymbol function using existing functions

2020-10-26 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 rG32efb81ea60a: [analyzer] [NFC] Simplify SVal::getAsLocSymbol function using existing functions (authored by ASDenysPetrov). Repository: rG LLVM Gi

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

2020-10-29 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. Who can confirm if this is correct or somewhere it needs fixes? Here is a generated result of `evalCast` from the origin branch(before the patch): void foo(int* x, // &SymRegion{reg_$0} int** y, // &SymRegion{reg_$0} int***z) // &SymRegion{

[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 Con

[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 tes

[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: clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraint

[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: clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConst

[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 r

[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. ASD

[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] 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: > ASD

[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 `goto

[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. Let

[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/ https://reviews.llvm.org/

[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 https://lists.llvm.org/cgi

[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: clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedCons

[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 maili

[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] 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 thi

[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 https://reviews.llvm.org/D101635

[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 clang/lib

[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: clang/include/clang/StaticAnalyzer/Core/PathSensitive/

[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 Monore

[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 `loc::MemRegionVal`).

[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 requires

[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 th

[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. 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 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 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 symbo

[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 sele

[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] D90157: [analyzer] Rework SValBuilder::evalCast function into maintainable and clear way

2021-01-25 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @steakhal > Why don't you use the `SValVisitor` instead? I simply didn't know of its exsistence. We can try to transform this patch using `SValVisitor` in the next revision to make the review easier and avoid additional complexity. Comment at:

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

2021-01-25 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 318991. ASDenysPetrov added a comment. Updated. Naming fixes. Member access changes. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D90157/new/ https://reviews.llvm.org/D90157 Files: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SValB

[PATCH] D86295: [analyzer] Reorder the layout of MemRegion and cache by hand for optimal size

2021-01-25 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. What about this change? Did you make more measurements? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D86295/new/ https://reviews.llvm.org/D86295 ___ cfe-commits mailing lis

[PATCH] D87146: [analyzer] Implement shared semantics checks for XNU functions in PthreadLockChecker

2021-01-25 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. Just want to load this revision in scope of the stack. I need you review for this. Thanks. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D87146/new/ https://reviews.llvm.org/D87146 ___ cfe-commits mailing list c

[PATCH] D95799: [analyzer] Symbolicate float values with integral casting

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

[PATCH] D95799: [analyzer] Symbolicate float values with integral casting

2021-02-04 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. Herald added a subscriber: nullptr.cpp. Hi, folk! Please, review this tiny patch. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D95799/new/ https://reviews.llvm.org/D95799 _

[PATCH] D95799: [analyzer] Symbolicate float values with integral casting

2021-02-04 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 321585. ASDenysPetrov added a comment. Updated. Moved comments as well. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D95799/new/ https://reviews.llvm.org/D95799 Files: clang/lib/StaticAnalyzer/Core/SValBuilder.cpp clang/lib/StaticAnalyzer

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

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

[PATCH] D92928: [analyzer] Highlight arrows for currently selected event

2021-02-04 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. Herald added a subscriber: nullptr.cpp. HTML sample looks fine! But there is the same problem as in D92639 . IE doesn't draw arrows. Comment at: clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp:166 + ArrowMap(un

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

2021-02-05 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @NoQ > Ugh, sorry, no, that's `evalCast()`. Like `evalBinOp()` etc. My bad. Can we > also use `evalCast()`? Finally :-) Now we can use `evalCast()` instead of `CastRetrievedVal()`. It would be nice if you could look at D96090 . I

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

2021-02-05 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 321693. ASDenysPetrov added a comment. Updated. Rolled the fix over the evalCast refactoring. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D89055/new/ https://reviews.llvm.org/D89055 Files: clang/lib/StaticAnalyzer/Core/SValBuilder.cpp cl

[PATCH] D95877: [analyzer] Fix static_cast on pointer-to-member handling

2021-02-05 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. I downloaded and tested this patch. On the whole it works OK. See my suggestions below. Comment at: clang/lib/StaticAnalyzer/Core/BasicValueFactory.cpp:205 + llvm::SmallPtrSet BaseSpecSeen; + for (const auto &BaseSpec : BaseSpecList) { +aut

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

2021-02-05 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. In D96090#2544477 , @steakhal wrote: > Please, consider removing D95799 from the > parent revisions if that is not a hard requirement of this patch. Actually D95799

[PATCH] D104285: [analyzer] Retrieve a value from list initialization of constant array declaration in a global scope.

2021-09-20 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/RegionStore.cpp:1692-1694 +const bool IsOneDimensionalArray = +!isa(CAT->getElementType()); +if (IsOneDimensionalArray) { martong wrote: > aaron

[PATCH] D104285: [analyzer] Retrieve a value from list initialization of constant array declaration in a global scope.

2021-09-21 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/RegionStore.cpp:1696 + const llvm::APSInt &Idx = CI->getValue(); + const uint64_t I = static_cast(Idx.getExtValue()); + // Use `getZExtValue` because array extent

[PATCH] D104285: [analyzer] Retrieve a value from list initialization of constant array declaration in a global scope.

2021-09-21 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/RegionStore.cpp:1692-1694 +const bool IsOneDimensionalArray = +!isa(CAT->getElementType()); +if (IsOneDimensionalArray) { aaron.ballman wrote: >

[PATCH] D104285: [analyzer] Retrieve a value from list initialization of constant array declaration in a global scope.

2021-09-21 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 373895. ASDenysPetrov added a comment. Fixed nits. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D104285/new/ https://reviews.llvm.org/D104285 Files: clang/lib/StaticAnalyzer/Core/RegionStore.cpp clang/test/Analysis/initialization.c clan

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

2021-09-21 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 373908. ASDenysPetrov added a comment. Rebased. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D107339/new/ https://reviews.llvm.org/D107339 Files: clang/lib/StaticAnalyzer/Core/RegionStore.cpp clang/test/Analysis/initialization.cpp Index:

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

2021-09-21 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 373964. ASDenysPetrov edited the summary of this revision. ASDenysPetrov added a comment. Rebased. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D108032/new/ https://reviews.llvm.org/D108032 Files: clang/lib/StaticAnalyzer/Core/RegionStore.c

[PATCH] D104285: [analyzer] Retrieve a value from list initialization of constant array declaration in a global scope.

2021-09-22 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/RegionStore.cpp:1696 + const llvm::APSInt &Idx = CI->getValue(); + const uint64_t I = static_cast(Idx.getExtValue()); + // Use `getZExtValue` because array extent

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

2021-09-22 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 374265. ASDenysPetrov added a comment. Rebased. Review, please. 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] D103094: [analyzer] Implemented RangeSet::Factory::castTo function to perform promotions, truncations and conversions.

2021-09-22 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 374267. 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 clang/include/clang/Stat

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

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

[PATCH] D104285: [analyzer] Retrieve a value from list initialization of constant array declaration in a global scope.

2021-09-22 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/RegionStore.cpp:1696-1697 + const auto I = static_cast(Idx.getExtValue()); + // Use `getZExtValue` because array extent can not be negative. + const uint64_t Exte

[PATCH] D104285: [analyzer] Retrieve a value from list initialization of constant array declaration in a global scope.

2021-09-22 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @martong Thank you for your time! CHANGES SINCE LAST ACTION https://reviews.llvm.org/D104285/new/ https://reviews.llvm.org/D104285 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin

[PATCH] D104285: [analyzer] Retrieve a value from list initialization of constant array declaration in a global scope.

2021-09-23 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. @martong BTW, this patch is the first one in the stack. There are also D107339 and D108032 . You could also express your opinion there. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D1042

[PATCH] D104285: [analyzer] Retrieve a value from list initialization of constant array declaration in a global scope.

2021-09-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 rG98a95d4844ca: [analyzer] Retrieve a value from list initialization of constant array… (authored by ASDenysPetrov). Repository: rG LLVM Github Mono

[PATCH] D110387: [Analyzer][NFC] Move RangeConstraintManager's def before ConstraintAssignor's def

2021-09-27 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov accepted this revision. ASDenysPetrov added a comment. LGTM. ?Should mention this as //NFC//. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110387/new/ https://reviews.llvm.org/D110387 ___

[PATCH] D110357: [Analyzer] Extend ConstraintAssignor to handle remainder op

2021-09-28 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:1603-1604 + template + bool handleRem(const SymT *Sym, RangeSet Constraint) { +// a % b != 0 implies that a != 0. steakhal wrote: > Why is this not

[PATCH] D110357: [Analyzer] Extend ConstraintAssignor to handle remainder op

2021-09-28 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added inline comments. Comment at: clang/test/Analysis/constraint-assignor.c:18 + clang_analyzer_warnIfReached(); // no-warning + (void)x; // keep the constraints alive. +} steakhal wrote: > It's still mindboggling that we need to do this. This i

[PATCH] D110625: [analyzer] canonicalize special case of structure/pointer deref

2021-09-30 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. I think we need to get canonical types. Check, please, aliased types: struct s { int v; }; using T1 = s; typedef s T2; void foo(T1 *ps) { T2 ss = *ps; ... } Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.

[PATCH] D110625: [analyzer] canonicalize special case of structure/pointer deref

2021-10-01 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. In D110625#3035616 , @steakhal wrote: > 'using' is the same as 'typedef' AFAIK. > So, you could simply use only typedefs and implement the test in the c test > file. Seeing all the tests close together would aid readability

[PATCH] D110911: [analyzer][NFC] Add RangeSet::dump

2021-10-01 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. In D110911#3035911 , @steakhal wrote: > Please mark both of them `LLVM_DUMP_METHOD`s. This way they will be stripped > from release builds according to their documentation. And `Range::dump` as well. Repository: rG LLV

[PATCH] D110625: [analyzer] canonicalize special case of structure/pointer deref

2021-10-01 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. In D110625#3035929 , @steakhal wrote: > I thought that `SVal::getType` should return an already canonical `QualType`. > If it doesn't do that we would need to do canonicalization at each callsite, > which is less than idea

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

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

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

2021-10-01 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. In D110927#3036436 , @steakhal wrote: > I'm pretty sure that `int x4 = ((char*)arr)[1];` is supposed to be valid in > your summary. > I think it's allowed by the standard to access any valid object via a `char*` > - accord

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

2021-10-04 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 376823. ASDenysPetrov added a comment. Fixed a comment. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110927/new/ https://reviews.llvm.org/D110927 Files: clang/lib/StaticAnalyzer/Core/RegionStore.cpp clang/test/Analysis/initialization.cpp

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

2021-10-04 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. In D110927#3037118 , @shafik wrote: > IIUC the object is `const int arr[42]` and the `(char *)arr` is an expression > of pointer type and adding `1` to this is valid. The case you refer to in > D104285

<    1   2   3   4   5   6   7   >