clang-tools  5.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'.
30 public:
32  void registerMatchers(ast_matchers::MatchFinder *Finder) override;
33  void check(const ast_matchers::MatchFinder::MatchResult &Result) 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
StringHandle Name
std::unique_ptr< ast_matchers::MatchFinder > Finder
Definition: ClangTidy.cpp:275
Base class for all clang-tidy checks.
Definition: ClangTidy.h:127
IntegerTypesCheck(StringRef Name, ClangTidyContext *Context)
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Override this to register AST matchers with Finder.
Finds uses of short, long and long long and suggest replacing them with u?intXX(_t)?.
std::map< std::string, std::string > OptionMap
ClangTidyContext & Context
Definition: ClangTidy.cpp:87
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
ClangTidyChecks that register ASTMatchers should do the actual work in here.
void storeOptions(ClangTidyOptions::OptionMap &Options) override
Should store all options supported by this check with their current values or default values for opti...