summaryrefslogtreecommitdiff
path: root/src/amd/compiler/.clang-format
blob: 84332d8d742c09495549e5e368be8ae8a05ebe85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133

# TODO: Inherit Style from RADV when Clang 13 is default.
# BasedOnStyle: InheritParentConfig

# Copied from /src/amd/.clang-format
# ACO specific rules can be found below
AlignAfterOpenBracket: true
AlignConsecutiveMacros: true
AllowAllArgumentsOnNextLine: false
AlwaysBreakAfterReturnType: TopLevelDefinitions
BasedOnStyle: LLVM
BinPackArguments: true
BinPackParameters: true
BreakBeforeBraces: Custom
ColumnLimit: 100
ContinuationIndentWidth: 3
Cpp11BracedListStyle: true
ForEachMacros:
  - LIST_FOR_EACH_ENTRY
  - LIST_FOR_EACH_ENTRY_SAFE
  - foreach_list_typed
  - util_dynarray_foreach
  - nir_foreach_variable
  - nir_foreach_variable_safe
  - nir_foreach_register
  - nir_foreach_register_safe
  - nir_foreach_use
  - nir_foreach_use_safe
  - nir_foreach_if_use
  - nir_foreach_if_use_safe
  - nir_foreach_def
  - nir_foreach_def_safe
  - nir_foreach_phi_src
  - nir_foreach_phi_src_safe
  - nir_foreach_parallel_copy_entry
  - nir_foreach_instr
  - nir_foreach_instr_reverse
  - nir_foreach_instr_safe
  - nir_foreach_instr_reverse_safe
  - nir_foreach_function
  - nir_foreach_block
  - nir_foreach_block_safe
  - nir_foreach_block_reverse
  - nir_foreach_block_reverse_safe
  - nir_foreach_block_in_cf_node
  - nir_foreach_shader_in_variable
  - nir_foreach_shader_out_variable_safe
  - nir_foreach_variable_in_list
  - nir_foreach_src
  - foreach_two_lists
  - foreach_bit
  - foreach_sched_node
  - foreach_src
  - foreach_src_n
  - foreach_ssa_use
  - foreach_ssa_srcp_n
  - foreach_ssa_srcp
  - foreach_ssa_src_n
  - foreach_ssa_src
  - foreach_input_n
  - foreach_input
  - foreach_output_n
  - foreach_output
  - foreach_instr
  - foreach_instr_rev
  - foreach_instr_safe
  - foreach_block
  - foreach_block_safe
  - foreach_block_rev
  - foreach_array
  - foreach_array_safe
  - foreach_name_n
  - foreach_name
  - foreach_def
  - foreach_use
  - set_foreach
  - u_foreach_bit
  - u_foreach_bit64

IndentWidth: 3
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyExcessCharacter: 100
SpaceAfterCStyleCast: false
SpaceBeforeCpp11BracedList: false
SpacesInContainerLiterals: false


# ACO clang-format rules:
Language: Cpp
Standard: c++14

# Force pointers to the type for C++
DerivePointerAlignment: false
PointerAlignment: Left

# Same effect as IndentAccessModifiers: False
AccessModifierOffset: -3

# Compact some cumbersome C++ code
SpaceBeforeCtorInitializerColon: True
AllowShortCaseLabelsOnASingleLine: True
AllowShortFunctionsOnASingleLine: InlineOnly
AllowShortBlocksOnASingleLine: Empty
AllowShortLambdasOnASingleLine: All

# Wrap before LambdaBody and disable SplitEmptyFunction
BraceWrapping:
  AfterControlStatement: false
  AfterEnum: false
  AfterFunction: true
  AfterStruct: false
  BeforeElse: false
  SplitEmptyFunction: false
  SplitEmptyRecord: false
  BeforeLambdaBody: true

# Regroup #include blocks
IncludeBlocks: Regroup
IncludeCategories:
  - Regex:           '"aco.*'
    Priority:        1
  - Regex:           '"(common|llvm|vulkan)\/.*'
    Priority:        2
  - Regex:           '"(nir|util\/).*'
    Priority:        3
  - Regex:           '.*\/.*'
    Priority:        4
  - Regex:           '.*'
    Priority:        5

MacroBlockBegin: 'BEGIN_TEST'
MacroBlockEnd: 'END_TEST'
CommentPragmas: '^(!|;|>>|~)'