clang-tools 6.0.0

IntegerTypesCheck.h
Go to the documentation of this file.
1 //===--- IntegerTypesCheck.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_GOOGLE_INTEGERTYPESCHECK_H
11 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GOOGLE_INTEGERTYPESCHECK_H
12
13 #include "../ClangTidy.h"
14
15 #include <memory>
16
17 namespace clang {
18
19 class IdentifierTable;
20
21 namespace tidy {
22 namespace google {
23 namespace runtime {
24
25 /// Finds uses of `short`, `long` and `long long` and suggest replacing them
26 /// with `u?intXX(_t)?`.
27 ///
28 /// Correspondig cpplint.py check: 'runtime/int'.
29 class IntegerTypesCheck : public ClangTidyCheck {
30 public:
31 IntegerTypesCheck(StringRef Name, ClangTidyContext *Context);
32 void registerMatchers(ast_matchers::MatchFinder *Finder) override;
33 void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
34 void storeOptions(ClangTidyOptions::OptionMap &Options) override;
35
36 private:
37 const std::string UnsignedTypePrefix;
38 const std::string SignedTypePrefix;
39 const std::string TypeSuffix;
40
41 std::unique_ptr<IdentifierTable> IdentTable;
42 };
43
44 } // namespace runtime
45 } // namespace google
46 } // namespace tidy
47 } // namespace clang
48
49 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GOOGLE_INTEGERTYPESCHECK_H
Name
StringHandle Name
Definition: PreprocessorTracker.cpp:525
clang::tidy::ClangTidyCheck
Base class for all clang-tidy checks.
Definition: ClangTidy.h:127
clang::tidy::google::runtime::IntegerTypesCheck::IntegerTypesCheck
IntegerTypesCheck(StringRef Name, ClangTidyContext *Context)
Definition: IntegerTypesCheck.cpp:43
clang::tidy::ClangTidyCheck::Options
OptionsView Options
Definition: ClangTidy.h:183
clang::tidy::google::runtime::IntegerTypesCheck::registerMatchers
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Override this to register AST matchers with Finder.
Definition: IntegerTypesCheck.cpp:55
clang::tidy::google::runtime::IntegerTypesCheck
Finds uses of short, long and long long and suggest replacing them with u?intXX(_t)?.
Definition: IntegerTypesCheck.h:29
clang::tidy::ClangTidyOptions::OptionMap
std::map< std::string, std::string > OptionMap
Definition: ClangTidyOptions.h:99
clang
Definition: AndroidTidyModule.cpp:28
clang::tidy::ClangTidyContext
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
Definition: ClangTidyDiagnosticConsumer.h:104
clang::tidy::google::runtime::IntegerTypesCheck::check
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
ClangTidyChecks that register ASTMatchers should do the actual work in here.
Definition: IntegerTypesCheck.cpp:63
clang::tidy::google::runtime::IntegerTypesCheck::storeOptions
void storeOptions(ClangTidyOptions::OptionMap &Options) override
Should store all options supported by this check with their current values or default values for opti...
Definition: IntegerTypesCheck.cpp:49