I feel it's best to merge this change into the release branch instead of reverting the previous change. I've filed a bug to request this revision, and a few others that fix the test case, to be merged. https://bugs.llvm.org/show_bug.cgi?id=35981
On Tue, Jan 16, 2018 at 2:44 PM, NAKAMURA Takumi <geek4ci...@gmail.com> wrote: > If r322350 is temporary fix, I suggest r321395 may be reverted in > release_60. Richard, how do you think? > > On Wed, Jan 17, 2018 at 4:27 AM Richard Trieu via cfe-commits < > cfe-commits@lists.llvm.org> wrote: > >> There was a different, possibly related, issue with templated methods >> that I just disabled checking for methods all together in r321396 until >> I can investigate further. >> >> >> On Mon, Jan 15, 2018 at 10:45 AM, David Blaikie <dblai...@gmail.com> >> wrote: >> >>> I'm surprised this problem is unique to friend functions with >>> definitions inline and the friend declaration site - doesn't a similar >>> issue occur with member functions of templates that are not instantiated in >>> some (similar) contexts? >>> >>> Is there a common solution that could be used for both cases? >>> >>> >>> On Thu, Jan 11, 2018 at 8:43 PM Richard Trieu via cfe-commits < >>> cfe-commits@lists.llvm.org> wrote: >>> >>>> Author: rtrieu >>>> Date: Thu Jan 11 20:42:27 2018 >>>> New Revision: 322350 >>>> >>>> URL: http://llvm.org/viewvc/llvm-project?rev=322350&view=rev >>>> Log: >>>> [ODRHash] Don't hash friend functions. >>>> >>>> In certain combinations of templated classes and friend functions, the >>>> body >>>> of friend functions does not get propagated along with function >>>> signature. >>>> Exclude friend functions for hashing to avoid this case. >>>> >>>> Added: >>>> cfe/trunk/test/Modules/Inputs/odr_hash-Friend/ >>>> cfe/trunk/test/Modules/Inputs/odr_hash-Friend/Box.h >>>> cfe/trunk/test/Modules/Inputs/odr_hash-Friend/M1.h >>>> cfe/trunk/test/Modules/Inputs/odr_hash-Friend/M2.h >>>> cfe/trunk/test/Modules/Inputs/odr_hash-Friend/M3.h >>>> cfe/trunk/test/Modules/Inputs/odr_hash-Friend/module.modulemap >>>> cfe/trunk/test/Modules/odr_hash-Friend.cpp >>>> Modified: >>>> cfe/trunk/lib/AST/ODRHash.cpp >>>> >>>> Modified: cfe/trunk/lib/AST/ODRHash.cpp >>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ >>>> ODRHash.cpp?rev=322350&r1=322349&r2=322350&view=diff >>>> ============================================================ >>>> ================== >>>> --- cfe/trunk/lib/AST/ODRHash.cpp (original) >>>> +++ cfe/trunk/lib/AST/ODRHash.cpp Thu Jan 11 20:42:27 2018 >>>> @@ -478,6 +478,8 @@ void ODRHash::AddFunctionDecl(const Func >>>> >>>> // TODO: Fix hashing for class methods. >>>> if (isa<CXXMethodDecl>(Function)) return; >>>> + // And friend functions. >>>> + if (Function->getFriendObjectKind()) return; >>>> >>>> // Skip functions that are specializations or in specialization >>>> context. >>>> const DeclContext *DC = Function; >>>> >>>> Added: cfe/trunk/test/Modules/Inputs/odr_hash-Friend/Box.h >>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ >>>> Modules/Inputs/odr_hash-Friend/Box.h?rev=322350&view=auto >>>> ============================================================ >>>> ================== >>>> --- cfe/trunk/test/Modules/Inputs/odr_hash-Friend/Box.h (added) >>>> +++ cfe/trunk/test/Modules/Inputs/odr_hash-Friend/Box.h Thu Jan 11 >>>> 20:42:27 2018 >>>> @@ -0,0 +1,14 @@ >>>> +template <class T> >>>> +struct iterator { >>>> + void Compare(const iterator &x) { } >>>> + friend void Check(iterator) {} >>>> +}; >>>> + >>>> +template <class T = int> struct Box { >>>> + iterator<T> I; >>>> + >>>> + void test() { >>>> + Check(I); >>>> + I.Compare(I); >>>> + } >>>> +}; >>>> >>>> Added: cfe/trunk/test/Modules/Inputs/odr_hash-Friend/M1.h >>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ >>>> Modules/Inputs/odr_hash-Friend/M1.h?rev=322350&view=auto >>>> ============================================================ >>>> ================== >>>> --- cfe/trunk/test/Modules/Inputs/odr_hash-Friend/M1.h (added) >>>> +++ cfe/trunk/test/Modules/Inputs/odr_hash-Friend/M1.h Thu Jan 11 >>>> 20:42:27 2018 >>>> @@ -0,0 +1,6 @@ >>>> +#include "Box.h" >>>> + >>>> +void Peek() { >>>> + Box<> Gift; >>>> + Gift.test(); >>>> +} >>>> >>>> Added: cfe/trunk/test/Modules/Inputs/odr_hash-Friend/M2.h >>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ >>>> Modules/Inputs/odr_hash-Friend/M2.h?rev=322350&view=auto >>>> ============================================================ >>>> ================== >>>> --- cfe/trunk/test/Modules/Inputs/odr_hash-Friend/M2.h (added) >>>> +++ cfe/trunk/test/Modules/Inputs/odr_hash-Friend/M2.h Thu Jan 11 >>>> 20:42:27 2018 >>>> @@ -0,0 +1,5 @@ >>>> +#include "Box.h" >>>> +void x() { >>>> + Box<> Unused; >>>> + //Unused.test(); >>>> +} >>>> >>>> Added: cfe/trunk/test/Modules/Inputs/odr_hash-Friend/M3.h >>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ >>>> Modules/Inputs/odr_hash-Friend/M3.h?rev=322350&view=auto >>>> ============================================================ >>>> ================== >>>> --- cfe/trunk/test/Modules/Inputs/odr_hash-Friend/M3.h (added) >>>> +++ cfe/trunk/test/Modules/Inputs/odr_hash-Friend/M3.h Thu Jan 11 >>>> 20:42:27 2018 >>>> @@ -0,0 +1,7 @@ >>>> +#include "Box.h" >>>> +#include "M2.h" >>>> + >>>> +void Party() { >>>> + Box<> Present; >>>> + Present.test(); >>>> +} >>>> >>>> Added: cfe/trunk/test/Modules/Inputs/odr_hash-Friend/module.modulemap >>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ >>>> Modules/Inputs/odr_hash-Friend/module.modulemap?rev=322350&view=auto >>>> ============================================================ >>>> ================== >>>> --- cfe/trunk/test/Modules/Inputs/odr_hash-Friend/module.modulemap >>>> (added) >>>> +++ cfe/trunk/test/Modules/Inputs/odr_hash-Friend/module.modulemap Thu >>>> Jan 11 20:42:27 2018 >>>> @@ -0,0 +1,15 @@ >>>> +module Box { >>>> + header "Box.h" >>>> +} >>>> + >>>> +module Module1 { >>>> + header "M1.h" >>>> +} >>>> + >>>> +module Module2 { >>>> + header "M2.h" >>>> +} >>>> + >>>> +module Module3 { >>>> + header "M3.h" >>>> +} >>>> >>>> Added: cfe/trunk/test/Modules/odr_hash-Friend.cpp >>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ >>>> Modules/odr_hash-Friend.cpp?rev=322350&view=auto >>>> ============================================================ >>>> ================== >>>> --- cfe/trunk/test/Modules/odr_hash-Friend.cpp (added) >>>> +++ cfe/trunk/test/Modules/odr_hash-Friend.cpp Thu Jan 11 20:42:27 2018 >>>> @@ -0,0 +1,19 @@ >>>> +// RUN: rm -rf %t >>>> + >>>> +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t/modules.cache \ >>>> +// RUN: -I %S/Inputs/odr_hash-Friend \ >>>> +// RUN: -emit-obj -o /dev/null \ >>>> +// RUN: -fmodules \ >>>> +// RUN: -fimplicit-module-maps \ >>>> +// RUN: -fmodules-cache-path=%t/modules.cache \ >>>> +// RUN: -std=c++11 -x c++ %s -verify >>>> + >>>> +// expected-no-diagnostics >>>> + >>>> +#include "Box.h" >>>> +#include "M1.h" >>>> +#include "M3.h" >>>> + >>>> +void Run() { >>>> + Box<> Present; >>>> +} >>>> >>>> >>>> _______________________________________________ >>>> cfe-commits mailing list >>>> cfe-commits@lists.llvm.org >>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits >>>> >>> >> _______________________________________________ >> cfe-commits mailing list >> cfe-commits@lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits >> >
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits