Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:36:20

0001 //===--- IntegerTypesCheck.h - clang-tidy -----------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GOOGLE_INTEGERTYPESCHECK_H
0010 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GOOGLE_INTEGERTYPESCHECK_H
0011 
0012 #include "../ClangTidyCheck.h"
0013 
0014 #include <memory>
0015 
0016 namespace clang {
0017 
0018 class IdentifierTable;
0019 
0020 namespace tidy::google::runtime {
0021 
0022 /// Finds uses of `short`, `long` and `long long` and suggest replacing them
0023 /// with `u?intXX(_t)?`.
0024 ///
0025 /// Corresponding cpplint.py check: 'runtime/int'.
0026 ///
0027 /// For the user-facing documentation see:
0028 /// http://clang.llvm.org/extra/clang-tidy/checks/google/runtime-int.html
0029 class IntegerTypesCheck : public ClangTidyCheck {
0030 public:
0031   IntegerTypesCheck(StringRef Name, ClangTidyContext *Context);
0032   bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
0033     return LangOpts.CPlusPlus && !LangOpts.ObjC;
0034   }
0035   void registerMatchers(ast_matchers::MatchFinder *Finder) override;
0036   void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
0037   void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
0038   std::optional<TraversalKind> getCheckTraversalKind() const override {
0039     return TK_IgnoreUnlessSpelledInSource;
0040   }
0041 
0042 private:
0043   const StringRef UnsignedTypePrefix;
0044   const StringRef SignedTypePrefix;
0045   const StringRef TypeSuffix;
0046 
0047   std::unique_ptr<IdentifierTable> IdentTable;
0048 };
0049 
0050 } // namespace tidy::google::runtime
0051 } // namespace clang
0052 
0053 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GOOGLE_INTEGERTYPESCHECK_H