aaron.ballman added inline comments.
================ Comment at: clang-tools-extra/clang-tidy/modernize/AvoidBindCheck.cpp:153 + + return HNM.matchesNode(*dyn_cast<NamedDecl>(D)); +} ---------------- zturner wrote: > aaron.ballman wrote: > > This should probably use `cast<>` if it's going to assume the returned > > value is never null. > Good point. Since we're talking about this code anyway, it felt super hacky > to instantiate an AST matcher just to check for the qualified name of a Decl. > Is there a better way to do this? Since you only care about named call declarations, I think you could probably get away with: ``` if (const auto *ND = dyn_cast<NamedDecl>(CE->getCalleeDecl())) { const std::string &Str = ND->getQualifiedNameAsString(); if (Str == "::boost::ref" || Str == "::std::ref") { ... } } ``` ================ Comment at: clang-tools-extra/clang-tidy/modernize/AvoidBindCheck.cpp:167 + } + } else if (const auto *ThisExpr = dyn_cast<CXXThisExpr>(Statement)) + return true; ---------------- `isa<CXXThisExpr>(Statement)` ================ Comment at: clang-tools-extra/clang-tidy/modernize/AvoidBindCheck.cpp:428-429 + if (const auto *DRE = dyn_cast<DeclRefExpr>(CallExpression)) { + if (const auto *FD = dyn_cast<FunctionDecl>(DRE->getDecl())) + return FD; + } ---------------- I think this can be replaced with: `return dyn_cast<FunctionDecl>(DRE->getDecl());` CHANGES SINCE LAST ACTION https://reviews.llvm.org/D70368/new/ https://reviews.llvm.org/D70368 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits