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
15 #include "clang/AST/Attr.h"
16 #include "clang/Sema/SemaInternal.h" // warn_unused_function
23 public loplugin::FilteringPlugin
<InlineVisible
>
26 explicit InlineVisible(loplugin::InstantiationData
const & data
):
27 FilteringPlugin(data
) {}
30 { TraverseDecl(compiler
.getASTContext().getTranslationUnitDecl()); }
32 bool VisitFunctionDecl(FunctionDecl
const * decl
);
35 bool InlineVisible::VisitFunctionDecl(FunctionDecl
const * decl
) {
36 if (!ignoreLocation(decl
) && decl
->isInlineSpecified()) {
37 VisibilityAttr
* attr
= decl
->getAttr
<VisibilityAttr
>();
38 if (attr
!= nullptr && attr
->getVisibility() == VisibilityAttr::Default
)
41 DiagnosticsEngine::Warning
,
42 ("Function explicitly declared both inline and "
43 " visibility=default"),
45 << decl
->getSourceRange();
51 loplugin::Plugin::Registration
<InlineVisible
> inlinevisible("inlinevisible");
55 #endif // LO_CLANG_SHARED_PLUGINS
57 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */