clang-tools  9.0.0
IntegerTypesCheck.h
Go to the documentation of this file.
1 //===--- IntegerTypesCheck.h - clang-tidy -----------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GOOGLE_INTEGERTYPESCHECK_H
10 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GOOGLE_INTEGERTYPESCHECK_H
11 
12 #include "../ClangTidyCheck.h"
13 
14 #include <memory>
15 
16 namespace clang {
17 
18 class IdentifierTable;
19 
20 namespace tidy {
21 namespace google {
22 namespace runtime {
23 
24 /// Finds uses of `short`, `long` and `long long` and suggest replacing them
25 /// with `u?intXX(_t)?`.
26 ///
27 /// Correspondig cpplint.py check: 'runtime/int'.
29 public:
30  IntegerTypesCheck(StringRef Name, ClangTidyContext *Context);
31  void registerMatchers(ast_matchers::MatchFinder *Finder) override;
32  void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
34 
35 private:
36  const std::string UnsignedTypePrefix;
37  const std::string SignedTypePrefix;
38  const std::string TypeSuffix;
39 
40  std::unique_ptr<IdentifierTable> IdentTable;
41 };
42 
43 } // namespace runtime
44 } // namespace google
45 } // namespace tidy
46 } // namespace clang
47 
48 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GOOGLE_INTEGERTYPESCHECK_H
Base class for all clang-tidy checks.
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)?.
static constexpr llvm::StringLiteral Name
std::map< std::string, std::string > OptionMap
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
llvm::Optional< llvm::Expected< tooling::AtomicChanges > > Result
Definition: Rename.cpp:36
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...