|
|
|||
File indexing completed on 2026-05-10 08:36:20
0001 //===--- NonPrivateMemberVariablesInClassesCheck.h - clang-tidy -*- C++ -*-===// 0002 // 0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 0004 // See https://llvm.org/LICENSE.txt for license information. 0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 0006 // 0007 //===----------------------------------------------------------------------===// 0008 0009 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_NONPRIVATEMEMBERVARIABLESINCLASSESCHECK_H 0010 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_NONPRIVATEMEMBERVARIABLESINCLASSESCHECK_H 0011 0012 #include "../ClangTidyCheck.h" 0013 0014 namespace clang::tidy::misc { 0015 0016 /// This checker finds classes that not only contain the data 0017 /// (non-static member variables), but also have logic (non-static member 0018 /// functions), and diagnoses all member variables that have any other scope 0019 /// other than `private`. They should be made `private`, and manipulated 0020 /// exclusively via the member functions. 0021 /// 0022 /// Optionally, classes with all member variables being `public` could be 0023 /// ignored and optionally all `public` member variables could be ignored. 0024 /// 0025 /// For the user-facing documentation see: 0026 /// http://clang.llvm.org/extra/clang-tidy/checks/misc/non-private-member-variables-in-classes.html 0027 class NonPrivateMemberVariablesInClassesCheck : public ClangTidyCheck { 0028 public: 0029 NonPrivateMemberVariablesInClassesCheck(StringRef Name, 0030 ClangTidyContext *Context); 0031 bool isLanguageVersionSupported(const LangOptions &LangOpts) const override { 0032 return LangOpts.CPlusPlus; 0033 } 0034 void storeOptions(ClangTidyOptions::OptionMap &Opts) override; 0035 void registerMatchers(ast_matchers::MatchFinder *Finder) override; 0036 void check(const ast_matchers::MatchFinder::MatchResult &Result) override; 0037 0038 private: 0039 const bool IgnoreClassesWithAllMemberVariablesBeingPublic; 0040 const bool IgnorePublicMemberVariables; 0041 }; 0042 0043 } // namespace clang::tidy::misc 0044 0045 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_NONPRIVATEMEMBERVARIABLESINCLASSESCHECK_H
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|