10 #include "clang/AST/ASTContext.h"
11 #include "clang/ASTMatchers/ASTMatchFinder.h"
12 #include "clang/ASTMatchers/ASTMatchersInternal.h"
22 return Node.getType()->castAs<FunctionProtoType>()->hasTrailingReturn();
26 void TrailingReturnCheck::registerMatchers(MatchFinder *Finder) {
31 functionDecl(hasTrailingReturn(),
32 unless(anyOf(returns(decltypeType()),
33 hasParent(cxxRecordDecl(isLambda())))))
38 void TrailingReturnCheck::check(
const MatchFinder::MatchResult &Result) {
39 if (
const auto *D = Result.Nodes.getNodeAs<
Decl>(
"decl"))
40 diag(D->getBeginLoc(),
41 "a trailing return type is disallowed for this type of declaration");