RedundantAccessSpecifiersCheck.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. //===--- RedundantAccessSpecifiersCheck.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_REDUNDANTACCESSSPECIFIERSCHECK_H
  9. #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_REDUNDANTACCESSSPECIFIERSCHECK_H
  10. #include "../ClangTidyCheck.h"
  11. namespace clang::tidy::readability {
  12. /// Detects redundant access specifiers inside classes, structs, and unions.
  13. ///
  14. /// For the user-facing documentation see:
  15. /// http://clang.llvm.org/extra/clang-tidy/checks/readability/redundant-access-specifiers.html
  16. class RedundantAccessSpecifiersCheck : public ClangTidyCheck {
  17. public:
  18. RedundantAccessSpecifiersCheck(StringRef Name, ClangTidyContext *Context)
  19. : ClangTidyCheck(Name, Context),
  20. CheckFirstDeclaration(
  21. Options.getLocalOrGlobal("CheckFirstDeclaration", false)) {}
  22. bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
  23. return LangOpts.CPlusPlus;
  24. }
  25. void registerMatchers(ast_matchers::MatchFinder *Finder) override;
  26. void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
  27. private:
  28. const bool CheckFirstDeclaration;
  29. };
  30. } // namespace clang::tidy::readability
  31. #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_REDUNDANTACCESSSPECIFIERSCHECK_H