teemperor added inline comments.
================ Comment at: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp:243 + // If b is a get() expression, then we can return a note + if (auto Report = bugReportOnGet(Node, BRC, RHS)) { + return Report; ---------------- LLVM-code style mandates no curly braces around single-line ifs. ================ Comment at: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp:256 + BugReporterContext &BRC, const Stmt *S, const SVal InnerPtrVal) { + if (const auto *DS = llvm::dyn_cast<DeclStmt>(S)) { + const Decl *D = DS->getSingleDecl(); ---------------- (I think this was already pointed out, but early-exits are the way to go in LLVM. ``` const auto *DS = llvm::dyn_cast<DeclStmt>(S)); if (!DS) return nullptr; const Decl *D = DS->getSingleDecl(); const auto *VD = llvm::dyn_cast<VarDecl>(D); if (!VD) return nullptr; .... `` ================ Comment at: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp:179-180 + // P.get() + if (const auto *InnerCastExpr = + llvm::dyn_cast<ImplicitCastExpr>(Sub)) { + Sub = InnerCastExpr->getSubExpr(); ---------------- RedDocMD wrote: > vsavchenko wrote: > > I think it's better to `IgnoreParensAndCasts` instead of manual traversal. > What is IgnoreParensAndCasts`? I didn't find it in the source code anywhere > (ripgrep, that is). Just a typo, the actual name is `IgnoreParenCasts` (Expr::IgnoreParenCasts) 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