10#include "clang/AST/ASTContext.h"
11#include "clang/ASTMatchers/ASTMatchFinder.h"
18 MatchFinder *Finder) {
20 functionDecl(unless(parameterCountIs(0)), hasBody(coroutineBodyStmt()))
26 const MatchFinder::MatchResult &Result) {
27 const auto *Function = Result.Nodes.getNodeAs<FunctionDecl>(
"fnt");
28 for (
const ParmVarDecl *Param : Function->parameters()) {
29 if (!Param->getType().getCanonicalType()->isReferenceType())
32 diag(Param->getBeginLoc(),
"coroutine parameters should not be references");
DiagnosticBuilder diag(SourceLocation Loc, StringRef Description, DiagnosticIDs::Level Level=DiagnosticIDs::Warning)
Add a diagnostic with the check's name.
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.