NoQ accepted this revision. NoQ added a comment. Looks great! LGTM except there's some dead code.
================ Comment at: clang/lib/Analysis/UnsafeBufferUsage.cpp:570-573 + if (const auto *ArraySubst = + dyn_cast<ArraySubscriptExpr>(Node->getSubExpr())) + if (const auto *DRE = + dyn_cast<DeclRefExpr>(ArraySubst->getBase()->IgnoreImpCasts())) { ---------------- These `dyn_cast`s are already checked by the matcher. They can be turned into `cast`s and this function can return `{DRE}` unconditionally. ================ Comment at: clang/lib/Analysis/UnsafeBufferUsage.cpp:1002 + + if (DREs.size() == 1) + if (const auto *VD = dyn_cast<VarDecl>(DREs.front()->getDecl())) { ---------------- Similarly, this check is redundant, it's already guaranteed by the matcher. ================ Comment at: clang/lib/Analysis/UnsafeBufferUsage.cpp:1077-1079 + if (const auto *ArraySub = dyn_cast<ArraySubscriptExpr>(Node->getSubExpr())) + if (const auto *DRE = + dyn_cast<DeclRefExpr>(ArraySub->getBase()->IgnoreImpCasts())) { ---------------- Same here! CHANGES SINCE LAST ACTION https://reviews.llvm.org/D143128/new/ https://reviews.llvm.org/D143128 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits