summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/netlist/build/.clang-format
blob: d312a0798cc74cd97e577533f21b924f7a23f17c (plain) (blame)
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
Language: Cpp
Standard: c++17
UseTab: ForContinuationAndIndentation
TabWidth: 4
IndentWidth: 4
ColumnLimit: 80
ContinuationIndentWidth: 4
ConstructorInitializerIndentWidth: 0
NamespaceIndentation: All
CompactNamespaces: true
FixNamespaceComments: true

IndentAccessModifiers: false
AccessModifierOffset: -4
IndentCaseLabels: true

BreakBeforeBraces: Allman
BreakBeforeBinaryOperators: All
BreakConstructorInitializers: BeforeComma
# Currentline doesn't work
# PackConstructorInitializers: CurrentLine >= 14
BreakStringLiterals: false
# Multiline does not work in clang-format 13
# AlwaysBreakTemplateDeclarations: MultiLine
AlwaysBreakTemplateDeclarations: Yes
# AfterComma does not work <= 13
#BreakInheritanceList: AfterComma
BreakInheritanceList: BeforeComma
#BreakInheritanceList: false
SpaceBeforeInheritanceColon: true

#AlignAfterOpenBracket: DontAlign
AlignAfterOpenBracket: Align
PointerAlignment: Right
ReferenceAlignment: Right
SpacesInAngles: false
SpaceBeforeAssignmentOperators: true
AlignConsecutiveDeclarations: true

#Clang>=14
#AlignArrayOfStructures: Left

AllowShortIfStatementsOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: true
AllowAllArgumentsOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false

PenaltyBreakComment: 1
PenaltyBreakAssignment: 1000
AlwaysBreakBeforeMultilineStrings: true 

PenaltyReturnTypeOnItsOwnLine: 1

# SortIncludes: CaseSensitive # >= 13!
SortIncludes: true
IncludeBlocks: Regroup

IncludeCategories:
  - Regex:           '^(("|"../)core)/'
    Priority:        20
  - Regex:           '^(("|"../)analog)/'
    Priority:        21
  - Regex:           '^(("|"../)devices)/'
    Priority:        22
  - Regex:           '^(("|"../)solver)/'
    Priority:        23
  - Regex:           '^(("|"../)plib)/'
    Priority:        30
  - Regex:           '<[([:alnum:]|_).]+>'
    Priority:        40
  - Regex:           '.*'
    Priority:        10

StatementMacros: 
  - "DIPPINS"
  - "TT_HEAD"
  - "TT_LINE"
  - "TT_FAMILY"
#  - "TRUTH_TABLE"
#  - "NETLIB_DEVICE_IMPL_NS"
#  - "TTL_7400_NAND"
#  - "TTL_7402_NOR"
#  - "NET_C"
#  - "TRUTHTABLE_ENTRY"
  - "LOCAL_LIB_ENTRY"

#StatementAttributeLikeMacros: 
#  - "NETLIST_NAME"
#  - "NETLIB_NAME"

TypenameMacros: 
  - "NETLIST_NAME"
  - "NETLIB_NAME"
  - "PENUM"

WhitespaceSensitiveMacros: 
  - "ALIAS"
  - "DIPPINS"
  - "NET_C"
  - "PENUM"

IndentPPDirectives: BeforeHash
MacroBlockBegin: "^static NETLIST_START\\(.+\\)|static TRUTHTABLE_START\\(.*\\)$"
MacroBlockEnd: "^NETLIST_END\\(\\)|TRUTHTABLE_END\\(\\)$"

# Avoid formatting 
# -- clang-tidy
#  - cspell
#  - Doxygen tables
#  - Doxygen commands
#  - ignored comments
#  - nltool parsed documentation
CommentPragmas:  '^( NOLINT.+| spell-checker.+|/ \|.+|/ \\.+|#.+|-.+)'