[PATCH] D105821: [analyzer] [WIP] Model destructor for std::unique_ptr

2021-07-14 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 358839. RedDocMD added a comment. Cleanup, still doesn't work Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D105821/new/ https://reviews.llvm.org/D105821 Files: clang/lib/StaticAnalyzer/Checkers/SmartPtrMode

[PATCH] D105821: [analyzer] [WIP] Model destructor for std::unique_ptr

2021-07-15 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 358998. RedDocMD added a comment. Removed one bug, many more to go Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D105821/new/ https://reviews.llvm.org/D105821 Files: clang/lib/StaticAnalyzer/Checkers/SmartPt

[PATCH] D104616: [analyzer] Model comparision methods of std::unique_ptr

2021-07-15 Thread Deep Majumder via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG48688257c52d: [analyzer] Model comparision methods of std::unique_ptr (authored by RedDocMD). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D104616/new/ http

[PATCH] D105421: [analyzer] Handle << operator for std::unique_ptr

2021-07-15 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 359211. RedDocMD added a comment. Post rebase cleanup Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D105421/new/ https://reviews.llvm.org/D105421 Files: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp

[PATCH] D104300: [analyzer] Handle std::swap for std::unique_ptr

2021-07-18 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 359600. RedDocMD added a comment. Post rebase cleanup Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D104300/new/ https://reviews.llvm.org/D104300 Files: clang/lib/StaticAnalyzer/Checkers/SmartPtr.h clang/l

[PATCH] D104300: [analyzer] Handle std::swap for std::unique_ptr

2021-07-18 Thread Deep Majumder 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 rG0cd98bef1b6f: [analyzer] Handle std::swap for std::unique_ptr (authored by RedDocMD). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTI

[PATCH] D103750: [analyzer] Handle std::make_unique for SmartPtrModeling

2021-07-18 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 359605. RedDocMD added a comment. Post-rebase cleanup Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D103750/new/ https://reviews.llvm.org/D103750 Files: clang/include/clang/StaticAnalyzer/Core/PathSensitive/

[PATCH] D103750: [analyzer] Handle std::make_unique for SmartPtrModeling

2021-07-18 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 359625. RedDocMD added a comment. Fixed up tests Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D103750/new/ https://reviews.llvm.org/D103750 Files: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SValB

[PATCH] D103750: [analyzer] Handle std::make_unique for SmartPtrModeling

2021-07-18 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 359627. RedDocMD added a comment. Marked test with FIXME notes Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D103750/new/ https://reviews.llvm.org/D103750 Files: clang/include/clang/StaticAnalyzer/Core/PathS

[PATCH] D103750: [analyzer] Handle std::make_unique for SmartPtrModeling

2021-07-18 Thread Deep Majumder 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 rGd825309352b4: [analyzer] Handle std::make_unique (authored by RedDocMD). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://

[PATCH] D105421: [analyzer] Handle << operator for std::unique_ptr

2021-07-18 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD closed this revision. RedDocMD added a comment. For some reason this revision did not get automatically closed after commit, manually merging it. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D105421/new/ https://reviews.llvm.org/D105421

[PATCH] D106296: [analyer] Fix for faulty namespace test in SmartPtrModelling

2021-07-19 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD created this revision. RedDocMD added reviewers: NoQ, vsavchenko, xazax.hun, teemperor. Herald added subscribers: martong, rnkovacs. RedDocMD requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. This patch: - Fixes how the std-namespac

[PATCH] D106296: [analyer] Fix for faulty namespace test in SmartPtrModelling

2021-07-19 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 359865. RedDocMD added a comment. Reformatted patch Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D106296/new/ https://reviews.llvm.org/D106296 Files: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp

[PATCH] D106296: [analyzer] Fix for faulty namespace test in SmartPtrModelling

2021-07-19 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp:275 +return false; + const auto *Decl = Call.getDecl(); + if (!Decl) xazax.hun wrote: > Can we model a function call without a declaration? I wonder if we sho

[PATCH] D106296: [analyzer] Fix for faulty namespace test in SmartPtrModelling

2021-07-19 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 360027. RedDocMD added a comment. Added a simple test Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D106296/new/ https://reviews.llvm.org/D106296 Files: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp

[PATCH] D106296: [analyzer] Fix for faulty namespace test in SmartPtrModelling

2021-07-19 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added a comment. Would this test do? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D106296/new/ https://reviews.llvm.org/D106296 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://li

[PATCH] D106296: [analyzer] Fix for faulty namespace test in SmartPtrModelling

2021-07-20 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 360051. RedDocMD added a comment. Refactored out check Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D106296/new/ https://reviews.llvm.org/D106296 Files: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cp

[PATCH] D106296: [analyzer] Fix for faulty namespace test in SmartPtrModelling

2021-07-20 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 360061. RedDocMD added a comment. More refactor Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D106296/new/ https://reviews.llvm.org/D106296 Files: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp cla

[PATCH] D106296: [analyzer] Fix for faulty namespace test in SmartPtrModelling

2021-07-20 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp:252-255 + const auto *Decl = Call.getDecl(); + if (!Decl) +return false; + return Decl->getDeclContext()->isStdNamespace(); vsavchenko wrote: > Can we use a

[PATCH] D106296: [analyzer] Fix for faulty namespace test in SmartPtrModelling

2021-07-20 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp:252 +static bool isStdFunctionCall(const CallEvent &Call) { + return Call.getDecl() && Call.getDecl() ->getDeclContext()->isStdNamespace(); +} vsavchenko wrote: >

[PATCH] D106296: [analyzer] Fix for faulty namespace test in SmartPtrModelling

2021-07-20 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 360064. RedDocMD added a comment. Removed unnecessary white space Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D106296/new/ https://reviews.llvm.org/D106296 Files: clang/lib/StaticAnalyzer/Checkers/SmartPtr

[PATCH] D105821: [analyzer] [WIP] Model destructor for std::unique_ptr

2021-07-20 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 360199. RedDocMD added a comment. Retrieving patch Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D105821/new/ https://reviews.llvm.org/D105821 Files: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp

[PATCH] D105821: [analyzer] [WIP] Model destructor for std::unique_ptr

2021-07-20 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 360202. RedDocMD added a comment. Reformat Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D105821/new/ https://reviews.llvm.org/D105821 Files: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp clang/li

[PATCH] D105821: [analyzer] [WIP] Model destructor for std::unique_ptr

2021-07-20 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 360218. RedDocMD added a comment. Minimal modelling of destructor Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D105821/new/ https://reviews.llvm.org/D105821 Files: clang/lib/StaticAnalyzer/Checkers/SmartPtr

[PATCH] D105821: [analyzer] [WIP] Model destructor for std::unique_ptr

2021-07-20 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added a comment. This is a minimal model of destructors in smart-ptr. Other than the need to probably model the destructor of the pointee, is there anything else to do? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D105821/new/ https://rev

[PATCH] D106296: [analyzer] Fix for faulty namespace test in SmartPtrModelling

2021-07-21 Thread Deep Majumder 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 rG80068ca6232b: [analyzer] Fix for faulty namespace test in SmartPtrModelling (authored by RedDocMD). Repository: rG LLVM Github Monorepo CHANGES S

[PATCH] D106296: [analyzer] Fix for faulty namespace test in SmartPtrModelling

2021-07-21 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp:291 // we can try this function - if (Call.getNumArgs() == 2 && - Call.getDecl()->getDeclContext()->isStdNamespace()) -if (smartptr::isStdSmartPtr(Call.getArgExpr(0)) |

[PATCH] D105821: [analyzer] [WIP] Model destructor for std::unique_ptr

2021-07-22 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added a comment. > But before we go there we should decide whether we want to actually go for > inlining (or otherwise default-evaluating) these destructors. If we do, we > should probably not spend too much time on improving invalidation in the > checker, because default evaluation wo

[PATCH] D106739: [analyzer] Add option to SATest.py for extra checkers

2021-07-23 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD created this revision. RedDocMD added reviewers: vsavchenko, NoQ, xazax.hun, teemperor. Herald added subscribers: manas, steakhal, ASDenysPetrov, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware. RedDocMD requested review of this revision. He

[PATCH] D106739: [analyzer] Add option to SATest.py for extra checkers

2021-07-23 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added a comment. It turns out that there is already an option called `extra-analyzer-config` to pass analyzer configs, like setting `ModelSmartPtrDereference` to true Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D106739/new/ https://revie

[PATCH] D105821: [analyzer] [WIP] Model destructor for std::unique_ptr

2021-07-25 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added a comment. In D105821#2897006 , @NoQ wrote: >> the following code doesn't emit any warnings > > This code doesn't seem to have any `unique_ptr`s in it? It's not like you're > modeling this custom class as well? Can you try the same with th

[PATCH] D106739: [analyzer] Add option to SATest.py for extra checkers

2021-07-25 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added a comment. @vsavchenko is this okay? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D106739/new/ https://reviews.llvm.org/D106739 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http

[PATCH] D105821: [analyzer] [WIP] Model destructor for std::unique_ptr

2021-07-25 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 361581. RedDocMD added a comment. Removed a fatal bug Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D105821/new/ https://reviews.llvm.org/D105821 Files: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp

[PATCH] D105821: [analyzer] [WIP] Model destructor for std::unique_ptr

2021-07-28 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 362310. RedDocMD added a comment. Invalidating via the CallEvent Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D105821/new/ https://reviews.llvm.org/D105821 Files: clang/lib/StaticAnalyzer/Checkers/SmartPtrM

[PATCH] D105821: [analyzer] [WIP] Model destructor for std::unique_ptr

2021-07-28 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added a comment. Ah I see. As a side note, without the "redundant" invalidation that is being done, the analyzer crashes on `shared_ptr`. (Because the `State` essentially remains the same and that's what causes the crash). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTI

[PATCH] D105821: [analyzer] [WIP] Model destructor for std::unique_ptr

2021-07-29 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp:421-422 const auto *TrackingExpr = Call.getArgExpr(0); - assert(TrackingExpr->getType()->isPointerType() && - "Adding a non pointer value to TrackedRegionMap

[PATCH] D105821: [analyzer] [WIP] Model destructor for std::unique_ptr

2021-07-29 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp:143 +llvm::ArrayRef ValidNames(STD_PTR_NAMES); +return llvm::is_contained(ValidNames, Name); } vsavchenko wrote: > And why can't we pass `STD_PTR_NAMES`

[PATCH] D105821: [analyzer] [WIP] Model destructor for std::unique_ptr

2021-07-29 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 362738. RedDocMD added a comment. Bug fixes, some cleanup Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D105821/new/ https://reviews.llvm.org/D105821 Files: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling

[PATCH] D105821: [analyzer] [WIP] Model destructor for std::unique_ptr

2021-07-29 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp:381 +const MemRegion *ThisRegion = DC->getCXXThisVal().getAsRegion(); +assert(ThisRegion && "We do not support explicit calls to destructor"); +const auto *InnerPtrVal =

[PATCH] D105821: [analyzer] [WIP] Model destructor for std::unique_ptr

2021-07-29 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 362741. RedDocMD added a comment. Put in a TODO Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D105821/new/ https://reviews.llvm.org/D105821 Files: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp cla

[PATCH] D105821: [analyzer] [WIP] Model destructor for std::unique_ptr

2021-07-29 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added a comment. On running this patch on the `projects` directory, a bunch of projects emit false-positives: mostly of the form `Potential memory leak`. This points to the fact that without calling the destructor of the pointee type, we are going to have a lot of false positives (408

[PATCH] D97183: [analyzer] Add NoteTag for smart-ptr get()

2021-05-19 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 346632. RedDocMD added a comment. Herald added a reviewer: teemperor. Herald added a subscriber: manas. Added a test for multiple get's Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D97183/new/ https://reviews.

[PATCH] D97183: [analyzer] Add NoteTag for smart-ptr get()

2021-05-19 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 346633. RedDocMD added a comment. Removed unnecessary includes Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D97183/new/ https://reviews.llvm.org/D97183 Files: clang/lib/StaticAnalyzer/Checkers/SmartPtr.h

[PATCH] D97183: [analyzer] Add NoteTag for smart-ptr get()

2021-05-20 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 346808. RedDocMD marked 10 inline comments as done. RedDocMD added a comment. Code clean up Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D97183/new/ https://reviews.llvm.org/D97183 Files: clang/lib/StaticAn

[PATCH] D97183: [analyzer] Add NoteTag for smart-ptr get()

2021-05-20 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp:141-163 +auto bugReportOnGet = [&](const Expr *E) -> auto { + if (const auto *MCE = llvm::dyn_cast(E)) { +const auto *Method = MCE->getMethodDecl(); +

[PATCH] D97183: [analyzer] Add NoteTag for smart-ptr get()

2021-05-20 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 346817. RedDocMD added a comment. Removed un-necessary includes Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D97183/new/ https://reviews.llvm.org/D97183 Files: clang/lib/StaticAnalyzer/Checkers/SmartPtr.h

[PATCH] D97183: [analyzer] Add NoteTag for smart-ptr get()

2021-05-21 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added a comment. Right, @teemperor, I will do the refactors once we figure out how to utilize `trackExpressionValue()` here (because that will eliminate quite a bit of code from `GetNoteVisitor`, so no point in refactoring those bits). Repository: rG LLVM Github Monorepo CHANGES SI

[PATCH] D97183: [analyzer] Add NoteTag for smart-ptr get()

2021-05-23 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 347259. RedDocMD added a comment. Refactors to make code more stylistically accurate Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D97183/new/ https://reviews.llvm.org/D97183 Files: clang/lib/StaticAnalyzer/

[PATCH] D97183: [analyzer] Add NoteTag for smart-ptr get()

2021-05-23 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 347260. RedDocMD added a comment. Removed unnecessary include Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D97183/new/ https://reviews.llvm.org/D97183 Files: clang/lib/StaticAnalyzer/Checkers/SmartPtr.h c

[PATCH] D97183: [analyzer] Add NoteTag for smart-ptr get()

2021-05-23 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added a comment. I have put in the refactors, @teemperor. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D97183/new/ https://reviews.llvm.org/D97183 ___ cfe-commits mailing list cfe-commits@lists.

[PATCH] D97183: [analyzer] Add NoteTag for smart-ptr get()

2021-05-26 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 348165. RedDocMD marked 10 inline comments as done. RedDocMD added a comment. More refactoring Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D97183/new/ https://reviews.llvm.org/D97183 Files: clang/lib/Stati

[PATCH] D97183: [analyzer] Add NoteTag for smart-ptr get()

2021-05-26 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 348166. RedDocMD added a comment. Removed extra include Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D97183/new/ https://reviews.llvm.org/D97183 Files: clang/lib/StaticAnalyzer/Checkers/SmartPtr.h clang/l

[PATCH] D97183: [analyzer] Add NoteTag for smart-ptr get()

2021-05-27 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/SmartPtr.h:37 + +class GetNoteVisitor : public BugReporterVisitor { +private: vsavchenko wrote: > Sorry for picking on it again, but is it visiting "get notes"? Otherwise, it > is just

[PATCH] D97183: [analyzer] Add NoteTag for smart-ptr get()

2021-05-27 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added a comment. My bad! I forgot to submit the replies. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D97183/new/ https://reviews.llvm.org/D97183 ___ cfe-commits mailing list cfe-commits@lists.l

[PATCH] D97183: [analyzer] Add NoteTag for smart-ptr get()

2021-05-27 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD marked 9 inline comments as done. RedDocMD added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/SmartPtr.h:36 + +class FindWhereConstrained : public BugReporterVisitor { +private: vsavchenko wrote: > vsavchenko wrote: > > nit: class name

[PATCH] D97183: [analyzer] Add NoteTag for smart-ptr get()

2021-05-27 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp:258 + const Decl *D = DS->getSingleDecl(); + assert(D && "DeclStmt should have at least one Decl"); + const auto *VD = llvm::dyn_cast(D); NoQ wrote: > That's not

[PATCH] D103434: [analyzer] Allow visitors to run callbacks on completion

2021-05-31 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD created this revision. RedDocMD added reviewers: NoQ, vsavchenko, xazax.hun, teemperor. Herald added subscribers: manas, steakhal, ASDenysPetrov, martong, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware. RedDocMD requested review of this re

[PATCH] D103434: [analyzer] Allow visitors to run callbacks on completion

2021-05-31 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added a comment. **Note: This patch is only partially done.** The following things are still left: - `trackExpressionValue` must receive a callback - The callback must be passed to a visitor (`ReturnVisitor` for now) - Tests to verify that `ReturnVisitor` actually does what we intend it

[PATCH] D103434: [analyzer] Allow visitors to run callbacks on completion

2021-06-01 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added inline comments. Comment at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h:95 + /// This method is run once the \ref Stop method is called. + virtual void OnStop(const ExplodedNode *Curr, BugReporterContext &BRC, +

[PATCH] D103434: [analyzer] Allow visitors to run callbacks on completion

2021-06-02 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 349295. RedDocMD added a comment. trackExpressionValue recieving callback, passing it to ReturnVisitor Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D103434/new/ https://reviews.llvm.org/D103434 Files: clang

[PATCH] D103434: [analyzer] Allow visitors to run callbacks on completion

2021-06-02 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added a comment. The following things are now done: - `trackExpressionValue` must receive a callback - The callback must be passed to a visitor (`ReturnVisitor` for now) I still don't know a good way to test the following: - Tests to verify that `ReturnVisitor` actually does what we in

[PATCH] D97183: [analyzer] Add NoteTag for smart-ptr get()

2021-06-02 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD marked 7 inline comments as done. RedDocMD added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp:258 + const Decl *D = DS->getSingleDecl(); + assert(D && "DeclStmt should have at least one Decl"); + const auto *VD = llvm::dyn_cast(D

[PATCH] D97183: [analyzer] Add NoteTag for smart-ptr get()

2021-06-02 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 349332. RedDocMD added a comment. Moved visitor entirely to SmartPtrChecker.cpp, other refactors, better naming. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D97183/new/ https://reviews.llvm.org/D97183 Files:

[PATCH] D97183: [analyzer] Add NoteTag for smart-ptr get()

2021-06-02 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added a comment. Important question from @vsavchenko: > I have two major questions about this implementation: > > - Why don't we need an actual check for `IfStmt`? Won't it trigger on `bool > unused = !pointer;`? And if so it won't mean **constrained**. > - Why do we only care about imp

[PATCH] D103434: [analyzer] Allow visitors to run callbacks on completion

2021-06-03 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added a comment. In D103434#2795940 , @vsavchenko wrote: > I was thinking a lot about this problem after our last call, and even though > `StoppableVisitor` helps to solve the problem that we have, it is extremely > unclear when this callback

[PATCH] D95307: [StaticAnalyzer] Add checking for degenerate base class in MemRegion

2021-01-24 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD created this revision. Herald added subscribers: steakhal, ASDenysPetrov, martong, dkrupp, donat.nagy, Szelethus, a.sidorin, szepet, baloghadamsoftware. RedDocMD requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. In the function isVa

[PATCH] D95307: [StaticAnalyzer] Add checking for degenerate base class in MemRegion

2021-01-25 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added a comment. In D95307#2519283 , @vsavchenko wrote: > In D95307#2518592 , @NoQ wrote: > >> This patch shoots the messenger but someone still needs to conduct a proper >> investigation. The assertion is

[PATCH] D95307: [StaticAnalyzer] Add checking for degenerate base class in MemRegion

2021-01-25 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added a comment. Funnily enough, when I run `ninja clang-check` I don't get any errors. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D95307/new/ https://reviews.llvm.org/D95307 ___ cfe-commits m

[PATCH] D95307: [StaticAnalyzer] Add checking for degenerate base class in MemRegion

2021-01-25 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added a comment. Thanks @NoQ for the tip on the right test command! My own belief is that this patch is just a hack that squelches the problem, instead of solving it. I am limited by my own inexperience with the codebase and am trying to learn more to help better. That said, couple of

[PATCH] D95307: [StaticAnalyzer] Add checking for degenerate base class in MemRegion

2021-01-26 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added a comment. On further digging as to how pointer-to-members are handled in StaticAnalyzer, I discovered that in `BasicValueFactory::accumCXXBase() for the example given in my test produces the two `CXXBaseSpecifier` for the pointer-to-member. At line 195, one base specifier is add

[PATCH] D95307: [StaticAnalyzer] Add checking for degenerate base class in MemRegion

2021-01-27 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 319607. RedDocMD added a comment. Removing duplication of CXXBaseSpecifiers when they are created for PointerToMember Removed hackish weakening of assert Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D95307/new

[PATCH] D95307: [StaticAnalyzer] Add checking for degenerate base class in MemRegion

2021-01-28 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added a comment. @kromanenkov I guess it won't work then. Thanks for the idea! Now that I think about it removing duplicates is probably not the right thing to do. The problem arises because the call PTMD->getCXXBaseList() should ideally return the list of previous casts, but instead r

[PATCH] D95307: [StaticAnalyzer] Add checking for degenerate base class in MemRegion

2021-01-31 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD abandoned this revision. RedDocMD added a comment. I clearly am taking the wrong approach to this problem. I will need to reconsider how PointerToMember is actually modelled before solving this problem Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.l

[PATCH] D95307: [StaticAnalyzer] Add checking for degenerate base class in MemRegion

2021-02-01 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added a comment. In D95307#2533259 , @vsavchenko wrote: > I don't know if this is useful or not, but pointer-to-members used to be > `void *` up until very recently. Here is my change on that topic (and it > probably where the bug you're trying

[PATCH] D95846: [analyzer] Updated comments to reflect D85817

2021-02-01 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD created this revision. RedDocMD added reviewers: NoQ, vsavchenko. Herald added subscribers: steakhal, ASDenysPetrov, Charusso, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, szepet, baloghadamsoftware, xazax.hun. RedDocMD requested review of this revision. Herald added a proj

[PATCH] D95846: [analyzer] Updated comments to reflect D85817

2021-02-02 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added a comment. In D95846#2536380 , @vsavchenko wrote: > Thanks for doing that! > I have a minor nit-picking comment, it is preferable to use present-tense > imperative-style commit messages, i.e. "Update comment...". Noted. I will do that in f

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

2021-02-02 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD created this revision. RedDocMD added reviewers: vsavchenko, NoQ, xazax.hun, dcoughlin. Herald added subscribers: martong, Charusso, rnkovacs. RedDocMD requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. This commit fixes bug #48739. T

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

2021-02-02 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/BasicValueFactory.cpp:223 + auto DelIt = find_first(BaseList.begin(), BaseList.end(), PathBase); + assert(DelIt != BaseList.end() && "PTM has insufficient base specifiers"); + BaseList.erase

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

2021-02-03 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 321074. RedDocMD added a comment. Remoevd the use of std::list with llvm::SmallVector. Removed the need to delete elements. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D95877/new/ https://reviews.llvm.org/D9

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

2021-02-03 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 321078. RedDocMD added a comment. Made assertion more verbose Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D95877/new/ https://reviews.llvm.org/D95877 Files: clang/include/clang/StaticAnalyzer/Core/PathSens

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

2021-02-03 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added a comment. @vsavchenko could you please see the current logic if it is better now? Comment at: clang/test/Analysis/pointer-to-member.cpp:304 + grandpa.field = 10; + int Grandfather::*gpf1 = static_cast(sf); + int Grandfather::*gpf2 = static_cast(static_cast(sf

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

2021-02-03 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added a comment. Comment at: clang/lib/StaticAnalyzer/Core/BasicValueFactory.cpp:226 +llvm::make_range(BaseList.begin(), BaseList.end()), +[](const auto &I) -> bool { return I.second; }); + vsavchenko wrote: > I think it's all a bit to

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

2021-02-03 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 321139. RedDocMD added a comment. Cleaner implementation of the popping logic, using STL/LLVM algorithms Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D95877/new/ https://reviews.llvm.org/D95877 Files: clang

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

2021-02-03 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD marked 2 inline comments as done. RedDocMD added a comment. @vsavchenko , I have used the logic that you suggested and put in a better assertion. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D95877/new/ https://reviews.llvm.org/D95877 __

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

2021-02-04 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 321476. RedDocMD added a comment. Updated to use new function Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D95877/new/ https://reviews.llvm.org/D95877 Files: clang/include/clang/StaticAnalyzer/Core/PathSens

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

2021-02-04 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added a comment. @vsavchenko, after some experimentation, I found out that handling reinterpret_cast will be a real pain. Consider the following: struct Base { int field; }; struct Derived : public Base {}; struct DoubleDerived : public Derived {}; struct Some

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

2021-02-05 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 321714. RedDocMD marked an inline comment as done. RedDocMD added a comment. Added TODO for reinterpret_cast, moved assertion code to its own block Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D95877/new/ http

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

2021-02-05 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD marked 2 inline comments as done. RedDocMD added a comment. @vsavchenko , does it look okay now? Comment at: clang/lib/StaticAnalyzer/Core/BasicValueFactory.cpp:27 #include +#include #include vsavchenko wrote: > We don't need this anymore :) Wow,

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

2021-02-05 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD marked an inline comment as done. RedDocMD added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/BasicValueFactory.cpp:180 +bool noRepeatedElements( +const llvm::ImmutableList &BaseSpecList) { vsavchenko wrote: > nit: functions represent

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

2021-02-05 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 321816. RedDocMD marked 10 inline comments as done. RedDocMD added a comment. Some more aesthetic cleanup, added a failing test. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D95877/new/ https://reviews.llvm.or

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

2021-02-05 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/BasicValueFactory.cpp:184 + llvm::SmallPtrSet BaseSpecSeen; + for (const auto &BaseSpec : BaseSpecList) { +auto BaseType = BaseSpec->getType(); vsavchenko wrote: > vsavchenko wrote: >

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

2021-02-07 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added a comment. @vsavchenko are there some more changes you want done? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D95877/new/ https://reviews.llvm.org/D95877 ___ cfe-commits mailing list cfe-

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

2021-02-08 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added a comment. In D95877#2547949 , @vsavchenko wrote: > I think we had a bit of misunderstanding about the test. It still should > pass (we can't have broken tests, it will disrupt CI bots). Try to put the > test case, so it is THERE and you

[PATCH] D110032: [analyzer] Move docs of SmartPtr to correct subcategory

2021-09-19 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD created this revision. RedDocMD added reviewers: NoQ, teemperor, xazax.hun, vsavchenko. Herald added subscribers: manas, steakhal, ASDenysPetrov, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware. RedDocMD requested review of this revision. He

[PATCH] D110032: [analyzer] Move docs of SmartPtr to correct subcategory

2021-09-20 Thread Deep Majumder 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 rG5dee50111c13: [analyzer] Move docs of SmartPtr to correct subcategory (authored by RedDocMD). Repository: rG LLVM Github Monorepo CHANGES SINCE L

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

2021-02-08 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 322094. RedDocMD added a comment. Moved failing test of reinterpret_cast to its own file, marked to failx Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D95877/new/ https://reviews.llvm.org/D95877 Files: clan

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

2021-02-08 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added a comment. In D95877#2548027 , @vsavchenko wrote: > Yes, it'd be better to extract this case into a separate file and mark it as > XFAIL Done that. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.o

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

2021-02-09 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added a comment. @vsavchenko, anything else to add? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D95877/new/ https://reviews.llvm.org/D95877 ___ cfe-commits mailing list cfe-commits@lists.llvm.o

[PATCH] D85817: [analyzer] Fix crash with pointer to members values

2021-02-12 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added a comment. @vsavchenko, why did you chose NamedDecl instead of ValueDecl to account for the indirect fields? I couldn't quite follow it from the discussion above. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D85817/new/ https://revi

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

2021-02-15 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added a comment. In D95877#2563220 , @RKSimon wrote: > @RedDocMD Please can you take a look at this buildbot failure: > http://lab.llvm.org:8011/#/builders/124 Yes. Thanks for the ping 😀 Repository: rG LLVM Github Monorepo CHANGES SINCE LAS

  1   2   3   >