<div dir="ltr">After r304962, it should now produce messages like:<div><br></div><div>'foo' defined here has different definitions in different modules; first difference is this unexpected decl</div><div>but in 'Module' found another unexpected decl</div><div><br></div><div>'foo' with definition in module 'FirstModule' has different definitions in different modules; first difference is this field</div><div>but in 'Module' found different field</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 7, 2017 at 6:41 PM, Richard Trieu <span dir="ltr"><<a href="mailto:rtrieu@google.com" target="_blank">rtrieu@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Yes, I will go correct the diagnostic text.<div><br></div><div>In theory, there is nothing that is supposed to reach this diagnostic or the one below it.  Except that the hasher isn't complete yet and some things slip through.  Once things are more stable, these should be replaced with llvm_unreachable instead.</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 7, 2017 at 6:05 PM, Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div class="m_-7135085338177803458h5">On 7 June 2017 at 17:56, Richard Trieu via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: rtrieu<br>
Date: Wed Jun  7 19:56:21 2017<br>
New Revision: 304956<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=304956&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject?rev=304956&view=rev</a><br>
Log:<br>
[ODRHash] Change the fall-back diagnostic error.<br>
<br>
Provide a little more information when a ODR violation is detected, but the<br>
specific error could not be diagnosed.<br>
<br>
Modified:<br>
    cfe/trunk/include/clang/Basic/<wbr>DiagnosticSerializationKinds.t<wbr>d<br>
    cfe/trunk/lib/Serialization/AS<wbr>TReader.cpp<br>
<br>
Modified: cfe/trunk/include/clang/Basic/<wbr>DiagnosticSerializationKinds.t<wbr>d<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td?rev=304956&r1=304955&r2=304956&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/cfe/trunk/include/clang/<wbr>Basic/DiagnosticSerializationK<wbr>inds.td?rev=304956&r1=304955&r<wbr>2=304956&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/include/clang/Basic/<wbr>DiagnosticSerializationKinds.t<wbr>d (original)<br>
+++ cfe/trunk/include/clang/Basic/<wbr>DiagnosticSerializationKinds.t<wbr>d Wed Jun  7 19:56:21 2017<br>
@@ -174,6 +174,13 @@ def note_module_odr_violation_mism<wbr>atch_d<br>
   "method %2 with %ordinal3 parameter of type %4%select{| decayed from %6}5|"<br>
   "method %2 with %ordinal3 parameter named %4}1">;<br>
<br>
+def err_module_odr_violation_misma<wbr>tch_decl_unknown : Error<<br>
+  "%q0 has different definitions in different modules; first difference is "<br>
+  "%select{definition in module '%2'|defined here}1 found different "<br>
+  "%select{||||static assert|field|method|other}3">;<br>
+def note_module_odr_violation_mism<wbr>atch_decl_unknown : Note<<br>
+  "but in '%0' found different %select{||||static assert|field|method|other}1">;<br></blockquote><div><br></div></div></div><div>This will produce messages like</div><div><br></div><div>"first difference is defined here found different static assert"</div><div>"first difference is definition in module 'X' found different other"</div><div><br></div><div>... which seem pretty confusing. Can this be rephrased so that it forms easier-to-read sentences? (Also, can we get some test coverage for this diagnostic?)</div><div><div class="m_-7135085338177803458h5"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+<br>
 def warn_duplicate_module_file_ext<wbr>ension : Warning<<br>
   "duplicate module file extension block name '%0'">,<br>
   InGroup<ModuleFileExtension>;<br>
<br>
Modified: cfe/trunk/lib/Serialization/AS<wbr>TReader.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=304956&r1=304955&r2=304956&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/cfe/trunk/lib/Serializat<wbr>ion/ASTReader.cpp?rev=304956&r<wbr>1=304955&r2=304956&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/Serialization/AS<wbr>TReader.cpp (original)<br>
+++ cfe/trunk/lib/Serialization/AS<wbr>TReader.cpp Wed Jun  7 19:56:21 2017<br>
@@ -9753,13 +9753,13 @@ void ASTReader::diagnoseOdrViolatio<wbr>ns()<br>
       if (Diagnosed == true)<br>
         continue;<br>
<br>
-      Diag(FirstRecord->getLocation(<wbr>),<br>
-           diag::err_module_odr_violatio<wbr>n_different_definitions)<br>
-          << FirstRecord << FirstModule.empty() << FirstModule;<br>
-<br>
-      Diag(SecondRecord->getLocation<wbr>(),<br>
-           diag::note_module_odr_violati<wbr>on_different_definitions)<br>
-          << SecondModule;<br>
+      Diag(FirstDecl->getLocation(),<br>
+           diag::err_module_odr_violatio<wbr>n_mismatch_decl_unknown)<br>
+          << FirstRecord << FirstModule.empty() << FirstModule << FirstDiffType<br>
+          << FirstDecl->getSourceRange();<br>
+      Diag(SecondDecl->getLocation()<wbr>,<br>
+           diag::note_module_odr_violati<wbr>on_mismatch_decl_unknown)<br>
+          << SecondModule << FirstDiffType << SecondDecl->getSourceRange();<br>
       Diagnosed = true;<br>
     }<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><br></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>