From daf4c39780b48ee2d9ade4afccd41e3d7efcbeb4 Mon Sep 17 00:00:00 2001
From: Stephan Bergmann <sbergman@redhat.com>
Date: Tue, 9 Jun 2015 12:44:12 +0200
Subject: [PATCH 034/398] loplugin:unreffun: workaround for visibility-adding
redecls
Change-Id: Ic18b44942f4fe02083c0e8167e8c8d4205e66abf
(cherry picked from commit 623359af236ab8497d4fac34e112a8b9b7b291f2)
---
compilerplugins/clang/unreffun.cxx | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/compilerplugins/clang/unreffun.cxx b/compilerplugins/clang/unreffun.cxx
index 3b9c616414b3..5295ca4376b0 100644
--- a/compilerplugins/clang/unreffun.cxx
+++ b/compilerplugins/clang/unreffun.cxx
@@ -87,6 +87,17 @@ bool UnrefFun::VisitFunctionDecl(FunctionDecl const * decl) {
{
Decl const * prev = getPreviousNonFriendDecl(decl);
if (prev != nullptr/* && prev != decl->getPrimaryTemplate()*/) {
+ // Workaround for redeclarations that introduce visiblity attributes
+ // (as is done with
+ //
+ // SAL_DLLPUBLIC_EXPORT GType lok_doc_view_get_type();
+ //
+ // in libreofficekit/source/gtk/lokdocview.cxx):
+ if (decl->getAttr<VisibilityAttr>() != nullptr
+ && prev->getAttr<VisibilityAttr>() == nullptr)
+ {
+ return true;
+ }
report(
DiagnosticsEngine::Warning,
"redundant function%0 redeclaration", decl->getLocation())
--
2.12.0