#include "UseTrailingReturnTypeCheck.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Tooling/FixIt.h"
#include "llvm/ADT/StringExtras.h"
#include <cctype>
#include <optional>
usingnamespaceclang::ast_matchers;
namespace clang::tidy::modernize {
namespace {
struct UnqualNameVisitor : public RecursiveASTVisitor<UnqualNameVisitor> { … };
}
constexpr llvm::StringLiteral Message = …;
static SourceLocation expandIfMacroId(SourceLocation Loc,
const SourceManager &SM) { … }
SourceLocation UseTrailingReturnTypeCheck::findTrailingReturnTypeSourceLocation(
const FunctionDecl &F, const FunctionTypeLoc &FTL, const ASTContext &Ctx,
const SourceManager &SM, const LangOptions &LangOpts) { … }
static bool isCvr(Token T) { … }
static bool isSpecifier(Token T) { … }
static std::optional<ClassifiedToken>
classifyToken(const FunctionDecl &F, Preprocessor &PP, Token Tok) { … }
std::optional<SmallVector<ClassifiedToken, 8>>
UseTrailingReturnTypeCheck::classifyTokensBeforeFunctionName(
const FunctionDecl &F, const ASTContext &Ctx, const SourceManager &SM,
const LangOptions &LangOpts) { … }
static bool hasAnyNestedLocalQualifiers(QualType Type) { … }
SourceRange UseTrailingReturnTypeCheck::findReturnTypeAndCVSourceRange(
const FunctionDecl &F, const TypeLoc &ReturnLoc, const ASTContext &Ctx,
const SourceManager &SM, const LangOptions &LangOpts) { … }
void UseTrailingReturnTypeCheck::keepSpecifiers(
std::string &ReturnType, std::string &Auto, SourceRange ReturnTypeCVRange,
const FunctionDecl &F, const FriendDecl *Fr, const ASTContext &Ctx,
const SourceManager &SM, const LangOptions &LangOpts) { … }
void UseTrailingReturnTypeCheck::registerMatchers(MatchFinder *Finder) { … }
void UseTrailingReturnTypeCheck::registerPPCallbacks(
const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) { … }
void UseTrailingReturnTypeCheck::check(const MatchFinder::MatchResult &Result) { … }
}