<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:"Segoe UI";
panose-1:2 11 5 2 4 2 4 2 2 3;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
span.EmailStyle19
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">From my reading of the coding-standard (AND your patch!) I don’t see where it even requires either form, other than ‘thou shall run clang-format’. Use in not-particularly-related examples doesn’t have a ‘shall’ relationship for me at all.
For example, nothing in that Use Namespace Qualifiers… should convince you to use functions starting with ‘lower case’ (as in ‘foo’).<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">IMO, I think if we want to say anything, it should be that we want to have end-of-namespace curleys marked, either as // namespace llvm (or just // namespace?) or // end namespace llvm (or //end anonymous namespace)<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> llvm-dev <llvm-dev-bounces@lists.llvm.org> <b>On Behalf Of
</b>Carlos Galvez via llvm-dev<br>
<b>Sent:</b> Monday, December 6, 2021 11:16 AM<br>
<b>To:</b> llvm-dev@lists.llvm.org<br>
<b>Subject:</b> [llvm-dev] [docs][RFC] Style for "end namespace" comments<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Hi,<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I was recently working on a patch and was asked during review to replace existing:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">"// end namespace clang" Style A<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">with :<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">"// namespace clang" Style B<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">After that, I got interested to understand what the preferred style is, and found in the
<a href="https://llvm.org/docs/CodingStandards.html#use-namespace-qualifiers-to-implement-previously-declared-functions">
Coding Guidelines</a> that the style is actually Style A.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">On the other hand, clang-format will automatically enforce Style B on new code, via the FixNamespaceComments option, which is set to "true" for the LLVM style. clang-format will keep the Style A if it already exists, however. Most people
using clang-format (outside LLVM) will probably be more familiar with Style B.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Additionally, I have seen the following usage numbers in the repo:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Segoe UI",sans-serif;color:black">$ git grep '//<em><span style="font-family:"Segoe UI",sans-serif"> end' | wc -l</span></em><i><br>
<em><span style="font-family:"Segoe UI",sans-serif">6724</span></em><br>
<em><span style="font-family:"Segoe UI",sans-serif">$ git grep '//</span></em></i> namespace' | wc -l<br>
14348</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Segoe UI",sans-serif;color:black">So Style B seems to be more adopted. Therefore I wanted to ask - should we update the Coding Guidelines to reflect this, and avoid these kinds of style discussions
in code reviews? If so, what style should be preferred? I have a <a href="https://reviews.llvm.org/D115115">
patch</a> for review and there seems to be a preference for keeping both styles. Regardless of the choice, I don't think this should lead to an urgent style change of the whole codebase.</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Segoe UI",sans-serif;color:black">Looking forward to your feedback!</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Segoe UI",sans-serif;color:black">Best regards,</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Segoe UI",sans-serif;color:black">Carlos</span><o:p></o:p></p>
</div>
</div>
</div>
</body>
</html>