clang-tools
9.0.0
llvm.src
tools
clang
tools
extra
clang-tidy
modernize
UseTrailingReturnTypeCheck.h
Go to the documentation of this file.
1
//===--- UseTrailingReturnTypeCheck.h - clang-tidy---------------*- C++ -*-===//
2
//
3
// The LLVM Compiler Infrastructure
4
//
5
// This file is distributed under the University of Illinois Open Source
6
// License. See LICENSE.TXT for details.
7
//
8
//===----------------------------------------------------------------------===//
9
10
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_USETRAILINGRETURNTYPECHECK_H
11
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_USETRAILINGRETURNTYPECHECK_H
12
13
#include "../ClangTidy.h"
14
15
namespace
clang
{
16
namespace
tidy {
17
namespace
modernize {
18
19
struct
ClassifiedToken
{
20
Token
T
;
21
bool
isQualifier
;
22
bool
isSpecifier
;
23
};
24
25
/// Rewrites function signatures to use a trailing return type.
26
///
27
/// For the user-facing documentation see:
28
/// http://clang.llvm.org/extra/clang-tidy/checks/modernize-use-trailing-type-return.html
29
class
UseTrailingReturnTypeCheck
:
public
ClangTidyCheck
{
30
public
:
31
UseTrailingReturnTypeCheck
(StringRef
Name
,
ClangTidyContext
*Context)
32
:
ClangTidyCheck
(Name, Context) {}
33
void
registerMatchers(ast_matchers::MatchFinder *Finder)
override
;
34
void
registerPPCallbacks(
const
SourceManager &SM, Preprocessor *PP,
35
Preprocessor *ModuleExpanderPP)
override
;
36
void
check(
const
ast_matchers::MatchFinder::MatchResult &
Result
)
override
;
37
38
private
:
39
Preprocessor *PP =
nullptr
;
40
41
SourceLocation findTrailingReturnTypeSourceLocation(
42
const
FunctionDecl &F,
const
FunctionTypeLoc &FTL,
const
ASTContext &
Ctx
,
43
const
SourceManager &SM,
const
LangOptions &LangOpts);
44
llvm::Optional<SmallVector<ClassifiedToken, 8>>
45
classifyTokensBeforeFunctionName(
const
FunctionDecl &F,
const
ASTContext &Ctx,
46
const
SourceManager &SM,
47
const
LangOptions &LangOpts);
48
SourceRange findReturnTypeAndCVSourceRange(
const
FunctionDecl &F,
49
const
ASTContext &Ctx,
50
const
SourceManager &SM,
51
const
LangOptions &LangOpts);
52
bool
keepSpecifiers(std::string &
ReturnType
, std::string &Auto,
53
SourceRange ReturnTypeCVRange,
const
FunctionDecl &F,
54
const
FriendDecl *Fr,
const
ASTContext &Ctx,
55
const
SourceManager &SM,
const
LangOptions &LangOpts);
56
};
57
58
}
// namespace modernize
59
}
// namespace tidy
60
}
// namespace clang
61
62
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_USETRAILINGRETURNTYPECHECK_H
clang::tidy::modernize::ClassifiedToken::isSpecifier
bool isSpecifier
Definition:
UseTrailingReturnTypeCheck.h:22
clang::tidy::ClangTidyCheck
Base class for all clang-tidy checks.
Definition:
ClangTidyCheck.h:47
Ctx
Context Ctx
Definition:
TUScheduler.cpp:233
clang::tidy::modernize::ClassifiedToken
Definition:
UseTrailingReturnTypeCheck.h:19
Name
static constexpr llvm::StringLiteral Name
Definition:
UppercaseLiteralSuffixCheck.cpp:27
ReturnType
std::string ReturnType
Definition:
CodeComplete.cpp:396
clang::tidy::modernize::ClassifiedToken::isQualifier
bool isQualifier
Definition:
UseTrailingReturnTypeCheck.h:21
clang
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Definition:
ApplyReplacements.h:27
clang::tidy::modernize::ClassifiedToken::T
Token T
Definition:
UseTrailingReturnTypeCheck.h:20
clang::tidy::ClangTidyContext
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
Definition:
ClangTidyDiagnosticConsumer.h:99
Result
llvm::Optional< llvm::Expected< tooling::AtomicChanges > > Result
Definition:
Rename.cpp:36
clang::tidy::modernize::UseTrailingReturnTypeCheck::UseTrailingReturnTypeCheck
UseTrailingReturnTypeCheck(StringRef Name, ClangTidyContext *Context)
Definition:
UseTrailingReturnTypeCheck.h:31
clang::tidy::modernize::UseTrailingReturnTypeCheck
Rewrites function signatures to use a trailing return type.
Definition:
UseTrailingReturnTypeCheck.h:29
Generated on Tue Sep 10 2019 11:14:40 for clang-tools by
1.8.13