<p dir="ltr">Hi Florian,</p>
<p dir="ltr">Note that clang-format only sorts #includes in the same block. If you delete the empty line between the two blocks, clang-format should do the right thing for you. </p>
<p dir="ltr">Cheers,<br>
Eric</p>
<br><div class="gmail_quote"><div dir="ltr">On Thu, Jan 5, 2017, 12:36 Florian Lindner 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br class="gmail_msg">
<br class="gmail_msg">
I try to understand the IncludeIsMainRegex setting of clang-format <a href="http://releases.llvm.org/3.9.0/tools/clang/docs/ClangFormatStyleOptions.html" rel="noreferrer" class="gmail_msg" target="_blank">http://releases.llvm.org/3.9.0/tools/clang/docs/ClangFormatStyleOptions.html</a><br class="gmail_msg">
<br class="gmail_msg">
My cpp file indention.cpp contains includes:<br class="gmail_msg">
<br class="gmail_msg">
#include <string><br class="gmail_msg">
<br class="gmail_msg">
#include "../precice/src/action/Action.hpp"<br class="gmail_msg">
#include "indention.hpp"<br class="gmail_msg">
#include <boost/array.hpp><br class="gmail_msg">
<br class="gmail_msg">
Now I try to assess what affect IncludeIsMainRegex has:<br class="gmail_msg">
<br class="gmail_msg">
1) IncludeIsMainRegex: '$' (default for style LLVM)<br class="gmail_msg">
<br class="gmail_msg">
clang-format -style=file indention.cpp<br class="gmail_msg">
shows no effect<br class="gmail_msg">
<br class="gmail_msg">
neither do<br class="gmail_msg">
<br class="gmail_msg">
2) IncludeIsMainRegex: ''<br class="gmail_msg">
3) IncludeIsMainRegex: 'hpp$'<br class="gmail_msg">
4) IncludeIsMainRegex: '\.hpp$<br class="gmail_msg">
5) IncludeIsMainRegex: '.hpp$<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
According to the documentation I expected that 2 and 3 match the suffix and assign category 0 to the include, thus placing it at the top.<br class="gmail_msg">
<br class="gmail_msg">
Where is my understanding wrong?<br class="gmail_msg">
<br class="gmail_msg">
Thanks,<br class="gmail_msg">
Florian<br class="gmail_msg">
_______________________________________________<br class="gmail_msg">
cfe-dev mailing list<br class="gmail_msg">
<a href="mailto:cfe-dev@lists.llvm.org" class="gmail_msg" target="_blank">cfe-dev@lists.llvm.org</a><br class="gmail_msg">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" class="gmail_msg" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br class="gmail_msg">
</blockquote></div>