10#include "clang/AST/ASTContext.h"
11#include "clang/ASTMatchers/ASTMatchFinder.h"
12#include "clang/ASTMatchers/ASTMatchersInternal.h"
23 functionDecl(hasTrailingReturn(),
24 unless(anyOf(returns(decltypeType()),
25 hasParent(cxxRecordDecl(isLambda())),
26 cxxDeductionGuideDecl())))
32 if (
const auto *D = Result.Nodes.getNodeAs<FunctionDecl>(
"decl"))
33 diag(D->getBeginLoc(),
34 "a trailing return type is disallowed for this function declaration");
DiagnosticBuilder diag(SourceLocation Loc, StringRef Description, DiagnosticIDs::Level Level=DiagnosticIDs::Warning)
Add a diagnostic with the check's name.
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
ClangTidyChecks that register ASTMatchers should do the actual work in here.
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Override this to register AST matchers with Finder.