[PATCH] D44826: Add -Wunused-using, a warning that finds unused using declarations.
David Blaikie via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 23 11:18:33 PDT 2018
While implementing the warning is great (wonder if there's any codebase
that isn't -Wunused-using clean, that we could use to compare Clang and
GCC's behavior broadly - make sure it's catching the same cases (or
justify/investigate differences)) - and using it to motivate the debug info
is an improvement to the debug info - it won't quite address all the wasted
debug info, unfortunately :/
Consider this:
namespace a {
struct b;
};
namespace x {
using a::b;
inline void f(b*) {
}
}
Now the using declaration is used, but if 'f' is never called in this
translation unit, it's a bit weird to produce debug info for the using decl
and could still substantially bloat debug info. (indeed most of the bloat
that the using decl/directive debug info is producing is probably from
directives that are used, but not in a way that's relevant to a certain
translation unit)
I've not looked at the change yet, but if it's particularly
expensive/complicated to wire up the debug info side, it might not be worth
it given it's probably not a significant savings & somewhat of a dead-end
compared to what would be needed for a more complete fix. But I guess it's
probably not expensive/complicated, so probably some fine low hanging fruit
to pick until a more complete fix/improvement is implemented.
On Fri, Mar 23, 2018 at 8:22 AM Carlos Alberto Enciso via Phabricator <
reviews at reviews.llvm.org> wrote:
> CarlosAlbertoEnciso added a comment.
>
> In https://reviews.llvm.org/D44826#1046671, @erichkeane wrote:
>
> > My opinion matters less than @rsmith or @dblaikie on the review, but it
> seems to me that Typedef and Using are SO similar that the implementations
> should just be combined. You'd likely have to change a couple of types
> along the way to be more generic, but the implementations are essentially a
> copy/paste of eachother.
>
>
> That is a very valid point and it simplifies quite a lot the patch.
>
> If the other reviewers do not have any objection, I will combine both
> implementations and update the uploaded patch.
>
> Thanks,
> Carlos
>
>
> Repository:
> rC Clang
>
> https://reviews.llvm.org/D44826
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180323/cc415ad8/attachment.html>
More information about the cfe-commits
mailing list