/ .clang-format
.clang-format
  1  # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  2  #                                                        // clang-format // law
  3  # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  4  #
  5  #     "The sky above the port was the color of television, tuned to a dead
  6  #      channel."
  7  #
  8  #                                                               — Neuromancer
  9  #
 10  # Mechanical layout only. No semantic awareness, just pretty-printing.
 11  # Runs first in the lint pipeline, rewrites files.
 12  #
 13  # See: docs/guidelines/03-cpp.md for rationale.
 14  #
 15  # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 16  ---
 17  Language: Cpp
 18  Standard: Latest
 19  BasedOnStyle: LLVM
 20  
 21  # ══════════════════════════════════════════════════════════════════════════════
 22  #                                                              // indentation
 23  # ══════════════════════════════════════════════════════════════════════════════
 24  
 25  IndentWidth: 2
 26  TabWidth: 2
 27  UseTab: Never
 28  IndentCaseLabels: true
 29  IndentPPDirectives: AfterHash
 30  NamespaceIndentation: None
 31  AccessModifierOffset: -2
 32  
 33  # ══════════════════════════════════════════════════════════════════════════════
 34  #                                                                    // braces
 35  # ══════════════════════════════════════════════════════════════════════════════
 36  
 37  BreakBeforeBraces: Attach
 38  Cpp11BracedListStyle: true
 39  AllowShortBlocksOnASingleLine: Never
 40  AllowShortIfStatementsOnASingleLine: Never
 41  AllowShortLoopsOnASingleLine: false
 42  AllowShortFunctionsOnASingleLine: Inline
 43  AllowShortLambdasOnASingleLine: All
 44  AllowShortCaseLabelsOnASingleLine: false
 45  
 46  # ══════════════════════════════════════════════════════════════════════════════
 47  #                                                              // line // length
 48  # ══════════════════════════════════════════════════════════════════════════════
 49  
 50  ColumnLimit: 100
 51  
 52  # ══════════════════════════════════════════════════════════════════════════════
 53  #                                                                 // alignment
 54  # ══════════════════════════════════════════════════════════════════════════════
 55  
 56  AlignConsecutiveAssignments: false
 57  AlignConsecutiveDeclarations: false
 58  AlignConsecutiveMacros: false
 59  AlignOperands: true
 60  AlignTrailingComments: true
 61  DerivePointerAlignment: false
 62  PointerAlignment: Left
 63  
 64  # ══════════════════════════════════════════════════════════════════════════════
 65  #                                                                   // spacing
 66  # ══════════════════════════════════════════════════════════════════════════════
 67  
 68  SpaceAfterCStyleCast: false
 69  SpaceAfterLogicalNot: false
 70  SpaceAfterTemplateKeyword: true
 71  SpaceBeforeAssignmentOperators: true
 72  SpaceBeforeParens: ControlStatements
 73  SpaceInEmptyParentheses: false
 74  SpacesInAngles: Never
 75  SpacesInContainerLiterals: false
 76  SpacesInCStyleCastParentheses: false
 77  SpacesInParentheses: false
 78  SpacesInSquareBrackets: false
 79  
 80  # ══════════════════════════════════════════════════════════════════════════════
 81  #                                                             // line // breaks
 82  # ══════════════════════════════════════════════════════════════════════════════
 83  
 84  AlwaysBreakAfterReturnType: None
 85  AlwaysBreakBeforeMultilineStrings: false
 86  AlwaysBreakTemplateDeclarations: Yes
 87  BinPackArguments: true
 88  BinPackParameters: true
 89  BreakBeforeBinaryOperators: None
 90  BreakBeforeTernaryOperators: true
 91  BreakConstructorInitializers: BeforeColon
 92  BreakInheritanceList: BeforeColon
 93  BreakStringLiterals: true
 94  KeepEmptyLinesAtTheStartOfBlocks: false
 95  MaxEmptyLinesToKeep: 2
 96  PackConstructorInitializers: NextLine
 97  
 98  # ══════════════════════════════════════════════════════════════════════════════
 99  #                                                                  // includes
100  # ══════════════════════════════════════════════════════════════════════════════
101  #
102  # Sort order:
103  #   1. CUDA/NV headers (cub, thrust, cutlass, cute, nv::std)
104  #   2. C++ standard library (<algorithm>, <memory>, etc.)
105  #   3. C standard library wrappers (<cstdio>, <cstdlib>)
106  #   4. C standard library (<stdio.h>, <stdlib.h>)
107  #   5. System/platform headers
108  #   6. straylight:: namespace
109  #   7. s4:: namespace
110  #   8. Local project headers
111  #
112  # ══════════════════════════════════════════════════════════════════════════════
113  
114  SortIncludes: CaseSensitive
115  IncludeBlocks: Regroup
116  IncludeIsMainRegex: '$'
117  IncludeCategories:
118    # ── nv // cuda // cccl ───────────────────────────────────────────────────
119    - Regex: '^<(cuda|cub|thrust|cutlass|cute|nv).*>'
120      Priority: 1
121      SortPriority: 1
122  
123    # ── cpp // standard // library ───────────────────────────────────────────
124    - Regex: '^<[a-z_]+>'
125      Priority: 2
126      SortPriority: 2
127  
128    # ── c // wrappers ────────────────────────────────────────────────────────
129    - Regex: '^<c[a-z]+>'
130      Priority: 3
131      SortPriority: 3
132  
133    # ── c // headers ─────────────────────────────────────────────────────────
134    - Regex: '^<.*\.h>'
135      Priority: 4
136      SortPriority: 4
137  
138    # ── system // headers ────────────────────────────────────────────────────
139    - Regex: '^<.*>'
140      Priority: 5
141      SortPriority: 5
142  
143    # ── straylight // namespace ──────────────────────────────────────────────
144    - Regex: '^"straylight/'
145      Priority: 10
146      SortPriority: 10
147  
148    # ── s4 // namespace ──────────────────────────────────────────────────────
149    - Regex: '^"s4/'
150      Priority: 11
151      SortPriority: 11
152  
153    # ── local // project ─────────────────────────────────────────────────────
154    - Regex: '^"'
155      Priority: 20
156      SortPriority: 20
157  
158  # ══════════════════════════════════════════════════════════════════════════════
159  #                                                                     // other
160  # ══════════════════════════════════════════════════════════════════════════════
161  
162  ReflowComments: true
163  SortUsingDeclarations: true
164  FixNamespaceComments: true
165  CompactNamespaces: false