10#include "../utils/ASTUtils.h"
11#include "clang/AST/ASTContext.h"
12#include "clang/ASTMatchers/ASTMatchFinder.h"
19 auto SockAddrPointerType =
20 hasType(pointsTo(recordDecl(isStruct(), hasName(
"sockaddr"))));
21 auto SockLenPointerType = hasType(pointsTo(namedDecl(hasName(
"socklen_t"))));
24 functionDecl(returns(isInteger()), hasName(
"accept4"),
25 hasParameter(0, hasType(isInteger())),
26 hasParameter(1, SockAddrPointerType),
27 hasParameter(2, SockLenPointerType),
28 hasParameter(3, hasType(isInteger()))));
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Override this to register AST matchers with Finder.
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
ClangTidyChecks that register ASTMatchers should do the actual work in here.
void registerMatchersImpl(ast_matchers::MatchFinder *Finder, ast_matchers::internal::Matcher< FunctionDecl > Function)
void insertMacroFlag(const ast_matchers::MatchFinder::MatchResult &Result, StringRef MacroFlag, int ArgPos)
Currently, we have three types of fixes.