summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-06-09 12:44:12 +0200
committerStephan Bergmann <sbergman@redhat.com>2015-06-09 12:44:31 +0200
commit623359af236ab8497d4fac34e112a8b9b7b291f2 (patch)
treeb30715649b146a7ef551c1c3db357051925eb331 /compilerplugins
parent46a76be3a13ad501e4d09da652f551b2c621e685 (diff)
loplugin:unreffun: workaround for visibility-adding redecls
Change-Id: Ic18b44942f4fe02083c0e8167e8c8d4205e66abf
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/unreffun.cxx11
1 files changed, 11 insertions, 0 deletions
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())