[PATCH] D16989: Change interpretation of function definition in friend declaration of template class.

2016-10-04 Thread Serge Pavlov via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL283207: Do not find friend function definitions inside non-instantiated class. (authored by sepavloff). Changed prior to commit: https://reviews.llvm.org/D16989?vs=70134=73440#toc Repository: rL

[PATCH] D16989: Change interpretation of function definition in friend declaration of template class.

2016-10-03 Thread Richard Smith via cfe-commits
rsmith accepted this revision. rsmith added a comment. This revision is now accepted and ready to land. A couple of comment nits, then this LGTM. Thanks! > SemaDecl.cpp:8659-8664 > + // void func(); > + // template class C1 { friend void func() { } }; > + // template class

Re: [PATCH] D16989: Change interpretation of function definition in friend declaration of template class.

2016-10-03 Thread Serge Pavlov via cfe-commits
Ping. Thanks, --Serge 2016-09-16 23:17 GMT+07:00 Serge Pavlov : > Ping. > > Thanks, > --Serge > > 2016-09-08 20:43 GMT+07:00 Serge Pavlov : > >> Any feedback? >> >> Thanks, >> --Serge >> >> 2016-09-02 13:11 GMT+07:00 Serge Pavlov :

Re: [PATCH] D16989: Change interpretation of function definition in friend declaration of template class.

2016-09-16 Thread Serge Pavlov via cfe-commits
Ping. Thanks, --Serge 2016-09-08 20:43 GMT+07:00 Serge Pavlov : > Any feedback? > > Thanks, > --Serge > > 2016-09-02 13:11 GMT+07:00 Serge Pavlov : > >> sepavloff updated this revision to Diff 70134. >> sepavloff marked an inline comment as done. >>

Re: [PATCH] D16989: Change interpretation of function definition in friend declaration of template class.

2016-09-02 Thread Serge Pavlov via cfe-commits
sepavloff updated this revision to Diff 70134. sepavloff marked an inline comment as done. sepavloff added a comment. Updated patch Rewrite the condition in shouldLinkDependentDeclWithPrevious in more compact form. https://reviews.llvm.org/D16989 Files: include/clang/Sema/Sema.h

Re: [PATCH] D16989: Change interpretation of function definition in friend declaration of template class.

2016-09-02 Thread Serge Pavlov via cfe-commits
sepavloff marked an inline comment as done. Comment at: lib/Sema/SemaDecl.cpp:8652 @@ +8651,3 @@ +/// +bool Sema::shouldLinkDependentDeclWithPrevious(Decl *D, Decl *PrevDecl) { + DeclContext *LexicalDC = D->getLexicalDeclContext(); rsmith wrote: > Most of the

Re: [PATCH] D16989: Change interpretation of function definition in friend declaration of template class.

2016-09-01 Thread Richard Smith via cfe-commits
rsmith added inline comments. Comment at: lib/Sema/SemaDecl.cpp:8652 @@ +8651,3 @@ +/// +bool Sema::shouldLinkDependentDeclWithPrevious(Decl *D, Decl *PrevDecl) { + DeclContext *LexicalDC = D->getLexicalDeclContext(); Most of the logic in this function can be

Re: [PATCH] D16989: Change interpretation of function definition in friend declaration of template class.

2016-08-29 Thread Serge Pavlov via cfe-commits
sepavloff updated this revision to Diff 69595. sepavloff added a comment. Updated patch Added missing checks for forward declarations in `shouldLinkDependentDeclWithPrevious`. Added test case from an ancient bug report. https://reviews.llvm.org/D16989 Files: include/clang/Sema/Sema.h

Re: [PATCH] D16989: Change interpretation of function definition in friend declaration of template class.

2016-08-29 Thread Serge Pavlov via cfe-commits
sepavloff marked an inline comment as done. Comment at: lib/Sema/SemaDecl.cpp:8657-8658 @@ +8656,4 @@ + DeclContext *SemanticDC = D->getDeclContext(); + if (SemanticDC->isDependentContext()) +return false; + // Get here only for out-of-line declarations: lexical context is

Re: [PATCH] D16989: Change interpretation of function definition in friend declaration of template class.

2016-08-23 Thread Richard Smith via cfe-commits
rsmith added inline comments. Comment at: lib/Sema/SemaDecl.cpp:8657-8658 @@ +8656,4 @@ + DeclContext *SemanticDC = D->getDeclContext(); + if (SemanticDC->isDependentContext()) +return false; + // Get here only for out-of-line declarations: lexical context is dependent,

Re: [PATCH] D16989: Change interpretation of function definition in friend declaration of template class.

2016-08-23 Thread Serge Pavlov via cfe-commits
Any feedback? Thanks, --Serge 2016-08-18 0:08 GMT+07:00 Serge Pavlov : > sepavloff updated this revision to Diff 68376. > sepavloff added a comment. > > Rebased the patch > > > https://reviews.llvm.org/D16989 > > Files: > include/clang/Sema/Sema.h >

Re: [PATCH] D16989: Change interpretation of function definition in friend declaration of template class.

2016-08-17 Thread Serge Pavlov via cfe-commits
sepavloff updated this revision to Diff 68376. sepavloff added a comment. Rebased the patch https://reviews.llvm.org/D16989 Files: include/clang/Sema/Sema.h lib/Sema/SemaDecl.cpp test/SemaCXX/PR25848.cpp test/SemaCXX/friend2.cpp Index: test/SemaCXX/friend2.cpp

Re: [PATCH] D16989: Change interpretation of function definition in friend declaration of template class.

2016-07-25 Thread Serge Pavlov via cfe-commits
sepavloff updated this revision to Diff 65376. sepavloff added a comment. Added one more case in shouldLinkDependentDeclWithPrevious https://reviews.llvm.org/D16989 Files: include/clang/Sema/Sema.h lib/Sema/SemaDecl.cpp test/SemaCXX/PR25848.cpp test/SemaCXX/friend2.cpp Index:

Re: [PATCH] D16989: Change interpretation of function definition in friend declaration of template class.

2016-07-18 Thread Serge Pavlov via cfe-commits
Any feedback? Thanks, --Serge 2016-06-20 1:52 GMT+06:00 Serge Pavlov : > sepavloff updated this revision to Diff 61220. > sepavloff added a comment. > > Updated patch > > Added handling of FunctionTemplateDecl to > shouldLinkDependentDeclWithPrevious. It is not > used now

Re: [PATCH] D16989: Change interpretation of function definition in friend declaration of template class.

2016-06-19 Thread Serge Pavlov via cfe-commits
sepavloff updated this revision to Diff 61220. sepavloff added a comment. Updated patch Added handling of FunctionTemplateDecl to shouldLinkDependentDeclWithPrevious. It is not used now but is required for subsequent patch. Also position comment correctly. http://reviews.llvm.org/D16989

Re: [PATCH] D16989: Change interpretation of function definition in friend declaration of template class.

2016-06-03 Thread Serge Pavlov via cfe-commits
sepavloff updated this revision to Diff 59532. sepavloff added a comment. Fixed test for friend functions. http://reviews.llvm.org/D16989 Files: include/clang/Sema/Sema.h lib/Sema/SemaDecl.cpp test/SemaCXX/PR25848.cpp test/SemaCXX/friend2.cpp Index: test/SemaCXX/friend2.cpp

Re: [PATCH] D16989: Change interpretation of function definition in friend declaration of template class.

2016-05-30 Thread Serge Pavlov via cfe-commits
sepavloff marked 2 inline comments as done. sepavloff added a comment. In http://reviews.llvm.org/D16989#432282, @rsmith wrote: > Please also add some testcases for the corresponding case for a friend > function template: > > template void f(); > template struct A { > template void f()

Re: [PATCH] D16989: Change interpretation of function definition in friend declaration of template class.

2016-05-30 Thread Serge Pavlov via cfe-commits
sepavloff updated this revision to Diff 58983. sepavloff added a comment. Updated patch http://reviews.llvm.org/D16989 Files: include/clang/Sema/Sema.h lib/Sema/SemaDecl.cpp test/SemaCXX/PR25848.cpp test/SemaCXX/friend2.cpp Index: test/SemaCXX/friend2.cpp

Re: [PATCH] D16989: Change interpretation of function definition in friend declaration of template class.

2016-05-17 Thread Richard Smith via cfe-commits
rsmith added a comment. Please also add some testcases for the corresponding case for a friend function template: template void f(); template struct A { template void f() {} }; template struct B { template void f() {} }; A a; B b; // ill-formed Comment

Re: [PATCH] D16989: Change interpretation of function definition in friend declaration of template class.

2016-05-16 Thread Serge Pavlov via cfe-commits
Any feedback? Thanks, --Serge 2016-05-03 22:40 GMT+06:00 Serge Pavlov : > 2016-04-26 0:55 GMT+06:00 Richard Smith : > >> rsmith added inline comments. >> >> >> Comment at: lib/Sema/SemaDecl.cpp:8611-8612 >> @@ -8609,3 +8610,4 @@ >>

Re: [PATCH] D16989: Change interpretation of function definition in friend declaration of template class.

2016-05-03 Thread Serge Pavlov via cfe-commits
2016-04-26 0:55 GMT+06:00 Richard Smith : > rsmith added inline comments. > > > Comment at: lib/Sema/SemaDecl.cpp:8611-8612 > @@ -8609,3 +8610,4 @@ > } else { > - // This needs to happen first so that 'inline' propagates. > -

Re: [PATCH] D16989: Change interpretation of function definition in friend declaration of template class.

2016-05-03 Thread Serge Pavlov via cfe-commits
sepavloff updated this revision to Diff 56015. sepavloff added a comment. Updated patch. http://reviews.llvm.org/D16989 Files: include/clang/Sema/Sema.h lib/Sema/SemaDecl.cpp test/SemaCXX/PR25848.cpp test/SemaCXX/friend2.cpp Index: test/SemaCXX/friend2.cpp

Re: [PATCH] D16989: Change interpretation of function definition in friend declaration of template class.

2016-04-25 Thread Richard Smith via cfe-commits
rsmith added inline comments. Comment at: lib/Sema/SemaDecl.cpp:8611-8612 @@ -8609,3 +8610,4 @@ } else { - // This needs to happen first so that 'inline' propagates. - NewFD->setPreviousDeclaration(cast(OldDecl)); + if (NewFD->isOutOfLine() && +

Re: [PATCH] D16989: Change interpretation of function definition in friend declaration of template class.

2016-04-20 Thread Serge Pavlov via cfe-commits
2016-03-29 1:08 GMT+06:00 Serge Pavlov : > 2016-03-18 20:50 GMT+06:00 Richard Smith : > >> rsmith added a comment. >> >> Can we instead not add the function to the redeclaration chain until it's >> instantiated (like we do if it's dependent)? >> >> > I

Re: [PATCH] D16989: Change interpretation of function definition in friend declaration of template class.

2016-03-28 Thread Serge Pavlov via cfe-commits
2016-03-18 20:50 GMT+06:00 Richard Smith : > rsmith added a comment. > > Can we instead not add the function to the redeclaration chain until it's > instantiated (like we do if it's dependent)? > > I prepared implementation that uses this approach. In this variant

Re: [PATCH] D16989: Change interpretation of function definition in friend declaration of template class.

2016-03-28 Thread Serge Pavlov via cfe-commits
sepavloff updated this revision to Diff 51817. sepavloff added a comment. Changed implementation This implementation uses another approach. Previous version of the patch put friend functions into redeclaration chains but modified search algorithm so that it skipped such functions. In this

Re: [PATCH] D16989: Change interpretation of function definition in friend declaration of template class.

2016-03-19 Thread Richard Smith via cfe-commits
rsmith added a comment. Can we instead not add the function to the redeclaration chain until it's instantiated (like we do if it's dependent)? http://reviews.llvm.org/D16989 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

Re: [PATCH] D16989: Change interpretation of function definition in friend declaration of template class.

2016-03-18 Thread Serge Pavlov via cfe-commits
sepavloff added a comment. Topic of friend function instantiation in C++ Standard discussion group

[PATCH] D16989: Change interpretation of function definition in friend declaration of template class.

2016-02-08 Thread Serge Pavlov via cfe-commits
sepavloff created this revision. sepavloff added a reviewer: rsmith. sepavloff added a subscriber: cfe-commits. Previously if a file-level function was defined inside befriending template class, it was treated as defined in the code like: ``` void func(int); template class C1 { friend