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

Balázs Benics via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 25 05:24:03 PDT 2021


steakhal added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/SmartPtrChecker.cpp:106-109
+    if (const auto *DS = llvm::dyn_cast<DeclStmt>(S)) {
+      for (const Decl *D : DS->getDeclGroup()) {
+        if (const VarDecl *VD = llvm::dyn_cast<VarDecl>(D)) {
+          const Expr *Init = VD->getInit();
----------------
RedDocMD wrote:
> steakhal wrote:
> > So you are trying to find the assignment, where the inner pointer is assigned to a variable.
> > This visitor logic seems to be somewhat convoluted.
> > 
> > What you want to achieve is slightly similar to `FindLastStoreBRVisitor`. You should have a look at that.
> That is what I had done before. @NoQ pointed out why this wouldn't work in a previous comment.
Please elaborate on that.
I'm not saying that an already existing visitor would perfectly fit your needs. I'm just curious why a //similar// logic would not work for you. You are trying to iterate over a bunch of decls and init exprs etc. And there is nothing similar to the visitor I mentioned.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97183/new/

https://reviews.llvm.org/D97183



More information about the cfe-commits mailing list