10 #include "clang/AST/ASTContext.h" 11 #include "clang/ASTMatchers/ASTMatchFinder.h" 19 void CloexecPipeCheck::registerMatchers(MatchFinder *Finder) {
20 registerMatchersImpl(Finder,
21 functionDecl(returns(isInteger()), hasName(
"pipe"),
22 hasParameter(0, hasType(pointsTo(isInteger())))));
25 void CloexecPipeCheck::check(
const MatchFinder::MatchResult &Result) {
26 std::string ReplacementText =
27 (Twine(
"pipe2(") + getSpellingArg(Result, 0) +
", O_CLOEXEC)").str();
31 "prefer pipe2() with O_CLOEXEC to avoid leaking file descriptors to child processes",
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//