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

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to