[PATCH] D13330: Implement __attribute__((unique_instantiation))

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 22 11:12:59 PST 2017


On Tue, Feb 14, 2017 at 4:21 PM Mehdi AMINI via Phabricator via cfe-commits
<cfe-commits at lists.llvm.org> wrote:

> mehdi_amini added a comment.
>
> In https://reviews.llvm.org/D13330#582607, @rsmith wrote:
>
> > I think this attribute is poorly named. Explicit instantiation
> definitions are *already* required to be globally unique; see
> [temp.spec]/5.1:
> >
> > "For a given template and a given set of template-arguments, an explicit
> instantiation definition shall appear at most once in a program"
>
>
> So what prevents from emitting these as "strong" symbols without any
> attribute? We should have the guarantee that we have only one such copy in
> the program.
>

If I recall correctly - the requirement is that if there's an explicit
instantiation declaration there must be an explicit instantiation
definition, but it's not required that all sites required an instantiation
should see/have an explicit instantiation declaration. So you might have
some implicit instantiations scattered around, then one explicit
instantiation. If the explicit instantiation were strong, you'd get
duplicate symbol problems in your link.

(that's my naive/vague understanding anyway)


>
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D13330
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170222/99445b15/attachment.html>


More information about the cfe-commits mailing list