[PATCH] D44826: Add -Wunused-using, a warning that finds unused using declarations.

David Blaikie via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 23 11:19:23 PDT 2018


dblaikie added a subscriber: CarlosAlbertoEnciso.
dblaikie added a comment.

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.


Repository:
  rC Clang

https://reviews.llvm.org/D44826





More information about the cfe-commits mailing list