<div dir="ltr">Might be worth passing all URLs through some central (well, not central-central - obviously Swift wants to manage its own separate from Clang and the LLVM community) URL forwarding thing we can update more reliably (eg: what if we decide to rename a URL, use a different file format (so the extension changes from '.rst'), etc?)</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, May 20, 2020 at 1:42 PM Jan Korous via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@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 style="overflow-wrap: break-word;"><div>Hi Owen,</div><div><br></div><div>I think this is a great idea!</div><div><br></div><div>I'm just thinking about how to make sure the URLs in diagnostics are valid and stay that way.</div><div><br></div><div>We might want to use a combination of CI jobs and phabricator checks to make sure all the URLs we produce in diagnostics in both current master and somewhat recent releases are ok.</div><div><br></div><div><br></div><div>Jan</div><div><div><br><blockquote type="cite"><div>On May 19, 2020, at 9:14 AM, Owen Voorhees via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:</div><br><div><div style="overflow-wrap: break-word;">Thanks for pointing me towards those docs, they seem like excellent candidates for linking from diagnostics! Providing more information when encountering errors related to things like attributes and command line args that users may not encounter on a regular basis is exactly in line with my goals when adding this.<div><br></div><div>It seems apparent that I probably shouldn’t assume documentation will be installed locally when generalizing this feature to work with Clang. Swift ships the docs alongside the compiler primarily because the language and diagnostics are still evolving rapidly, and we don’t have a good mechanism to host versioned documentation at the moment. On the other hand, linking to something like <a href="https://clang.llvm.org/docs/LanguageExtensions.html#non-standard-c-11-attributes" target="_blank">https://clang.llvm.org/docs/LanguageExtensions.html#non-standard-c-11-attributes</a> from Clang diagnostics seems perfectly sensible, and there’s no reason I can think of not to support both web and file URLs.</div><div><br></div><div>I’ll look into Clang’s diagnostics infrastructure to get a better idea of how documentation links can be integrated throughout before moving ahead with the serialization format updates. I think my originally proposed changes are still a little too Swift-specific.</div><div><br></div><div>— Owen</div><div><div><br><blockquote type="cite"><div>On May 19, 2020, at 7:49 AM, Finkel, Hal J. <<a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a>> wrote:</div><br><div><blockquote style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;border-left:3px solid rgb(200,200,200);border-top-color:rgb(200,200,200);border-right-color:rgb(200,200,200);border-bottom-color:rgb(200,200,200);padding-left:1ex;margin-left:0.8ex;color:rgb(102,102,102)"><div><br><hr style="display:inline-block;width:1361.92px"><div id="gmail-m_5002741994184713449divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt"><b>From:</b><span> </span>Aaron Ballman <<a href="mailto:aaron.ballman@gmail.com" target="_blank">aaron.ballman@gmail.com</a>><br><b>Sent:</b><span> </span>Tuesday, May 19, 2020 7:44 AM<br><b>To:</b><span> </span>Finkel, Hal J. <<a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a>><br><b>Cc:</b><span> </span><a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a> <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>>; Owen Voorhees <<a href="mailto:owenvoorhees@gmail.com" target="_blank">owenvoorhees@gmail.com</a>><br><b>Subject:</b><span> </span>Re: [cfe-dev] [RFC] Upstreaming proposed change to .dia format from Swift</font><div> </div></div><div><font size="2"><span style="font-size:11pt"><div>On Tue, May 19, 2020 at 6:26 AM Finkel, Hal J. <<a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a>> wrote:<br>><br>> Hi, Owen,<br>><br>> I think having documentation links associated with diagnostics is a useful feature, and I would be happy to see it in Clang.<br><br>I agree, I think this is a great idea! Hopefully we can also make use<br>of it (or something like it) in clang-tidy as well.<br><br>> I would encourage the addition of appropriate links to Clang's<span> </span><a href="https://clang.llvm.org/docs/LanguageExtensions.html" target="_blank">https://clang.llvm.org/docs/LanguageExtensions.html</a><span> </span>and, moreover, maybe we can generate these for mis-applied attributes in some automated way (given that our attribute docs are also TableGen-generated).<br><br>Are you envisioning something like `[[gnu::nonnull]] int *i;` giving<br>you a diagnostic about the attribute being ignored because it doesn't<br>apply to local variables, along with a link directly to the<br>documentation for that attribute? If so, that's a neat idea! We could<br>possibly even do something like that for unknown or misspelled command<br>line arguments, because the command line reference is also table<br></div><div>generated.<br></div></span></font></div></div></blockquote><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><br></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><br></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none">Yes, exactly. I'm glad that you agree<span> </span><span id="gmail-m_5002741994184713449🙂">🙂</span></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><span><br></span></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><span> -Hal</span></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><br></div><blockquote style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;border-left:3px solid rgb(200,200,200);border-top-color:rgb(200,200,200);border-right-color:rgb(200,200,200);border-bottom-color:rgb(200,200,200);padding-left:1ex;margin-left:0.8ex;color:rgb(102,102,102)"><div><div><font size="2"><span style="font-size:11pt"><div><br>~Aaron<br><br>><br>>  -Hal<br>><br>> Hal Finkel<br>> Lead, Compiler Technology and Programming Languages<br>> Leadership Computing Facility<br>> Argonne National Laboratory<br>><br>> ________________________________<br>> From: cfe-dev <<a href="mailto:cfe-dev-bounces@lists.llvm.org" target="_blank">cfe-dev-bounces@lists.llvm.org</a>> on behalf of Owen Voorhees via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>><br>> Sent: Monday, May 18, 2020 10:15 AM<br>> To: <a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a> <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>><br>> Subject: [cfe-dev] [RFC] Upstreaming proposed change to .dia format from Swift<br>><br>> Hi all,<br>><br>> I was hoping to get some feedback on a proposed change to clang's serialized diagnostics format.<br>><br>> To give some background, Swift (<a href="http://swift.org/" target="_blank">swift.org</a>) also uses this format for its diagnostics, and we recently added a new feature called "educational notes" which we'd like to start serializing. An educational note is attached to a diagnostic and is essentially just a path to associated documentation somewhere in a compiler toolchain. The documentation can then be displayed alongside emitted diagnostics to teach users about relevant language concepts or describe common problems and solutions. More details can be found at<span> </span><a href="https://github.com/apple/swift/blob/master/docs/Diagnostics.md#educational-notes" target="_blank">https://github.com/apple/swift/blob/master/docs/Diagnostics.md#educational-notes</a><span> </span>and an example is available at<span> </span><a href="https://github.com/apple/swift/blob/master/userdocs/diagnostics/temporary-pointers.md" target="_blank">https://github.com/apple/swift/blob/master/userdocs/diagnostics/temporary-pointers.md</a>.<br>><br>> In order to support this use case, I'd like to propose adding new records to the .dia format for educational note paths, or perhaps more generally, documentation paths. The new records would be emitted alongside the main diagnostic record, similar to the handling of ranges and fix-its. I've submitted a patch with the proposed changes here:<span> </span><a href="https://reviews.llvm.org/D80126" target="_blank">https://reviews.llvm.org/D80126</a><span> </span>.<br>><br>> The main reason we'd like to upstream this change to Clang instead of just implementing it in Swift is to avoid diverging from the established format. However, it isn't language specific and in the long term I think this is a feature that could benefit Clang's diagnostics quite a bit as well.<br>><br>> My questions are:<br>><br>> Is the clang community open to making a change like this that primarily benefits a downstream project (swift) in the short term?<br>> Is this a feature clang might be interested in adopting at some point?<br>><br>><br>> Any and all feedback is welcome! Sorry if this is the wrong place to discuss this sort of thing — it's my first time posting to the LLVM lists.<br>><br>> Thanks,<br>> Owen</div></span></font></div></div></blockquote></div></blockquote></div><br></div></div>_______________________________________________<br>cfe-dev mailing list<br><a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br><a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br></div></blockquote></div><br></div></div>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div>