<div dir="ltr">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. <a href="https://bugs.llvm.org/show_bug.cgi?id=35981">https://bugs.llvm.org/show_bug.cgi?id=35981</a><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 16, 2018 at 2:44 PM, NAKAMURA Takumi <span dir="ltr"><<a href="mailto:geek4civic@gmail.com" target="_blank">geek4civic@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">If r322350 is temporary fix, I suggest r<span style="color:rgb(33,33,33)">321395 may be reverted in release_60. Richard, how do you think?</span><div><div class="gmail-h5"><div><font color="#212121"><br></font><div class="gmail_quote"><div dir="ltr">On Wed, Jan 17, 2018 at 4:27 AM Richard Trieu via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">There was a different, possibly related, issue with templated methods that I just disabled checking for methods all together in r<span style="font-size:10pt;font-family:Arial;font-style:normal;text-align:right">321396 until I can investigate further.</span></div><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 15, 2018 at 10:45 AM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">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?<br><br>Is there a common solution that could be used for both cases?<div><div class="gmail-m_-6540336660904761344m_-480966769259073139h5"><br><br><div class="gmail_quote"><div dir="ltr">On Thu, Jan 11, 2018 at 8:43 PM Richard Trieu via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Author: rtrieu<br>
Date: Thu Jan 11 20:42:27 2018<br>
New Revision: 322350<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=322350&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=322350&view=rev</a><br>
Log:<br>
[ODRHash] Don't hash friend functions.<br>
<br>
In certain combinations of templated classes and friend functions, the body<br>
of friend functions does not get propagated along with function signature.<br>
Exclude friend functions for hashing to avoid this case.<br>
<br>
Added:<br>
cfe/trunk/test/Modules/Inputs/<wbr>odr_hash-Friend/<br>
cfe/trunk/test/Modules/Inputs/<wbr>odr_hash-Friend/Box.h<br>
cfe/trunk/test/Modules/Inputs/<wbr>odr_hash-Friend/M1.h<br>
cfe/trunk/test/Modules/Inputs/<wbr>odr_hash-Friend/M2.h<br>
cfe/trunk/test/Modules/Inputs/<wbr>odr_hash-Friend/M3.h<br>
cfe/trunk/test/Modules/Inputs/<wbr>odr_hash-Friend/module.<wbr>modulemap<br>
cfe/trunk/test/Modules/odr_<wbr>hash-Friend.cpp<br>
Modified:<br>
cfe/trunk/lib/AST/ODRHash.cpp<br>
<br>
Modified: cfe/trunk/lib/AST/ODRHash.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ODRHash.cpp?rev=322350&r1=322349&r2=322350&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/AST/<wbr>ODRHash.cpp?rev=322350&r1=<wbr>322349&r2=322350&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/AST/ODRHash.cpp (original)<br>
+++ cfe/trunk/lib/AST/ODRHash.cpp Thu Jan 11 20:42:27 2018<br>
@@ -478,6 +478,8 @@ void ODRHash::AddFunctionDecl(const Func<br>
<br>
// TODO: Fix hashing for class methods.<br>
if (isa<CXXMethodDecl>(Function)) return;<br>
+ // And friend functions.<br>
+ if (Function-><wbr>getFriendObjectKind()) return;<br>
<br>
// Skip functions that are specializations or in specialization context.<br>
const DeclContext *DC = Function;<br>
<br>
Added: cfe/trunk/test/Modules/Inputs/<wbr>odr_hash-Friend/Box.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/odr_hash-Friend/Box.h?rev=322350&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/<wbr>Modules/Inputs/odr_hash-<wbr>Friend/Box.h?rev=322350&view=<wbr>auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/test/Modules/Inputs/<wbr>odr_hash-Friend/Box.h (added)<br>
+++ cfe/trunk/test/Modules/Inputs/<wbr>odr_hash-Friend/Box.h Thu Jan 11 20:42:27 2018<br>
@@ -0,0 +1,14 @@<br>
+template <class T><br>
+struct iterator {<br>
+ void Compare(const iterator &x) { }<br>
+ friend void Check(iterator) {}<br>
+};<br>
+<br>
+template <class T = int> struct Box {<br>
+ iterator<T> I;<br>
+<br>
+ void test() {<br>
+ Check(I);<br>
+ I.Compare(I);<br>
+ }<br>
+};<br>
<br>
Added: cfe/trunk/test/Modules/Inputs/<wbr>odr_hash-Friend/M1.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/odr_hash-Friend/M1.h?rev=322350&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/<wbr>Modules/Inputs/odr_hash-<wbr>Friend/M1.h?rev=322350&view=<wbr>auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/test/Modules/Inputs/<wbr>odr_hash-Friend/M1.h (added)<br>
+++ cfe/trunk/test/Modules/Inputs/<wbr>odr_hash-Friend/M1.h Thu Jan 11 20:42:27 2018<br>
@@ -0,0 +1,6 @@<br>
+#include "Box.h"<br>
+<br>
+void Peek() {<br>
+ Box<> Gift;<br>
+ Gift.test();<br>
+}<br>
<br>
Added: cfe/trunk/test/Modules/Inputs/<wbr>odr_hash-Friend/M2.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/odr_hash-Friend/M2.h?rev=322350&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/<wbr>Modules/Inputs/odr_hash-<wbr>Friend/M2.h?rev=322350&view=<wbr>auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/test/Modules/Inputs/<wbr>odr_hash-Friend/M2.h (added)<br>
+++ cfe/trunk/test/Modules/Inputs/<wbr>odr_hash-Friend/M2.h Thu Jan 11 20:42:27 2018<br>
@@ -0,0 +1,5 @@<br>
+#include "Box.h"<br>
+void x() {<br>
+ Box<> Unused;<br>
+ //Unused.test();<br>
+}<br>
<br>
Added: cfe/trunk/test/Modules/Inputs/<wbr>odr_hash-Friend/M3.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/odr_hash-Friend/M3.h?rev=322350&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/<wbr>Modules/Inputs/odr_hash-<wbr>Friend/M3.h?rev=322350&view=<wbr>auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/test/Modules/Inputs/<wbr>odr_hash-Friend/M3.h (added)<br>
+++ cfe/trunk/test/Modules/Inputs/<wbr>odr_hash-Friend/M3.h Thu Jan 11 20:42:27 2018<br>
@@ -0,0 +1,7 @@<br>
+#include "Box.h"<br>
+#include "M2.h"<br>
+<br>
+void Party() {<br>
+ Box<> Present;<br>
+ Present.test();<br>
+}<br>
<br>
Added: cfe/trunk/test/Modules/Inputs/<wbr>odr_hash-Friend/module.<wbr>modulemap<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/odr_hash-Friend/module.modulemap?rev=322350&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/<wbr>Modules/Inputs/odr_hash-<wbr>Friend/module.modulemap?rev=<wbr>322350&view=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/test/Modules/Inputs/<wbr>odr_hash-Friend/module.<wbr>modulemap (added)<br>
+++ cfe/trunk/test/Modules/Inputs/<wbr>odr_hash-Friend/module.<wbr>modulemap Thu Jan 11 20:42:27 2018<br>
@@ -0,0 +1,15 @@<br>
+module Box {<br>
+ header "Box.h"<br>
+}<br>
+<br>
+module Module1 {<br>
+ header "M1.h"<br>
+}<br>
+<br>
+module Module2 {<br>
+ header "M2.h"<br>
+}<br>
+<br>
+module Module3 {<br>
+ header "M3.h"<br>
+}<br>
<br>
Added: cfe/trunk/test/Modules/odr_<wbr>hash-Friend.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/odr_hash-Friend.cpp?rev=322350&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/<wbr>Modules/odr_hash-Friend.cpp?<wbr>rev=322350&view=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/test/Modules/odr_<wbr>hash-Friend.cpp (added)<br>
+++ cfe/trunk/test/Modules/odr_<wbr>hash-Friend.cpp Thu Jan 11 20:42:27 2018<br>
@@ -0,0 +1,19 @@<br>
+// RUN: rm -rf %t<br>
+<br>
+// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t/<wbr>modules.cache \<br>
+// RUN: -I %S/Inputs/odr_hash-Friend \<br>
+// RUN: -emit-obj -o /dev/null \<br>
+// RUN: -fmodules \<br>
+// RUN: -fimplicit-module-maps \<br>
+// RUN: -fmodules-cache-path=%t/<wbr>modules.cache \<br>
+// RUN: -std=c++11 -x c++ %s -verify<br>
+<br>
+// expected-no-diagnostics<br>
+<br>
+#include "Box.h"<br>
+#include "M1.h"<br>
+#include "M3.h"<br>
+<br>
+void Run() {<br>
+ Box<> Present;<br>
+}<br>
<br>
<br>
______________________________<wbr>_________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-commits</a><br>
</blockquote></div></div></div></div>
</blockquote></div><br></div></div>
______________________________<wbr>_________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-commits</a><br>
</blockquote></div></div></div></div></div>
</blockquote></div><br></div></div>