10 #include "clang/AST/ASTContext.h" 11 #include "clang/ASTMatchers/ASTMatchFinder.h" 19 void CommandProcessorCheck::registerMatchers(MatchFinder *Finder) {
22 callee(functionDecl(anyOf(hasName(
"::system"), hasName(
"::popen"),
28 unless(callExpr(callee(functionDecl(hasName(
"::system"))),
30 hasArgument(0, nullPointerConstant()))))
35 void CommandProcessorCheck::check(
const MatchFinder::MatchResult &Result) {
36 const auto *Fn = Result.Nodes.getNodeAs<FunctionDecl>(
"func");
37 const auto *
E = Result.Nodes.getNodeAs<CallExpr>(
"expr");
39 diag(E->getExprLoc(),
"calling %0 uses a command processor") << Fn;
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//