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/.
10 #ifndef LO_CLANG_SHARED_PLUGINS
17 public loplugin::FilteringPlugin
<PrivateBase
>
20 explicit PrivateBase(loplugin::InstantiationData
const & data
): FilteringPlugin(data
)
25 bool VisitCXXRecordDecl(CXXRecordDecl
const * decl
);
28 void PrivateBase::run() {
29 if (compiler
.getLangOpts().CPlusPlus
) {
30 TraverseDecl(compiler
.getASTContext().getTranslationUnitDecl());
34 bool PrivateBase::VisitCXXRecordDecl(CXXRecordDecl
const * decl
) {
35 if (ignoreLocation(decl
) || !decl
->isThisDeclarationADefinition()
36 || decl
->getTagKind() != TTK_Class
)
40 for (auto i
= decl
->bases_begin(); i
!= decl
->bases_end(); ++i
) {
41 if (i
->getAccessSpecifierAsWritten() == AS_none
) {
43 DiagnosticsEngine::Warning
,
44 "base class is private by default; explicitly give an access"
46 compat::getBeginLoc(i
))
47 << i
->getSourceRange();
53 loplugin::Plugin::Registration
<PrivateBase
> privatebase("privatebase");
57 #endif // LO_CLANG_SHARED_PLUGINS
59 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */