Skip to content

Commit c5d56fe

Browse files
committed
NFC: .clang-tidy: Inherit configs from parents to improve maintainability
In the interests of disabling misc-no-recursion across LLVM (this seems like a stylistic choice that is not consistent with LLVM's style/development approach) this NFC preliminary change adjusts all the .clang-tidy files to inherit from their parents as much as possible. This change specifically preserves all the quirks of the current configs in order to make it easier to review as NFC. I validatad the change is NFC as follows: for X in `cat ../files.txt`; do mkdir -p ../tmp/$(dirname $X) touch $(dirname $X)/blaikie.cpp clang-tidy -dump-config $(dirname $X)/blaikie.cpp > ../tmp/$(dirname $X)/after rm $(dirname $X)/blaikie.cpp done (similarly for the "before" state, without this patch applied) for X in `cat ../files.txt`; do echo $X diff \ ../tmp/$(dirname $X)/before \ <(cat ../tmp/$(dirname $X)/after \ | sed -e "s/,readability-identifier-naming\(.*\),-readability-identifier-naming/\1/" \ | sed -e "s/,-llvm-include-order\(.*\),llvm-include-order/\1/" \ | sed -e "s/,-misc-no-recursion\(.*\),misc-no-recursion/\1/" \ | sed -e "s/,-clang-diagnostic-\*\(.*\),clang-diagnostic-\*/\1/") done (using sed to strip some add/remove pairs to reduce the diff and make it easier to read) The resulting report is: .clang-tidy clang/.clang-tidy 2c2 < Checks: 'clang-diagnostic-*,clang-analyzer-*,-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,-readability-identifier-naming,-misc-no-recursion' --- > Checks: 'clang-diagnostic-*,clang-analyzer-*,-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,-misc-no-recursion' compiler-rt/.clang-tidy 2c2 < Checks: 'clang-diagnostic-*,clang-analyzer-*,-*,clang-diagnostic-*,llvm-*,-llvm-header-guard,misc-*,-misc-unused-parameters,-misc-non-private-member-variables-in-classes' --- > Checks: 'clang-diagnostic-*,clang-analyzer-*,-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,-llvm-header-guard' flang/.clang-tidy 2c2 < Checks: 'clang-diagnostic-*,clang-analyzer-*,-*,llvm-*,-llvm-include-order,misc-*,-misc-no-recursion,-misc-unused-parameters,-misc-non-private-member-variables-in-classes' --- > Checks: 'clang-diagnostic-*,clang-analyzer-*,-*,llvm-*,misc-*,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,-llvm-include-order,-misc-no-recursion' flang/include/flang/Lower/.clang-tidy flang/include/flang/Optimizer/.clang-tidy flang/lib/Lower/.clang-tidy flang/lib/Optimizer/.clang-tidy lld/.clang-tidy lldb/.clang-tidy llvm/tools/split-file/.clang-tidy mlir/.clang-tidy The `clang/.clang-tidy` change is a no-op, disabling an option that was never enabled. The compiler-rt and flang changes are no-op reorderings of the same flags. (side note, the .clang-tidy file in parallel-libs is broken and crashes clang-tidy because it uses "lowerCase" as the style instead of "lower_case" - so I'll deal with that separately) Differential Revision: https://reviews.llvm.org/D103842
1 parent 491d045 commit c5d56fe

File tree

12 files changed

+20
-129
lines changed

12 files changed

+20
-129
lines changed

clang/.clang-tidy

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,5 @@
1-
Checks: '-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,-readability-identifier-naming,-misc-no-recursion'
21
# Note that the readability-identifier-naming check is disabled, there are too
32
# many violations in the codebase and they create too much noise in clang-tidy
43
# results.
5-
# Naming settings are kept for documentation purposes and allowing to run the
6-
# check if the users would override this file, e.g. via a command-line arg.
7-
CheckOptions:
8-
- key: readability-identifier-naming.ClassCase
9-
value: CamelCase
10-
- key: readability-identifier-naming.EnumCase
11-
value: CamelCase
12-
- key: readability-identifier-naming.FunctionCase
13-
value: camelBack
14-
- key: readability-identifier-naming.MemberCase
15-
value: CamelCase
16-
- key: readability-identifier-naming.ParameterCase
17-
value: CamelCase
18-
- key: readability-identifier-naming.UnionCase
19-
value: CamelCase
20-
- key: readability-identifier-naming.VariableCase
21-
value: CamelCase
22-
- key: readability-identifier-naming.IgnoreMainLikeFunctions
23-
value: 1
24-
4+
Checks: '-readability-identifier-naming,-misc-no-recursion'
5+
InheritParentConfig: true

compiler-rt/.clang-tidy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
# Checks enabled in the top-level .clang-tidy minus readability-identifier-naming and llvm-header-guard.
2-
Checks: '-*,clang-diagnostic-*,llvm-*,-llvm-header-guard,misc-*,-misc-unused-parameters,-misc-non-private-member-variables-in-classes'
1+
Checks: '-readability-identifier-naming,-llvm-header-guard'
2+
InheritParentConfig: true

flang/.clang-tidy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
Checks: '-*,llvm-*,-llvm-include-order,misc-*,-misc-no-recursion,-misc-unused-parameters,-misc-non-private-member-variables-in-classes'
1+
Checks: '-llvm-include-order,-readability-identifier-naming,-misc-no-recursion,-clang-diagnostic-*'
2+
InheritParentConfig: true

flang/include/flang/Lower/.clang-tidy

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,9 @@
1-
# Almost identical to the top-level .clang-tidy, except that {Member,Parameter,Variable}Case use camelBack.
2-
Checks: '-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,readability-identifier-naming'
1+
Checks: 'readability-identifier-naming,llvm-include-order,misc-no-recursion,clang-diagnostic-*'
2+
InheritParentConfig: true
33
CheckOptions:
4-
- key: readability-identifier-naming.ClassCase
5-
value: CamelCase
6-
- key: readability-identifier-naming.EnumCase
7-
value: CamelCase
8-
- key: readability-identifier-naming.FunctionCase
9-
value: camelBack
104
- key: readability-identifier-naming.MemberCase
115
value: camelBack
126
- key: readability-identifier-naming.ParameterCase
137
value: camelBack
14-
- key: readability-identifier-naming.UnionCase
15-
value: CamelCase
168
- key: readability-identifier-naming.VariableCase
179
value: camelBack
18-
- key: readability-identifier-naming.IgnoreMainLikeFunctions
19-
value: 1
Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,9 @@
1-
# Almost identical to the top-level .clang-tidy, except that {Member,Parameter,Variable}Case use camelBack.
2-
Checks: '-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,readability-identifier-naming'
1+
Checks: 'readability-identifier-naming,llvm-include-order,misc-no-recursion,clang-diagnostic-*'
2+
InheritParentConfig: true
33
CheckOptions:
4-
- key: readability-identifier-naming.ClassCase
5-
value: CamelCase
6-
- key: readability-identifier-naming.EnumCase
7-
value: CamelCase
8-
- key: readability-identifier-naming.FunctionCase
9-
value: camelBack
104
- key: readability-identifier-naming.MemberCase
115
value: camelBack
126
- key: readability-identifier-naming.ParameterCase
137
value: camelBack
14-
- key: readability-identifier-naming.UnionCase
15-
value: CamelCase
168
- key: readability-identifier-naming.VariableCase
179
value: camelBack
18-
- key: readability-identifier-naming.IgnoreMainLikeFunctions
19-
value: 1

flang/lib/Lower/.clang-tidy

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,9 @@
1-
# Almost identical to the top-level .clang-tidy, except that {Member,Parameter,Variable}Case use camelBack.
2-
Checks: '-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,readability-identifier-naming'
1+
Checks: 'readability-identifier-naming,llvm-include-order,misc-no-recursion,clang-diagnostic-*'
2+
InheritParentConfig: true
33
CheckOptions:
4-
- key: readability-identifier-naming.ClassCase
5-
value: CamelCase
6-
- key: readability-identifier-naming.EnumCase
7-
value: CamelCase
8-
- key: readability-identifier-naming.FunctionCase
9-
value: camelBack
104
- key: readability-identifier-naming.MemberCase
115
value: camelBack
126
- key: readability-identifier-naming.ParameterCase
137
value: camelBack
14-
- key: readability-identifier-naming.UnionCase
15-
value: CamelCase
168
- key: readability-identifier-naming.VariableCase
179
value: camelBack
18-
- key: readability-identifier-naming.IgnoreMainLikeFunctions
19-
value: 1

flang/lib/Optimizer/.clang-tidy

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,9 @@
1-
# Almost identical to the top-level .clang-tidy, except that {Member,Parameter,Variable}Case use camelBack.
2-
Checks: '-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,readability-identifier-naming'
1+
Checks: 'readability-identifier-naming,llvm-include-order,misc-no-recursion,clang-diagnostic-*'
2+
InheritParentConfig: true
33
CheckOptions:
4-
- key: readability-identifier-naming.ClassCase
5-
value: CamelCase
6-
- key: readability-identifier-naming.EnumCase
7-
value: CamelCase
8-
- key: readability-identifier-naming.FunctionCase
9-
value: camelBack
104
- key: readability-identifier-naming.MemberCase
115
value: camelBack
126
- key: readability-identifier-naming.ParameterCase
137
value: camelBack
14-
- key: readability-identifier-naming.UnionCase
15-
value: CamelCase
168
- key: readability-identifier-naming.VariableCase
179
value: camelBack
18-
- key: readability-identifier-naming.IgnoreMainLikeFunctions
19-
value: 1

lld/.clang-tidy

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,8 @@
1-
# Almost identical to the top-level .clang-tidy, except that {Member,Parameter,Variable}Case use camelBack.
2-
Checks: '-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,readability-identifier-naming'
1+
InheritParentConfig: true
32
CheckOptions:
4-
- key: readability-identifier-naming.ClassCase
5-
value: CamelCase
6-
- key: readability-identifier-naming.EnumCase
7-
value: CamelCase
8-
- key: readability-identifier-naming.FunctionCase
9-
value: camelBack
103
- key: readability-identifier-naming.MemberCase
114
value: camelBack
125
- key: readability-identifier-naming.ParameterCase
136
value: camelBack
14-
- key: readability-identifier-naming.UnionCase
15-
value: CamelCase
167
- key: readability-identifier-naming.VariableCase
178
value: camelBack
18-
- key: readability-identifier-naming.IgnoreMainLikeFunctions
19-
value: 1

lldb/.clang-tidy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
# Checks enabled in the top-level .clang-tidy minus readability-identifier-naming
2-
Checks: '-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,-misc-non-private-member-variables-in-classes'
1+
Checks: '-readability-identifier-naming'
2+
InheritParentConfig: true

llvm/.clang-tidy

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1 @@
1-
Checks: '-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,readability-identifier-naming'
2-
CheckOptions:
3-
- key: readability-identifier-naming.ClassCase
4-
value: CamelCase
5-
- key: readability-identifier-naming.EnumCase
6-
value: CamelCase
7-
- key: readability-identifier-naming.FunctionCase
8-
value: camelBack
9-
- key: readability-identifier-naming.MemberCase
10-
value: CamelCase
11-
- key: readability-identifier-naming.ParameterCase
12-
value: CamelCase
13-
- key: readability-identifier-naming.UnionCase
14-
value: CamelCase
15-
- key: readability-identifier-naming.VariableCase
16-
value: CamelCase
17-
- key: readability-identifier-naming.IgnoreMainLikeFunctions
18-
value: 1
19-
1+
InheritParentConfig: true

0 commit comments

Comments
 (0)