brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.8 KiB · 3adaf50 Raw
50 lines · c
1//===----------------------------------------------------------------------===//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-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_IDENTIFIERLENGTHCHECK_H10#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_IDENTIFIERLENGTHCHECK_H11 12#include "../ClangTidyCheck.h"13#include "llvm/Support/Regex.h"14 15namespace clang::tidy::readability {16 17/// Warns about identifiers names whose length is too short.18///19/// For the user-facing documentation see:20/// https://clang.llvm.org/extra/clang-tidy/checks/readability/identifier-length.html21class IdentifierLengthCheck : public ClangTidyCheck {22public:23  IdentifierLengthCheck(StringRef Name, ClangTidyContext *Context);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  const unsigned MinimumVariableNameLength;30  const unsigned MinimumLoopCounterNameLength;31  const unsigned MinimumExceptionNameLength;32  const unsigned MinimumParameterNameLength;33 34  std::string IgnoredVariableNamesInput;35  llvm::Regex IgnoredVariableNames;36 37  std::string IgnoredLoopCounterNamesInput;38  llvm::Regex IgnoredLoopCounterNames;39 40  std::string IgnoredExceptionVariableNamesInput;41  llvm::Regex IgnoredExceptionVariableNames;42 43  std::string IgnoredParameterNamesInput;44  llvm::Regex IgnoredParameterNames;45};46 47} // namespace clang::tidy::readability48 49#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_IDENTIFIERLENGTHCHECK_H50