NamedParameterCheck.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. //===--- NamedParameterCheck.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. #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_NAMEDPARAMETERCHECK_H
  9. #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_NAMEDPARAMETERCHECK_H
  10. #include "../ClangTidyCheck.h"
  11. namespace clang::tidy::readability {
  12. /// Find functions with unnamed arguments.
  13. ///
  14. /// The check implements the following rule originating in the Google C++ Style
  15. /// Guide:
  16. ///
  17. /// https://google.github.io/styleguide/cppguide.html#Function_Declarations_and_Definitions
  18. ///
  19. /// All parameters should be named, with identical names in the declaration and
  20. /// implementation.
  21. ///
  22. /// Corresponding cpplint.py check name: 'readability/function'.
  23. class NamedParameterCheck : public ClangTidyCheck {
  24. public:
  25. NamedParameterCheck(StringRef Name, ClangTidyContext *Context)
  26. : ClangTidyCheck(Name, Context) {}
  27. void registerMatchers(ast_matchers::MatchFinder *Finder) override;
  28. void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
  29. std::optional<TraversalKind> getCheckTraversalKind() const override {
  30. return TK_IgnoreUnlessSpelledInSource;
  31. }
  32. };
  33. } // namespace clang::tidy::readability
  34. #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_NAMEDPARAMETERCHECK_H