1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
15 public RecursiveASTVisitor
<PrivateBase
>, public loplugin::Plugin
18 explicit PrivateBase(loplugin::InstantiationData
const & data
): Plugin(data
)
23 bool VisitCXXRecordDecl(CXXRecordDecl
const * decl
);
26 void PrivateBase::run() {
27 if (compiler
.getLangOpts().CPlusPlus
) {
28 TraverseDecl(compiler
.getASTContext().getTranslationUnitDecl());
32 bool PrivateBase::VisitCXXRecordDecl(CXXRecordDecl
const * decl
) {
33 if (ignoreLocation(decl
) || !decl
->isThisDeclarationADefinition()
34 || decl
->getTagKind() != TTK_Class
)
38 for (auto i
= decl
->bases_begin(); i
!= decl
->bases_end(); ++i
) {
39 if (i
->getAccessSpecifierAsWritten() == AS_none
) {
41 DiagnosticsEngine::Warning
,
42 "base class is private by default; explicitly give an access"
45 << i
->getSourceRange();
51 loplugin::Plugin::Registration
<PrivateBase
> X("privatebase");
55 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */