11 #include "clang/AST/ASTContext.h"
12 #include "clang/ASTMatchers/ASTMatchFinder.h"
14 using namespace clang::ast_matchers;
18 namespace readability {
20 void RedundantFunctionPtrDereferenceCheck::registerMatchers(MatchFinder *
Finder) {
21 Finder->addMatcher(unaryOperator(hasOperatorName(
"*"),
23 hasCastKind(CK_FunctionToPointerDecay))))
28 void RedundantFunctionPtrDereferenceCheck::check(
const MatchFinder::MatchResult &
Result) {
29 const auto *Operator = Result.Nodes.getNodeAs<UnaryOperator>(
"op");
30 diag(Operator->getOperatorLoc(),
31 "redundant repeated dereference of function pointer")
32 << FixItHint::CreateRemoval(Operator->getOperatorLoc());
std::unique_ptr< ast_matchers::MatchFinder > Finder