aaron.ballman added inline comments.
================ Comment at: clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp:50 +AST_MATCHER(Stmt, isArrayToPointerDecay) { + const auto *MatchedCast = cast<ImplicitCastExpr>(&Node); ---------------- Why not match on `ImplicitCastExpr` rather than `Stmt`? Then you can remove the explicit cast below. ================ Comment at: clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp:55 + +AST_MATCHER(Stmt, sysSymbolDecayInSysHeader) { + const auto *E = cast<ImplicitCastExpr>(&Node); ---------------- Likewise here. ================ Comment at: clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp:59-60 + if (SM.isInSystemMacro(E->getLocStart())) { + const auto *PredefSymbol = dyn_cast<PredefinedExpr>(E->getSubExpr()); + if (PredefSymbol) + return true; ---------------- I think this is better-expressed with an isa check: `if (isa<PredefinedExpr>(E->getSubExpr())) return true;` ================ Comment at: clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp:63-64 + + const auto *SymbolDeclRef = dyn_cast<DeclRefExpr>(E->getSubExpr()); + if (SymbolDeclRef) { + const ValueDecl *SymbolDecl = SymbolDeclRef->getDecl(); ---------------- You can combine these into `if (const auto *SDR = dyn_cast<>())` https://reviews.llvm.org/D31130 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits