<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:"Book Antiqua";
panose-1:2 4 6 2 5 3 5 3 3 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
{font-family:"Lucida Sans Unicode";
panose-1:2 11 6 2 3 5 4 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
tt
{mso-style-priority:99;
font-family:"Courier New";}
span.EmailStyle19
{mso-style-type:personal-reply;
font-family:"Book Antiqua",serif;
color:#943634;
font-weight:normal;
font-style:normal;
text-decoration:none none;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:419720946;
mso-list-template-ids:-196154314;}
ol
{margin-bottom:0cm;}
ul
{margin-bottom:0cm;}
--></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-IE link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'>Generally it is safer to include ISO headers first (using the ‘</span><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>#include <...></span><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'>’ form) so as to minimise the possibility that a later user declaration or macro definition interferes with the correctness of the Standard libraries. It also tends to make pre-compiled header implementations faster and more shareable across a larger set of files.<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'>I would like to suggest revising the LLVM coding standard to place the “</span><span style='font-size:10.5pt;font-family:"Lucida Sans Unicode",sans-serif;color:black'>System </span><tt><span style='font-size:10.0pt;font-family:Consolas;color:black'>#include</span></tt><span style='font-size:10.5pt;font-family:"Lucida Sans Unicode",sans-serif;color:black'>s</span><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'>” first.<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'> MartinO<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#943634;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><b><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri",sans-serif'>From:</span></b><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri",sans-serif'> llvm-dev [mailto:llvm-dev-bounces@lists.llvm.org] <b>On Behalf Of </b>David Blaikie via llvm-dev<br><b>Sent:</b> 10 September 2015 16:33<br><b>To:</b> Russell Wallace <russell.wallace@gmail.com><br><b>Cc:</b> llvm-dev <llvm-dev@lists.llvm.org><br><b>Subject:</b> Re: [llvm-dev] LLVM coding standards and order of includes<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>On Thu, Sep 10, 2015 at 8:06 AM, Russell Wallace via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<o:p></o:p></p><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm'><div><p class=MsoNormal>According to the LLVM coding standards,<o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p style='mso-margin-top-alt:9.6pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm;line-height:15.75pt'><span style='font-size:10.5pt;font-family:"Lucida Sans Unicode",sans-serif;color:black'>Immediately after the <a href="http://llvm.org/docs/CodingStandards.html#header-file-comment" target="_blank"><span style='color:#CA7900'>header file comment</span></a> (and include guards if working on a header file), the <a href="http://llvm.org/docs/CodingStandards.html#minimal-list-of-includes" target="_blank"><span style='color:#CA7900'>minimal list of #includes</span></a>required by the file should be listed. We prefer these </span><tt><span style='font-size:10.0pt;font-family:Consolas;color:black'>#include</span></tt><span style='font-size:10.5pt;font-family:"Lucida Sans Unicode",sans-serif;color:black'>s to be listed in this order:<o:p></o:p></span></p><ol start=1 type=1><li class=MsoNormal style='color:black;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;line-height:15.75pt;mso-list:l0 level1 lfo1'><span style='font-size:10.5pt;font-family:"Lucida Sans Unicode",sans-serif'>Main Module Header<o:p></o:p></span></li><li class=MsoNormal style='color:black;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;line-height:15.75pt;mso-list:l0 level1 lfo1'><span style='font-size:10.5pt;font-family:"Lucida Sans Unicode",sans-serif'>Local/Private Headers<o:p></o:p></span></li><li class=MsoNormal style='color:black;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;line-height:15.75pt;mso-list:l0 level1 lfo1'><tt><span style='font-size:10.0pt;font-family:Consolas'>llvm/...</span></tt><span style='font-size:10.5pt;font-family:"Lucida Sans Unicode",sans-serif'><o:p></o:p></span></li><li class=MsoNormal style='color:black;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;line-height:15.75pt;mso-list:l0 level1 lfo1'><span style='font-size:10.5pt;font-family:"Lucida Sans Unicode",sans-serif'>System </span><tt><span style='font-size:10.0pt;font-family:Consolas'>#include</span></tt><span style='font-size:10.5pt;font-family:"Lucida Sans Unicode",sans-serif'>s<o:p></o:p></span></li></ol><div><p class=MsoNormal><span style='font-size:10.5pt;font-family:"Lucida Sans Unicode",sans-serif;color:black'>If a program is using LLVM, and also using a third-party library such as GMP, where would the coding standard have the GMP include be placed relative to the above order?</span><o:p></o:p></p></div></div></div></blockquote><div><p class=MsoNormal><br>The LLVM coding conventions are really intended for LLVM's code itself, they probably don't cover many situations that would arise when using LLVM code in broader applications like this... (nor is it likely we'd want to add wording to the style guide to clarify those use cases, unfortunately).<br><br>That said, we do have one (zlib compression?) or two (maybe md5 too?) external libraries used in LLVM, I imagine they get bundled in with the system includes, but I've not looked (& given that there aren't many, they might not be done in any consistent/deliberate manner)<br><br>- Dave<o:p></o:p></p></div></div></div></div></div></body></html>