blob: 7bc44250128fcd8b81ca4ba2baa5201b06379392 [file] [log] [blame]
//===--- NonPrivateMemberVariablesInClassesCheck.h - clang-tidy -*- C++ -*-===//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#include "../ClangTidyCheck.h"
namespace clang {
namespace tidy {
namespace misc {
/// This checker finds classes that not only contain the data
/// (non-static member variables), but also have logic (non-static member
/// functions), and diagnoses all member variables that have any other scope
/// other than `private`. They should be made `private`, and manipulated
/// exclusively via the member functions.
/// Optionally, classes with all member variables being `public` could be
/// ignored and optionally all `public` member variables could be ignored.
/// For the user-facing documentation see:
class NonPrivateMemberVariablesInClassesCheck : public ClangTidyCheck {
NonPrivateMemberVariablesInClassesCheck(StringRef Name,
ClangTidyContext *Context);
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
const bool IgnoreClassesWithAllMemberVariablesBeingPublic;
const bool IgnorePublicMemberVariables;
} // namespace misc
} // namespace tidy
} // namespace clang