tud-zih-energy / lo2s

Linux OTF2 Sampling - A Lightweight Node-Level Performance Monitoring Tool
https://tu-dresden.de/zih/forschung/projekte/lo2s?set_language=en
GNU General Public License v3.0
46 stars 13 forks source link

Update clang-format file for include grouping #326

Open bmario opened 6 months ago

bmario commented 6 months ago

We decided to order includes in the following format:

<main file header>

<lo2s group>

<cpp dependencies group>

<std lib group>

<cstr lib group>

extern "C" {
<c dependencies>
}

It's possible to explain that to clang-format:

bmario commented 6 months ago

We need https://clang.llvm.org/docs/ClangFormatStyleOptions.html#mainincludechar

Which is Part of clang format 19 ...

bmario commented 6 months ago

With clang-format-19 this works. With older versions it doesn't.


MainIncludeChar: Any
IncludeBlocks: Regroup
IncludeCategories:
  - Regex: '^<lo2s/'
    Priority: 2
  - Regex: '(hpp|hxx)>$'
    Priority: 3
  - Regex: '^<([^c][[:alnum:]|_]+|chrono|compare|charconv|complex|condition_variable|codecvt|coroutine|concepts)>$'
    Priority: 4 
  - Regex: '^<c[[:alnum:]|_]+>'
    Priority: 5
  - Regex: '\.h>'
    Priority: 6
tilsche commented 5 months ago

clang-format 19 is not yet released. So we do have to wait a bit.