1 //===--- IdentifierLengthCheck.h - clang-tidy ---------------------*- C++
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
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"
18 namespace readability
{
20 /// Warns about identifiers names whose length is too short.
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
{
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
;
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
54 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_IDENTIFIERLENGTHCHECK_H