10 #include "clang/AST/ASTContext.h" 11 #include "clang/ASTMatchers/ASTMatchFinder.h" 19 void CloexecDupCheck::registerMatchers(MatchFinder *Finder) {
20 registerMatchersImpl(Finder,
21 functionDecl(returns(isInteger()), hasName(
"dup"),
22 hasParameter(0, hasType(isInteger()))));
25 void CloexecDupCheck::check(
const MatchFinder::MatchResult &Result) {
26 std::string ReplacementText =
27 (Twine(
"fcntl(") + getSpellingArg(Result, 0) +
", F_DUPFD_CLOEXEC)")
31 "prefer fcntl() to dup() because fcntl() allows F_DUPFD_CLOEXEC",
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//