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

2017-02-22 Thread David Blaikie via cfe-commits
On Tue, Feb 14, 2017 at 4:21 PM Mehdi AMINI via Phabricator via cfe-commits 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

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

2017-02-14 Thread Mehdi AMINI via Phabricator via cfe-commits
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

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

2016-10-28 Thread Keno Fischer via cfe-commits
loladiro planned changes to this revision. loladiro added a comment. Thanks for the review! Sorry, it's been a while since I wrote this code, so I'm not fluent in all the details, but I've replied below. I am not particularly partial to the name, so whatever you feel is best is ok with me. ==

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

2016-10-28 Thread Richard Smith via cfe-commits
rsmith added a comment. 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

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

2016-10-28 Thread Keno Fischer via cfe-commits
loladiro updated this revision to Diff 76256. loladiro added a comment. Fix for the corner case I found and add it as a test. Repository: rL LLVM https://reviews.llvm.org/D13330 Files: include/clang/Basic/Attr.td include/clang/Basic/AttrDocs.td include/clang/Basic/DiagnosticSemaKinds.t

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

2016-10-28 Thread Keno Fischer via cfe-commits
loladiro added a comment. I meant `template __attribute__((unique_instantiation)) int * static_separate_template::a_static_field;` of course, though we probably need a better diagnostic for the other spelling (which applies the attribute to the static_separate_template). I'll look into adding

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

2016-10-27 Thread Keno Fischer via cfe-commits
loladiro added a comment. I found a bug in this which I need to fix, but while I'm at it, in doing more testing on this, I came across the following corner case: template struct static_separate_template { typedef T element; static T *a_static_field; }; extern template struct

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

2016-10-27 Thread Keno Fischer via cfe-commits
loladiro set the repository for this revision to rL LLVM. loladiro updated this revision to Diff 76102. loladiro added a comment. Rebased on current master. Repository: rL LLVM https://reviews.llvm.org/D13330 Files: include/clang/Basic/Attr.td include/clang/Basic/AttrDocs.td include/cl

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

2016-10-27 Thread David Majnemer via cfe-commits
majnemer added a comment. I think this looks good but I'd like @rsmith to take a look. https://reviews.llvm.org/D13330 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2016-10-27 Thread Keno Fischer via cfe-commits
loladiro added a comment. I came across a situation again where this would be useful to have. I know this was approved, but looking it looks like I wanted @majnemer to have another look. https://reviews.llvm.org/D13330 ___ cfe-commits mailing list

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

2016-01-06 Thread Keno Fischer via cfe-commits
loladiro added a comment. Bumping this again. http://reviews.llvm.org/D13330 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2015-12-18 Thread Keno Fischer via cfe-commits
loladiro updated this revision to Diff 43218. loladiro added a comment. Rebased http://reviews.llvm.org/D13330 Files: include/clang/Basic/Attr.td include/clang/Basic/AttrDocs.td include/clang/Basic/DiagnosticSemaKinds.td include/clang/Sema/AttributeList.h include/clang/Sema/Sema.h l

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

2015-12-11 Thread Keno Fischer via cfe-commits
loladiro added a comment. @majnemer Do you like the new approach? Is there anything else to be done here? http://reviews.llvm.org/D13330 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commi

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

2015-12-07 Thread Keno Fischer via cfe-commits
loladiro updated this revision to Diff 42137. loladiro added a comment. Propagate unique instantiation attribute to children rather than later trying to look through the DeclContexts to see if we're contained in one that has the attribute. http://reviews.llvm.org/D13330 Files: include/clang

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

2015-12-07 Thread Keno Fischer via cfe-commits
loladiro updated this revision to Diff 42132. loladiro added a comment. Address David's concern about inner classes. David also suggested on IRC to propagate the unique instantiation attribute down rather than walking the context chain to check for the attribute. I'll try that out, but wanted to

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

2015-12-07 Thread Keno Fischer via cfe-commits
loladiro added inline comments. Comment at: lib/AST/ASTContext.cpp:8257-8266 @@ -8256,1 +8256,12 @@ +bool ASTContext::containedInUniqueInstantiation(const Decl *D) { + const RecordDecl *RD; + while ((RD = dyn_cast(D->getDeclContext( { +auto *CTSD = dyn_cast(RD); +i

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

2015-12-07 Thread David Majnemer via cfe-commits
majnemer added inline comments. Comment at: lib/AST/ASTContext.cpp:8257-8266 @@ -8256,1 +8256,12 @@ +bool ASTContext::containedInUniqueInstantiation(const Decl *D) { + const RecordDecl *RD; + while ((RD = dyn_cast(D->getDeclContext( { +auto *CTSD = dyn_cast(RD); +i

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

2015-12-07 Thread Keno Fischer via cfe-commits
loladiro updated this revision to Diff 42100. loladiro added a comment. Address stylistic concerns brought up by David http://reviews.llvm.org/D13330 Files: include/clang/AST/ASTContext.h include/clang/Basic/Attr.td include/clang/Basic/AttrDocs.td include/clang/Basic/DiagnosticSemaKinds

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

2015-12-07 Thread Keno Fischer via cfe-commits
loladiro added inline comments. Comment at: include/clang/Basic/AttrDocs.td:1736-1755 @@ -1722,2 +1735,22 @@ + +// Explicit template definition (in exactly ONE .cpp file) +template struct __attribute__((unique_instantiation)) my_template; + + +When the unique_instantiation

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

2015-12-07 Thread David Majnemer via cfe-commits
majnemer added inline comments. Comment at: include/clang/Basic/AttrDocs.td:1736-1755 @@ -1722,2 +1735,22 @@ + +// Explicit template definition (in exactly ONE .cpp file) +template struct __attribute__((unique_instantiation)) my_template; + + +When the unique_instantiation

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

2015-12-07 Thread Aaron Ballman via cfe-commits
aaron.ballman accepted this revision. aaron.ballman added a comment. This revision is now accepted and ready to land. LGTM, but please wait for David to sign off before committing. http://reviews.llvm.org/D13330 ___ cfe-commits mailing list cfe-comm

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

2015-12-04 Thread Keno Fischer via cfe-commits
loladiro added a comment. Bump, is there anything else that's needed here? http://reviews.llvm.org/D13330 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2015-11-26 Thread Keno Fischer via cfe-commits
loladiro updated this revision to Diff 41265. loladiro added a comment. Add support for variable templates http://reviews.llvm.org/D13330 Files: include/clang/AST/ASTContext.h include/clang/Basic/Attr.td include/clang/Basic/AttrDocs.td include/clang/Basic/DiagnosticSemaKinds.td includ

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

2015-11-26 Thread Keno Fischer via cfe-commits
loladiro updated this revision to Diff 41261. loladiro added a comment. Rebased and made the small suggested changes to the test cases. http://reviews.llvm.org/D13330 Files: include/clang/AST/ASTContext.h include/clang/Basic/Attr.td include/clang/Basic/AttrDocs.td include/clang/Basic/Di

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

2015-11-11 Thread Aaron Ballman via cfe-commits
aaron.ballman added a comment. Modulo the question you and David are discussing about variable templates (for which I don't have an answer handy), I just have a few small testing nits. Comment at: test/SemaCXX/unique-instantiations.cpp:24 @@ +23,3 @@ +template struct foo5;

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

2015-11-06 Thread Keno Fischer via cfe-commits
loladiro updated this revision to Diff 39627. loladiro updated the summary for this revision. loladiro added a comment. Address review feedback regarding diagnostic wording/expand tests to full text of diagnostic. http://reviews.llvm.org/D13330 Files: include/clang/AST/ASTContext.h include

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

2015-11-06 Thread Keno Fischer via cfe-commits
loladiro added inline comments. Comment at: include/clang/Basic/Attr.td:1463 @@ +1462,3 @@ + let Spellings = [GNU<"unique_instantiation">]; + let Subjects = SubjectList<[Function, CXXRecord], ErrorDiag>; + let Documentation = [UniqueInstantiationDocs]; loladiro

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

2015-11-06 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments. Comment at: include/clang/Basic/DiagnosticSemaKinds.td:2456 @@ -2450,1 +2455,3 @@ +def err_unique_instantiation_not_previous : Error< + "'unique_instantiation' attribute must be specified for all declarations and definitions of this explicit

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

2015-10-21 Thread Keno Fischer via cfe-commits
loladiro added inline comments. Comment at: include/clang/Basic/Attr.td:1463 @@ +1462,3 @@ + let Spellings = [GNU<"unique_instantiation">]; + let Subjects = SubjectList<[Function, CXXRecord], ErrorDiag>; + let Documentation = [UniqueInstantiationDocs]; majnemer

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

2015-10-21 Thread David Majnemer via cfe-commits
majnemer added inline comments. Comment at: include/clang/Basic/Attr.td:1463 @@ +1462,3 @@ + let Spellings = [GNU<"unique_instantiation">]; + let Subjects = SubjectList<[Function, CXXRecord], ErrorDiag>; + let Documentation = [UniqueInstantiationDocs]; They wor

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

2015-10-21 Thread Keno Fischer via cfe-commits
loladiro set the repository for this revision to rL LLVM. loladiro updated this revision to Diff 38039. loladiro added a comment. Address review comments. Repository: rL LLVM http://reviews.llvm.org/D13330 Files: include/clang/AST/ASTContext.h include/clang/Basic/Attr.td include/clang/

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

2015-10-21 Thread Keno Fischer via cfe-commits
loladiro added inline comments. Comment at: include/clang/Basic/Attr.td:1463 @@ +1462,3 @@ + let Spellings = [GNU<"unique_instantiation">]; + let Subjects = SubjectList<[Function, CXXRecord], ErrorDiag>; + let Documentation = [UniqueInstantiationDocs]; majnemer

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

2015-10-20 Thread David Majnemer via cfe-commits
majnemer added a subscriber: majnemer. Comment at: include/clang/Basic/Attr.td:1463 @@ +1462,3 @@ + let Spellings = [GNU<"unique_instantiation">]; + let Subjects = SubjectList<[Function, CXXRecord], ErrorDiag>; + let Documentation = [UniqueInstantiationDocs]; W

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

2015-10-20 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments. Comment at: include/clang/Basic/AttrDocs.td:1638 @@ +1637,3 @@ + +Note that to ensure correct execution the user MUST make certain that no +other translation unit has an implicit instantiation of the same entity. In > I don't t

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

2015-10-15 Thread Keno Fischer via cfe-commits
loladiro updated this revision to Diff 37555. loladiro added a comment. Address review comments and clang-format. http://reviews.llvm.org/D13330 Files: include/clang/AST/ASTContext.h include/clang/Basic/Attr.td include/clang/Basic/AttrDocs.td include/clang/Basic/DiagnosticSemaKinds.td

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

2015-10-15 Thread Keno Fischer via cfe-commits
loladiro added inline comments. Comment at: include/clang/Basic/AttrDocs.td:1638 @@ +1637,3 @@ + +Note that to ensure correct execution the user MUST make certain that no +other translation unit has an implicit instantiation of the same entity. In aaron.ballman wr

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

2015-10-13 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments. Comment at: include/clang/Basic/Attr.td:1463 @@ +1462,3 @@ + let Spellings = [GNU<"unique_instantiation">]; + let Subjects = SubjectList<[Function, CXXRecord], ErrorDiag, "ExpectedFunctionOrClass">; + let Documentation = [UniqueInstantiatio

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

2015-10-04 Thread Keno Fischer via cfe-commits
loladiro added a comment. Ok, I have tested this more extensively now. I'm happy with the results. Here's a patch that applies this to LLVM for example: https://gist.github.com/Keno/79b08a4b187c4d950dd0 Before: $llvm-objdump -weak-bind libLLVM-3.8svn.dylib | wc -l 300 After: $llvm

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

2015-10-04 Thread Keno Fischer via cfe-commits
loladiro updated this revision to Diff 36476. loladiro added a comment. Also set the correct linkage on vtables of classes with the new attribute. http://reviews.llvm.org/D13330 Files: include/clang/AST/ASTContext.h include/clang/Basic/Attr.td include/clang/Basic/AttrDocs.td include/cla

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

2015-10-03 Thread Keno Fischer via cfe-commits
loladiro removed rL LLVM as the repository for this revision. loladiro updated this revision to Diff 36459. loladiro added a comment. Rebased, added support for unique_instantiation on explicit function templates and fix the case where one record is embedded in another and the outer is explicitl

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

2015-10-03 Thread Keno Fischer via cfe-commits
loladiro added a comment. Thoughts on allowing this attribute to be specified on the templated class itself, with the intention of never allowing any implicit instantiation? As an example, consider SymbolTableListTraits in LLVM. It can only ever be used as an explicit instantiation (because the

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

2015-10-02 Thread Aaron Ballman via cfe-commits
On Fri, Oct 2, 2015 at 1:26 AM, Keno Fischer wrote: > loladiro added inline comments. > > > Comment at: include/clang/Basic/Attr.td:1462 > @@ +1461,3 @@ > +def UniqueInstantiation : InheritableAttr { > + let Spellings = [GCC<"unique_instantiation">]; > + let Subjects = SubjectLi

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

2015-10-02 Thread Keno Fischer via cfe-commits
loladiro updated this revision to Diff 36332. loladiro added a comment. Address review comments. I had to add a special case to checkNewAttributesAfterDef if we want to use attribute merging for explicit template instantiations, because the Microsoft ABI allows adding dll attributes to the expl

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

2015-10-01 Thread Keno Fischer via cfe-commits
loladiro added inline comments. Comment at: include/clang/Basic/Attr.td:1462 @@ +1461,3 @@ +def UniqueInstantiation : InheritableAttr { + let Spellings = [GCC<"unique_instantiation">]; + let Subjects = SubjectList<[CXXRecord]>; loladiro wrote: > aaron.ballman wr

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

2015-10-01 Thread Aaron Ballman via cfe-commits
On Thu, Oct 1, 2015 at 1:09 PM, Keno Fischer wrote: > loladiro added a comment. > > Thanks for the quick review. > > > > Comment at: include/clang/Basic/Attr.td:1462 > @@ +1461,3 @@ > +def UniqueInstantiation : InheritableAttr { > + let Spellings = [GCC<"unique_instantiation">];

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

2015-10-01 Thread Keno Fischer via cfe-commits
loladiro added a comment. Thanks for the quick review. Comment at: include/clang/Basic/Attr.td:1462 @@ +1461,3 @@ +def UniqueInstantiation : InheritableAttr { + let Spellings = [GCC<"unique_instantiation">]; + let Subjects = SubjectList<[CXXRecord]>; aaron.bal

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

2015-10-01 Thread Aaron Ballman via cfe-commits
aaron.ballman added a subscriber: aaron.ballman. aaron.ballman added reviewers: rsmith, aaron.ballman. Comment at: include/clang/Basic/Attr.td:1462 @@ +1461,3 @@ +def UniqueInstantiation : InheritableAttr { + let Spellings = [GCC<"unique_instantiation">]; + let Subjects = Subjec

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

2015-09-30 Thread Keno Fischer via cfe-commits
loladiro created this revision. loladiro added a reviewer: doug.gregor. loladiro added a subscriber: cfe-commits. loladiro set the repository for this revision to rL LLVM. This implements a proposal by Doug Gregor on cfe-dev a couple of years ago, to allow the compiler to emit strong symbols for