[Lldb-commits] [lldb] c5d56fe - NFC: .clang-tidy: Inherit configs from parents to improve maintainability
David Blaikie via lldb-commits
lldb-commits at lists.llvm.org
Tue Jun 8 08:27:03 PDT 2021
Author: David Blaikie
Date: 2021-06-08T08:25:59-07:00
New Revision: c5d56fec502f36a0c994835ca23bc93a6c682d95
URL: https://github.com/llvm/llvm-project/commit/c5d56fec502f36a0c994835ca23bc93a6c682d95
DIFF: https://github.com/llvm/llvm-project/commit/c5d56fec502f36a0c994835ca23bc93a6c682d95.diff
LOG: 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
Added:
Modified:
clang/.clang-tidy
compiler-rt/.clang-tidy
flang/.clang-tidy
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/.clang-tidy
llvm/tools/split-file/.clang-tidy
mlir/.clang-tidy
Removed:
################################################################################
diff --git a/clang/.clang-tidy b/clang/.clang-tidy
index f517e9246cf85..ed155786f36ba 100644
--- a/clang/.clang-tidy
+++ b/clang/.clang-tidy
@@ -1,24 +1,5 @@
-Checks: '-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,-readability-identifier-naming,-misc-no-recursion'
# Note that the readability-identifier-naming check is disabled, there are too
# many violations in the codebase and they create too much noise in clang-tidy
# results.
-# Naming settings are kept for documentation purposes and allowing to run the
-# check if the users would override this file, e.g. via a command-line arg.
-CheckOptions:
- - key: readability-identifier-naming.ClassCase
- value: CamelCase
- - key: readability-identifier-naming.EnumCase
- value: CamelCase
- - key: readability-identifier-naming.FunctionCase
- value: camelBack
- - key: readability-identifier-naming.MemberCase
- value: CamelCase
- - key: readability-identifier-naming.ParameterCase
- value: CamelCase
- - key: readability-identifier-naming.UnionCase
- value: CamelCase
- - key: readability-identifier-naming.VariableCase
- value: CamelCase
- - key: readability-identifier-naming.IgnoreMainLikeFunctions
- value: 1
-
+Checks: '-readability-identifier-naming,-misc-no-recursion'
+InheritParentConfig: true
diff --git a/compiler-rt/.clang-tidy b/compiler-rt/.clang-tidy
index 4bad5ef216200..c7dba46ad7412 100644
--- a/compiler-rt/.clang-tidy
+++ b/compiler-rt/.clang-tidy
@@ -1,2 +1,2 @@
-# Checks enabled in the top-level .clang-tidy minus readability-identifier-naming and llvm-header-guard.
-Checks: '-*,clang-diagnostic-*,llvm-*,-llvm-header-guard,misc-*,-misc-unused-parameters,-misc-non-private-member-variables-in-classes'
+Checks: '-readability-identifier-naming,-llvm-header-guard'
+InheritParentConfig: true
diff --git a/flang/.clang-tidy b/flang/.clang-tidy
index be9a2b704edd0..c0d51c8dbf5dc 100644
--- a/flang/.clang-tidy
+++ b/flang/.clang-tidy
@@ -1 +1,2 @@
-Checks: '-*,llvm-*,-llvm-include-order,misc-*,-misc-no-recursion,-misc-unused-parameters,-misc-non-private-member-variables-in-classes'
+Checks: '-llvm-include-order,-readability-identifier-naming,-misc-no-recursion,-clang-diagnostic-*'
+InheritParentConfig: true
diff --git a/flang/include/flang/Lower/.clang-tidy b/flang/include/flang/Lower/.clang-tidy
index 87ec2ff53af6e..d2b773fc4b121 100644
--- a/flang/include/flang/Lower/.clang-tidy
+++ b/flang/include/flang/Lower/.clang-tidy
@@ -1,19 +1,9 @@
-# Almost identical to the top-level .clang-tidy, except that {Member,Parameter,Variable}Case use camelBack.
-Checks: '-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,readability-identifier-naming'
+Checks: 'readability-identifier-naming,llvm-include-order,misc-no-recursion,clang-diagnostic-*'
+InheritParentConfig: true
CheckOptions:
- - key: readability-identifier-naming.ClassCase
- value: CamelCase
- - key: readability-identifier-naming.EnumCase
- value: CamelCase
- - key: readability-identifier-naming.FunctionCase
- value: camelBack
- key: readability-identifier-naming.MemberCase
value: camelBack
- key: readability-identifier-naming.ParameterCase
value: camelBack
- - key: readability-identifier-naming.UnionCase
- value: CamelCase
- key: readability-identifier-naming.VariableCase
value: camelBack
- - key: readability-identifier-naming.IgnoreMainLikeFunctions
- value: 1
diff --git a/flang/include/flang/Optimizer/.clang-tidy b/flang/include/flang/Optimizer/.clang-tidy
index 87ec2ff53af6e..d2b773fc4b121 100644
--- a/flang/include/flang/Optimizer/.clang-tidy
+++ b/flang/include/flang/Optimizer/.clang-tidy
@@ -1,19 +1,9 @@
-# Almost identical to the top-level .clang-tidy, except that {Member,Parameter,Variable}Case use camelBack.
-Checks: '-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,readability-identifier-naming'
+Checks: 'readability-identifier-naming,llvm-include-order,misc-no-recursion,clang-diagnostic-*'
+InheritParentConfig: true
CheckOptions:
- - key: readability-identifier-naming.ClassCase
- value: CamelCase
- - key: readability-identifier-naming.EnumCase
- value: CamelCase
- - key: readability-identifier-naming.FunctionCase
- value: camelBack
- key: readability-identifier-naming.MemberCase
value: camelBack
- key: readability-identifier-naming.ParameterCase
value: camelBack
- - key: readability-identifier-naming.UnionCase
- value: CamelCase
- key: readability-identifier-naming.VariableCase
value: camelBack
- - key: readability-identifier-naming.IgnoreMainLikeFunctions
- value: 1
diff --git a/flang/lib/Lower/.clang-tidy b/flang/lib/Lower/.clang-tidy
index 87ec2ff53af6e..d2b773fc4b121 100644
--- a/flang/lib/Lower/.clang-tidy
+++ b/flang/lib/Lower/.clang-tidy
@@ -1,19 +1,9 @@
-# Almost identical to the top-level .clang-tidy, except that {Member,Parameter,Variable}Case use camelBack.
-Checks: '-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,readability-identifier-naming'
+Checks: 'readability-identifier-naming,llvm-include-order,misc-no-recursion,clang-diagnostic-*'
+InheritParentConfig: true
CheckOptions:
- - key: readability-identifier-naming.ClassCase
- value: CamelCase
- - key: readability-identifier-naming.EnumCase
- value: CamelCase
- - key: readability-identifier-naming.FunctionCase
- value: camelBack
- key: readability-identifier-naming.MemberCase
value: camelBack
- key: readability-identifier-naming.ParameterCase
value: camelBack
- - key: readability-identifier-naming.UnionCase
- value: CamelCase
- key: readability-identifier-naming.VariableCase
value: camelBack
- - key: readability-identifier-naming.IgnoreMainLikeFunctions
- value: 1
diff --git a/flang/lib/Optimizer/.clang-tidy b/flang/lib/Optimizer/.clang-tidy
index 87ec2ff53af6e..d2b773fc4b121 100644
--- a/flang/lib/Optimizer/.clang-tidy
+++ b/flang/lib/Optimizer/.clang-tidy
@@ -1,19 +1,9 @@
-# Almost identical to the top-level .clang-tidy, except that {Member,Parameter,Variable}Case use camelBack.
-Checks: '-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,readability-identifier-naming'
+Checks: 'readability-identifier-naming,llvm-include-order,misc-no-recursion,clang-diagnostic-*'
+InheritParentConfig: true
CheckOptions:
- - key: readability-identifier-naming.ClassCase
- value: CamelCase
- - key: readability-identifier-naming.EnumCase
- value: CamelCase
- - key: readability-identifier-naming.FunctionCase
- value: camelBack
- key: readability-identifier-naming.MemberCase
value: camelBack
- key: readability-identifier-naming.ParameterCase
value: camelBack
- - key: readability-identifier-naming.UnionCase
- value: CamelCase
- key: readability-identifier-naming.VariableCase
value: camelBack
- - key: readability-identifier-naming.IgnoreMainLikeFunctions
- value: 1
diff --git a/lld/.clang-tidy b/lld/.clang-tidy
index 87ec2ff53af6e..acd9361b526d6 100644
--- a/lld/.clang-tidy
+++ b/lld/.clang-tidy
@@ -1,19 +1,8 @@
-# Almost identical to the top-level .clang-tidy, except that {Member,Parameter,Variable}Case use camelBack.
-Checks: '-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,readability-identifier-naming'
+InheritParentConfig: true
CheckOptions:
- - key: readability-identifier-naming.ClassCase
- value: CamelCase
- - key: readability-identifier-naming.EnumCase
- value: CamelCase
- - key: readability-identifier-naming.FunctionCase
- value: camelBack
- key: readability-identifier-naming.MemberCase
value: camelBack
- key: readability-identifier-naming.ParameterCase
value: camelBack
- - key: readability-identifier-naming.UnionCase
- value: CamelCase
- key: readability-identifier-naming.VariableCase
value: camelBack
- - key: readability-identifier-naming.IgnoreMainLikeFunctions
- value: 1
diff --git a/lldb/.clang-tidy b/lldb/.clang-tidy
index e949902171e7f..53d48d5facdeb 100644
--- a/lldb/.clang-tidy
+++ b/lldb/.clang-tidy
@@ -1,2 +1,2 @@
-# Checks enabled in the top-level .clang-tidy minus readability-identifier-naming
-Checks: '-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,-misc-non-private-member-variables-in-classes'
+Checks: '-readability-identifier-naming'
+InheritParentConfig: true
diff --git a/llvm/.clang-tidy b/llvm/.clang-tidy
index e7e0830cfec59..47bc73c13f192 100644
--- a/llvm/.clang-tidy
+++ b/llvm/.clang-tidy
@@ -1,19 +1 @@
-Checks: '-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,readability-identifier-naming'
-CheckOptions:
- - key: readability-identifier-naming.ClassCase
- value: CamelCase
- - key: readability-identifier-naming.EnumCase
- value: CamelCase
- - key: readability-identifier-naming.FunctionCase
- value: camelBack
- - key: readability-identifier-naming.MemberCase
- value: CamelCase
- - key: readability-identifier-naming.ParameterCase
- value: CamelCase
- - key: readability-identifier-naming.UnionCase
- value: CamelCase
- - key: readability-identifier-naming.VariableCase
- value: CamelCase
- - key: readability-identifier-naming.IgnoreMainLikeFunctions
- value: 1
-
+InheritParentConfig: true
diff --git a/llvm/tools/split-file/.clang-tidy b/llvm/tools/split-file/.clang-tidy
index 87ec2ff53af6e..acd9361b526d6 100644
--- a/llvm/tools/split-file/.clang-tidy
+++ b/llvm/tools/split-file/.clang-tidy
@@ -1,19 +1,8 @@
-# Almost identical to the top-level .clang-tidy, except that {Member,Parameter,Variable}Case use camelBack.
-Checks: '-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,readability-identifier-naming'
+InheritParentConfig: true
CheckOptions:
- - key: readability-identifier-naming.ClassCase
- value: CamelCase
- - key: readability-identifier-naming.EnumCase
- value: CamelCase
- - key: readability-identifier-naming.FunctionCase
- value: camelBack
- key: readability-identifier-naming.MemberCase
value: camelBack
- key: readability-identifier-naming.ParameterCase
value: camelBack
- - key: readability-identifier-naming.UnionCase
- value: CamelCase
- key: readability-identifier-naming.VariableCase
value: camelBack
- - key: readability-identifier-naming.IgnoreMainLikeFunctions
- value: 1
diff --git a/mlir/.clang-tidy b/mlir/.clang-tidy
index 87ec2ff53af6e..acd9361b526d6 100644
--- a/mlir/.clang-tidy
+++ b/mlir/.clang-tidy
@@ -1,19 +1,8 @@
-# Almost identical to the top-level .clang-tidy, except that {Member,Parameter,Variable}Case use camelBack.
-Checks: '-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,readability-identifier-naming'
+InheritParentConfig: true
CheckOptions:
- - key: readability-identifier-naming.ClassCase
- value: CamelCase
- - key: readability-identifier-naming.EnumCase
- value: CamelCase
- - key: readability-identifier-naming.FunctionCase
- value: camelBack
- key: readability-identifier-naming.MemberCase
value: camelBack
- key: readability-identifier-naming.ParameterCase
value: camelBack
- - key: readability-identifier-naming.UnionCase
- value: CamelCase
- key: readability-identifier-naming.VariableCase
value: camelBack
- - key: readability-identifier-naming.IgnoreMainLikeFunctions
- value: 1
More information about the lldb-commits
mailing list