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/.
9 #ifndef LO_CLANG_SHARED_PLUGINS
14 #include "clang/AST/Attr.h"
15 #include "clang/Sema/SemaInternal.h" // warn_unused_function
22 public loplugin::FilteringPlugin
<InlineVisible
>
25 explicit InlineVisible(loplugin::InstantiationData
const & data
):
26 FilteringPlugin(data
) {}
29 { TraverseDecl(compiler
.getASTContext().getTranslationUnitDecl()); }
31 bool VisitFunctionDecl(FunctionDecl
const * decl
);
34 bool InlineVisible::VisitFunctionDecl(FunctionDecl
const * decl
) {
35 if (!ignoreLocation(decl
) && decl
->isInlineSpecified()) {
36 VisibilityAttr
* attr
= decl
->getAttr
<VisibilityAttr
>();
37 if (attr
!= nullptr && attr
->getVisibility() == VisibilityAttr::Default
)
40 DiagnosticsEngine::Warning
,
41 ("Function explicitly declared both inline and "
42 " visibility=default"),
44 << decl
->getSourceRange();
50 loplugin::Plugin::Registration
<InlineVisible
> inlinevisible("inlinevisible");
54 #endif // LO_CLANG_SHARED_PLUGINS
56 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */