The following submission under review
https://reviews.llvm.org/D44826
introduced an option to warn on unused 'using declarations'.
But it can't detect cases like
namespace N { void foo(); int var; } using N::foo; <-- warning using N::var; <-- MISSING warning void A() { using N::foo; <-- warning using N::var; <-- warning } void B() { N::var = 1; }
One of the reviewers (dblaikie) mentioned the possible cause for that limitation.
You mention a missed case in the description - where the target of a using decl is used and that causes the unused-using not to warn about the using decl? That seems like a big limitation. Does that mean the 'used' bit is being tracked in the wrong place, on the target of the using decl instead of on the using decl itself?
This patch, set the 'Referenced' bit for any associated 'usings' for a referenced
declaration. The goal is to create additional information to help in the reduction
of the debug information size, which is affected by the extra generation of
'non-referenced' declarations.
Note:
To solve the debug information issue (size), there are 3 pieces of
work:
- Set the 'referenced' bit for 'usings'. This patch.
- Review the - Wunused-usings and -Wunused-local-typedefs implementation to take advantage of new 'Referenced' settings.
- Do not generate debug information for the non-referenced using.
Thanks for your view on this issue and on the general approach.
Pass in the FoundDecl instead of a scope specifier and an expression.