[PATCH] D89212: PR47663: Warn if an entity becomes weak after its first use.

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 12 00:04:57 PDT 2020


rjmccall added a comment.

It does seem necessary to distinguish weak definitions from weak non-definitions, but that's completely reasonable — those two cases essentially act like totally different attributes that happen to be written with the same spelling.  If we acknowledge that, I think that gives us a straightforward rule: the problem is adding `weak` to a non-definition after a previous non-weak non-definition.

I think the only reasonable solution for aliases is to assume they don't happen, given the language rules.  We could add an attribute to allow, but I'm not sure anyone would use it: in practice I think it's extremely uncommon to define an external symbol as an alias of another external symbol.  Maybe we should just document alongside the alias attribute that the behavior of equality comparisons involving aliased symbols may be inconsistent between translation units.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89212/new/

https://reviews.llvm.org/D89212



More information about the cfe-commits mailing list