diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2019-11-15 12:59:31 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-11-15 17:55:00 +0100 |
commit | ef57b9cd3c4c37fe70b7bc89361393f6f8b36d07 (patch) | |
tree | 7864540c28d18a4ed6efc449478992e636b5cd25 /compilerplugins/clang/external.cxx | |
parent | 1872b44c9a2ee2bd00be54c6c310b72579d7a47f (diff) |
loplugin:external: Note all other declarations of the same entity
...not just those that came before
Change-Id: Ib10ca34cb2ee63124999d56bb00d94f000f33ea1
Reviewed-on: https://gerrit.libreoffice.org/82782
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'compilerplugins/clang/external.cxx')
-rw-r--r-- | compilerplugins/clang/external.cxx | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/compilerplugins/clang/external.cxx b/compilerplugins/clang/external.cxx index fe4328c1187b..442d174bd15b 100644 --- a/compilerplugins/clang/external.cxx +++ b/compilerplugins/clang/external.cxx @@ -295,9 +295,13 @@ private: decl->getLocation()) << (typedefed != nullptr) << (typedefed == nullptr ? decl : typedefed) << canStatic << (canStatic && canUnnamed) << canUnnamed << decl->getSourceRange(); - for (auto d = decl->getPreviousDecl(); d != nullptr; d = d->getPreviousDecl()) + for (auto d = decl->redecls_begin(); d != decl->redecls_end(); ++d) { - report(DiagnosticsEngine::Note, "previous declaration is here", d->getLocation()) + if (*d == decl) + { + continue; + } + report(DiagnosticsEngine::Note, "another declaration is here", d->getLocation()) << d->getSourceRange(); } //TODO: Class template specializations can be in the enclosing namespace, so no need to |