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/.
13 #include "clang/AST/Attr.h"
14 #include "clang/Sema/SemaInternal.h" // warn_unused_function
22 public RecursiveASTVisitor
<InlineVisible
>, public loplugin::Plugin
25 explicit InlineVisible(InstantiationData
const & data
): Plugin(data
) {}
28 { TraverseDecl(compiler
.getASTContext().getTranslationUnitDecl()); }
30 bool VisitFunctionDecl(FunctionDecl
const * decl
);
33 bool InlineVisible::VisitFunctionDecl(FunctionDecl
const * decl
) {
34 if (!ignoreLocation(decl
) && decl
->isInlineSpecified()) {
35 VisibilityAttr
* attr
= decl
->getAttr
<VisibilityAttr
>();
36 if (attr
!= nullptr && attr
->getVisibility() == VisibilityAttr::Default
)
39 DiagnosticsEngine::Warning
,
40 ("Function explicitly declared both inline and "
41 " visibility=default"),
43 << decl
->getSourceRange();
49 loplugin::Plugin::Registration
<InlineVisible
> X("inlinevisible");
53 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */