blob: 4ded73220b2d7846dfe7f9c1bc2bebeded80a344 [file] [log] [blame]
Olivier Deprezf4ef2d02021-04-20 13:36:24 +02001//===--- 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
14namespace clang {
15namespace tidy {
16namespace modernize {
17
18class UseAutoCheck : public ClangTidyCheck {
19public:
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
28private:
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