11 #include "clang/AST/ASTContext.h" 12 #include "clang/ASTMatchers/ASTMatchFinder.h" 13 #include "clang/ASTMatchers/ASTMatchersInternal.h" 23 return Node.getType()->castAs<FunctionProtoType>()->hasTrailingReturn();
27 void TrailingReturnCheck::registerMatchers(MatchFinder *Finder) {
30 if (!getLangOpts().CPlusPlus11)
37 functionDecl(hasTrailingReturn(),
38 unless(anyOf(returns(decltypeType()),
39 hasParent(cxxRecordDecl(isLambda())))))
44 void TrailingReturnCheck::check(
const MatchFinder::MatchResult &
Result) {
45 if (
const auto *
D = Result.Nodes.getNodeAs<Decl>(
"decl"))
46 diag(
D->getBeginLoc(),
47 "a trailing return type is disallowed for this type of declaration");
AST_MATCHER(BinaryOperator, isAssignmentOperator)
llvm::Optional< llvm::Expected< tooling::AtomicChanges > > Result
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//