Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame] | 1 | //===--- UseAutoCheck.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_MODERNIZE_USE_AUTO_H |
| 10 | #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_USE_AUTO_H |
| 11 | |
| 12 | #include "../ClangTidyCheck.h" |
| 13 | |
| 14 | namespace clang { |
| 15 | namespace tidy { |
| 16 | namespace modernize { |
| 17 | |
| 18 | class UseAutoCheck : public ClangTidyCheck { |
| 19 | public: |
| 20 | UseAutoCheck(StringRef Name, ClangTidyContext *Context); |
| 21 | bool isLanguageVersionSupported(const LangOptions &LangOpts) const override { |
| 22 | return LangOpts.CPlusPlus; |
| 23 | } |
| 24 | void storeOptions(ClangTidyOptions::OptionMap &Opts) override; |
| 25 | void registerMatchers(ast_matchers::MatchFinder *Finder) override; |
| 26 | void check(const ast_matchers::MatchFinder::MatchResult &Result) override; |
| 27 | |
| 28 | private: |
| 29 | void replaceIterators(const DeclStmt *D, ASTContext *Context); |
| 30 | void replaceExpr(const DeclStmt *D, ASTContext *Context, |
| 31 | llvm::function_ref<QualType(const Expr *)> GetType, |
| 32 | StringRef Message); |
| 33 | |
| 34 | const unsigned int MinTypeNameLength; |
| 35 | const bool RemoveStars; |
| 36 | }; |
| 37 | |
| 38 | } // namespace modernize |
| 39 | } // namespace tidy |
| 40 | } // namespace clang |
| 41 | |
| 42 | #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_USE_AUTO_H |