<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class="">Yes, I think if and when web URLs start shipping attached to diagnostics it’s important to have some kind of system in place to check for outdated links. Since URLs will likely be associated with diagnostic IDs using TableGen or some other structured format, I don’t think it would be too difficult to put together a tool to scan for them and check they’re still working.</div><div class=""><br class=""></div><div class="">To give some context, right now Swift exclusively links to documentation installed locally from its diagnostics, and I expect it to stay that way for the foreseeable future. Part of the reason for that was to avoid this exact problem.</div><div class=""><br class=""></div><div class="">However, I think it’s important to support any URL in the serialized format because this approach of local-only diagnostic documentation won’t necessarily adapt well to Clang (and any other compilers that use the format, though I don’t know of any). It worked well for Swift primarily because we had little-to-no existing diagnostics-related documentation. Because everything is being written from scratch, it’s been easy to enforce the requirement that it’s all organized in a central location in the toolchain, and it’s all easy to read as plaintext. On the other hand, Clang already has lots of really great documentation designed for the web, and restructuring it to ship alongside the compiler seems less likely to work well.</div><div class=""><br class=""></div><div class="">The way I see it, allowing any URL to appear in the serialized format gives Clang and Swift the flexibility to choose a different set of tradeoffs based on their different approaches to docs, toolchain layout, etc.. In the end, the reader of the format doesn’t need to worry about these differences, because it’s the compiler’s responsibility to produce valid links, whether that’s through shipping docs locally, enforcing it with CI jobs, or something else entirely.</div><div class=""><br class=""></div><div class="">- Owen</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div><br class=""><blockquote type="cite" class=""><div class="">On May 20, 2020, at 4:04 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com" class="">dblaikie@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">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 class=""><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" class="">cfe-dev@lists.llvm.org</a>> wrote:<br class=""></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;" class=""><div class="">Hi Owen,</div><div class=""><br class=""></div><div class="">I think this is a great idea!</div><div class=""><br class=""></div><div class="">I'm just thinking about how to make sure the URLs in diagnostics are valid and stay that way.</div><div class=""><br class=""></div><div class="">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 class=""><br class=""></div><div class=""><br class=""></div><div class="">Jan</div><div class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">On May 19, 2020, at 9:14 AM, Owen Voorhees via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank" class="">cfe-dev@lists.llvm.org</a>> wrote:</div><br class=""><div class=""><div style="overflow-wrap: break-word;" class="">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 class=""><br class=""></div><div class="">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" class="">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 class=""><br class=""></div><div class="">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 class=""><br class=""></div><div class="">— Owen</div><div class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">On May 19, 2020, at 7:49 AM, Finkel, Hal J. <<a href="mailto:hfinkel@anl.gov" target="_blank" class="">hfinkel@anl.gov</a>> wrote:</div><br class=""><div class=""><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)" class=""><div class=""><br class=""><hr style="display:inline-block;width:1361.92px" class=""><div id="gmail-m_5002741994184713449divRplyFwdMsg" dir="ltr" class=""><font face="Calibri, sans-serif" style="font-size:11pt" class=""><b class="">From:</b><span class=""> </span>Aaron Ballman <<a href="mailto:aaron.ballman@gmail.com" target="_blank" class="">aaron.ballman@gmail.com</a>><br class=""><b class="">Sent:</b><span class=""> </span>Tuesday, May 19, 2020 7:44 AM<br class=""><b class="">To:</b><span class=""> </span>Finkel, Hal J. <<a href="mailto:hfinkel@anl.gov" target="_blank" class="">hfinkel@anl.gov</a>><br class=""><b class="">Cc:</b><span class=""> </span><a href="mailto:cfe-dev@lists.llvm.org" target="_blank" class="">cfe-dev@lists.llvm.org</a> <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank" class="">cfe-dev@lists.llvm.org</a>>; Owen Voorhees <<a href="mailto:owenvoorhees@gmail.com" target="_blank" class="">owenvoorhees@gmail.com</a>><br class=""><b class="">Subject:</b><span class=""> </span>Re: [cfe-dev] [RFC] Upstreaming proposed change to .dia format from Swift</font><div class=""> </div></div><div class=""><font size="2" class=""><span style="font-size:11pt" class=""><div class="">On Tue, May 19, 2020 at 6:26 AM Finkel, Hal J. <<a href="mailto:hfinkel@anl.gov" target="_blank" class="">hfinkel@anl.gov</a>> wrote:<br class="">><br class="">> Hi, Owen,<br class="">><br class="">> I think having documentation links associated with diagnostics is a useful feature, and I would be happy to see it in Clang.<br class=""><br class="">I agree, I think this is a great idea! Hopefully we can also make use<br class="">of it (or something like it) in clang-tidy as well.<br class=""><br class="">> I would encourage the addition of appropriate links to Clang's<span class=""> </span><a href="https://clang.llvm.org/docs/LanguageExtensions.html" target="_blank" class="">https://clang.llvm.org/docs/LanguageExtensions.html</a><span class=""> </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 class=""><br class="">Are you envisioning something like `[[gnu::nonnull]] int *i;` giving<br class="">you a diagnostic about the attribute being ignored because it doesn't<br class="">apply to local variables, along with a link directly to the<br class="">documentation for that attribute? If so, that's a neat idea! We could<br class="">possibly even do something like that for unknown or misspelled command<br class="">line arguments, because the command line reference is also table<br class=""></div><div class="">generated.<br class=""></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" class=""><br class=""></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" class=""><br class=""></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" class="">Yes, exactly. I'm glad that you agree<span class=""> </span><span id="gmail-m_5002741994184713449🙂" class="">🙂</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" class=""><span class=""><br class=""></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" class=""><span class=""> -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" class=""><br class=""></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)" class=""><div class=""><div class=""><font size="2" class=""><span style="font-size:11pt" class=""><div class=""><br class="">~Aaron<br class=""><br class="">><br class="">>  -Hal<br class="">><br class="">> Hal Finkel<br class="">> Lead, Compiler Technology and Programming Languages<br class="">> Leadership Computing Facility<br class="">> Argonne National Laboratory<br class="">><br class="">> ________________________________<br class="">> From: cfe-dev <<a href="mailto:cfe-dev-bounces@lists.llvm.org" target="_blank" class="">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" class="">cfe-dev@lists.llvm.org</a>><br class="">> Sent: Monday, May 18, 2020 10:15 AM<br class="">> To: <a href="mailto:cfe-dev@lists.llvm.org" target="_blank" class="">cfe-dev@lists.llvm.org</a> <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank" class="">cfe-dev@lists.llvm.org</a>><br class="">> Subject: [cfe-dev] [RFC] Upstreaming proposed change to .dia format from Swift<br class="">><br class="">> Hi all,<br class="">><br class="">> I was hoping to get some feedback on a proposed change to clang's serialized diagnostics format.<br class="">><br class="">> To give some background, Swift (<a href="http://swift.org/" target="_blank" class="">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 class=""> </span><a href="https://github.com/apple/swift/blob/master/docs/Diagnostics.md#educational-notes" target="_blank" class="">https://github.com/apple/swift/blob/master/docs/Diagnostics.md#educational-notes</a><span class=""> </span>and an example is available at<span class=""> </span><a href="https://github.com/apple/swift/blob/master/userdocs/diagnostics/temporary-pointers.md" target="_blank" class="">https://github.com/apple/swift/blob/master/userdocs/diagnostics/temporary-pointers.md</a>.<br class="">><br class="">> 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 class=""> </span><a href="https://reviews.llvm.org/D80126" target="_blank" class="">https://reviews.llvm.org/D80126</a><span class=""> </span>.<br class="">><br class="">> 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 class="">><br class="">> My questions are:<br class="">><br class="">> Is the clang community open to making a change like this that primarily benefits a downstream project (swift) in the short term?<br class="">> Is this a feature clang might be interested in adopting at some point?<br class="">><br class="">><br class="">> 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 class="">><br class="">> Thanks,<br class="">> Owen</div></span></font></div></div></blockquote></div></blockquote></div><br class=""></div></div>_______________________________________________<br class="">cfe-dev mailing list<br class=""><a href="mailto:cfe-dev@lists.llvm.org" target="_blank" class="">cfe-dev@lists.llvm.org</a><br class=""><a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" target="_blank" class="">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br class=""></div></blockquote></div><br class=""></div></div>_______________________________________________<br class="">
cfe-dev mailing list<br class="">
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank" class="">cfe-dev@lists.llvm.org</a><br class="">
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank" class="">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br class="">
</blockquote></div>
</div></blockquote></div><br class=""></div></body></html>