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