[cfe-dev] Understanding clang-format's IncludeIsMainRegex
Florian Lindner via cfe-dev
cfe-dev at lists.llvm.org
Fri Jan 6 10:28:33 PST 2017
Hey,
Am 05.01.2017 um 15:01 schrieb Eric Liu:
> Hi Florian,
>
> 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.
Thanks, that seem to work. Is that documented somewhere? Maybe it should be added.
Best,
Florian
>
> Cheers,
> Eric
>
>
> On Thu, Jan 5, 2017, 12:36 Florian Lindner via cfe-dev <cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>> wrote:
>
> Hello,
>
> I try to understand the IncludeIsMainRegex setting of clang-format http://releases.llvm.org/3.9.0/tools/clang/docs/ClangFormatStyleOptions.html
>
> My cpp file indention.cpp contains includes:
>
> #include <string>
>
> #include "../precice/src/action/Action.hpp"
> #include "indention.hpp"
> #include <boost/array.hpp>
>
> Now I try to assess what affect IncludeIsMainRegex has:
>
> 1) IncludeIsMainRegex: '$' (default for style LLVM)
>
> clang-format -style=file indention.cpp
> shows no effect
>
> neither do
>
> 2) IncludeIsMainRegex: ''
> 3) IncludeIsMainRegex: 'hpp$'
> 4) IncludeIsMainRegex: '\.hpp$
> 5) IncludeIsMainRegex: '.hpp$
>
>
> 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.
>
> Where is my understanding wrong?
>
> Thanks,
> Florian
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
More information about the cfe-dev
mailing list