[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang-tools-extra / clang-tidy / readability / IdentifierLengthCheck.h
blobb23d95db67ea8d51cf361318da324fcfdbd7a09c
1 //===--- IdentifierLengthCheck.h - clang-tidy ---------------------*- C++
2 //-*-===//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_IDENTIFIERLENGTHCHECK_H
11 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_IDENTIFIERLENGTHCHECK_H
13 #include "../ClangTidyCheck.h"
14 #include "llvm/Support/Regex.h"
16 namespace clang {
17 namespace tidy {
18 namespace readability {
20 /// Warns about identifiers names whose length is too short.
21 ///
22 /// For the user-facing documentation see:
23 /// http://clang.llvm.org/extra/clang-tidy/checks/readability/identifier-length.html
24 class IdentifierLengthCheck : public ClangTidyCheck {
25 public:
26 IdentifierLengthCheck(StringRef Name, ClangTidyContext *Context);
27 void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
28 void registerMatchers(ast_matchers::MatchFinder *Finder) override;
29 void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
31 private:
32 const unsigned MinimumVariableNameLength;
33 const unsigned MinimumLoopCounterNameLength;
34 const unsigned MinimumExceptionNameLength;
35 const unsigned MinimumParameterNameLength;
37 std::string IgnoredVariableNamesInput;
38 llvm::Regex IgnoredVariableNames;
40 std::string IgnoredLoopCounterNamesInput;
41 llvm::Regex IgnoredLoopCounterNames;
43 std::string IgnoredExceptionVariableNamesInput;
44 llvm::Regex IgnoredExceptionVariableNames;
46 std::string IgnoredParameterNamesInput;
47 llvm::Regex IgnoredParameterNames;
50 } // namespace readability
51 } // namespace tidy
52 } // namespace clang
54 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_IDENTIFIERLENGTHCHECK_H