[clang] [CIR] Add .clang-tidy files for ClangIR specific coding style rules (PR #111417)
Nathan Lanza via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 7 12:08:54 PDT 2024
https://github.com/lanza updated https://github.com/llvm/llvm-project/pull/111417
>From 68b7427f371db198a1dc69c36c39192f2f9ab6a9 Mon Sep 17 00:00:00 2001
From: Nathan Lanza <nathanlanza at gmail.com>
Date: Mon, 7 Oct 2024 18:27:46 +0000
Subject: [PATCH 1/2] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20in?=
=?UTF-8?q?itial=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Created using spr 1.3.5
---
clang/include/clang/CIR/.clang-tidy | 61 +++++++++++++++++++
.../clang/CIRFrontendAction/.clang-tidy | 52 ++++++++++++++++
clang/lib/CIR/.clang-tidy | 61 +++++++++++++++++++
3 files changed, 174 insertions(+)
create mode 100644 clang/include/clang/CIR/.clang-tidy
create mode 100644 clang/include/clang/CIRFrontendAction/.clang-tidy
create mode 100644 clang/lib/CIR/.clang-tidy
diff --git a/clang/include/clang/CIR/.clang-tidy b/clang/include/clang/CIR/.clang-tidy
new file mode 100644
index 00000000000000..dfbcf9ccf7c217
--- /dev/null
+++ b/clang/include/clang/CIR/.clang-tidy
@@ -0,0 +1,61 @@
+InheritParentConfig: true
+Checks: >
+ -misc-const-correctness,
+ bugprone-argument-comment,
+ bugprone-assert-side-effect,
+ bugprone-branch-clone,
+ bugprone-copy-constructor-init,
+ bugprone-dangling-handle,
+ bugprone-dynamic-static-initializers,
+ bugprone-macro-parentheses,
+ bugprone-macro-repeated-side-effects,
+ bugprone-misplaced-widening-cast,
+ bugprone-move-forwarding-reference,
+ bugprone-multiple-statement-macro,
+ bugprone-suspicious-semicolon,
+ bugprone-swapped-arguments,
+ bugprone-terminating-continue,
+ bugprone-unused-raii,
+ bugprone-unused-return-value,
+ misc-redundant-expression,
+ misc-static-assert,
+ misc-unused-using-decls,
+ modernize-use-bool-literals,
+ modernize-loop-convert,
+ modernize-make-unique,
+ modernize-raw-string-literal,
+ modernize-use-equals-default,
+ modernize-use-default-member-init,
+ modernize-use-emplace,
+ modernize-use-nullptr,
+ modernize-use-override,
+ modernize-use-using,
+ performance-for-range-copy,
+ performance-implicit-conversion-in-loop,
+ performance-inefficient-algorithm,
+ performance-inefficient-vector-operation,
+ performance-move-const-arg,
+ performance-no-automatic-move,
+ performance-trivially-destructible,
+ performance-unnecessary-copy-initialization,
+ performance-unnecessary-value-param,
+ readability-avoid-const-params-in-decls,
+ readability-const-return-type,
+ readability-container-size-empty,
+ readability-identifier-naming,
+ readability-inconsistent-declaration-parameter-name,
+ readability-misleading-indentation,
+ readability-redundant-control-flow,
+ readability-redundant-smartptr-get,
+ readability-simplify-boolean-expr,
+ readability-simplify-subscript-expr,
+ readability-use-anyofallof
+
+
+CheckOptions:
+ - key: readability-identifier-naming.MemberCase
+ value: camelBack
+ - key: readability-identifier-naming.ParameterCase
+ value: camelBack
+ - key: readability-identifier-naming.VariableCase
+ value: camelBack
diff --git a/clang/include/clang/CIRFrontendAction/.clang-tidy b/clang/include/clang/CIRFrontendAction/.clang-tidy
new file mode 100644
index 00000000000000..ffcc0a2903fe32
--- /dev/null
+++ b/clang/include/clang/CIRFrontendAction/.clang-tidy
@@ -0,0 +1,52 @@
+InheritParentConfig: true
+Checks: >
+ -misc-const-correctness,
+ bugprone-argument-comment,
+ bugprone-assert-side-effect,
+ bugprone-branch-clone,
+ bugprone-copy-constructor-init,
+ bugprone-dangling-handle,
+ bugprone-dynamic-static-initializers,
+ bugprone-macro-parentheses,
+ bugprone-macro-repeated-side-effects,
+ bugprone-misplaced-widening-cast,
+ bugprone-move-forwarding-reference,
+ bugprone-multiple-statement-macro,
+ bugprone-suspicious-semicolon,
+ bugprone-swapped-arguments,
+ bugprone-terminating-continue,
+ bugprone-unused-raii,
+ bugprone-unused-return-value,
+ misc-redundant-expression,
+ misc-static-assert,
+ misc-unused-using-decls,
+ modernize-use-bool-literals,
+ modernize-loop-convert,
+ modernize-make-unique,
+ modernize-raw-string-literal,
+ modernize-use-equals-default,
+ modernize-use-default-member-init,
+ modernize-use-emplace,
+ modernize-use-nullptr,
+ modernize-use-override,
+ modernize-use-using,
+ performance-for-range-copy,
+ performance-implicit-conversion-in-loop,
+ performance-inefficient-algorithm,
+ performance-inefficient-vector-operation,
+ performance-move-const-arg,
+ performance-no-automatic-move,
+ performance-trivially-destructible,
+ performance-unnecessary-copy-initialization,
+ performance-unnecessary-value-param,
+ readability-avoid-const-params-in-decls,
+ readability-const-return-type,
+ readability-container-size-empty,
+ readability-identifier-naming,
+ readability-inconsistent-declaration-parameter-name,
+ readability-misleading-indentation,
+ readability-redundant-control-flow,
+ readability-redundant-smartptr-get,
+ readability-simplify-boolean-expr,
+ readability-simplify-subscript-expr,
+ readability-use-anyofallof
diff --git a/clang/lib/CIR/.clang-tidy b/clang/lib/CIR/.clang-tidy
new file mode 100644
index 00000000000000..dfbcf9ccf7c217
--- /dev/null
+++ b/clang/lib/CIR/.clang-tidy
@@ -0,0 +1,61 @@
+InheritParentConfig: true
+Checks: >
+ -misc-const-correctness,
+ bugprone-argument-comment,
+ bugprone-assert-side-effect,
+ bugprone-branch-clone,
+ bugprone-copy-constructor-init,
+ bugprone-dangling-handle,
+ bugprone-dynamic-static-initializers,
+ bugprone-macro-parentheses,
+ bugprone-macro-repeated-side-effects,
+ bugprone-misplaced-widening-cast,
+ bugprone-move-forwarding-reference,
+ bugprone-multiple-statement-macro,
+ bugprone-suspicious-semicolon,
+ bugprone-swapped-arguments,
+ bugprone-terminating-continue,
+ bugprone-unused-raii,
+ bugprone-unused-return-value,
+ misc-redundant-expression,
+ misc-static-assert,
+ misc-unused-using-decls,
+ modernize-use-bool-literals,
+ modernize-loop-convert,
+ modernize-make-unique,
+ modernize-raw-string-literal,
+ modernize-use-equals-default,
+ modernize-use-default-member-init,
+ modernize-use-emplace,
+ modernize-use-nullptr,
+ modernize-use-override,
+ modernize-use-using,
+ performance-for-range-copy,
+ performance-implicit-conversion-in-loop,
+ performance-inefficient-algorithm,
+ performance-inefficient-vector-operation,
+ performance-move-const-arg,
+ performance-no-automatic-move,
+ performance-trivially-destructible,
+ performance-unnecessary-copy-initialization,
+ performance-unnecessary-value-param,
+ readability-avoid-const-params-in-decls,
+ readability-const-return-type,
+ readability-container-size-empty,
+ readability-identifier-naming,
+ readability-inconsistent-declaration-parameter-name,
+ readability-misleading-indentation,
+ readability-redundant-control-flow,
+ readability-redundant-smartptr-get,
+ readability-simplify-boolean-expr,
+ readability-simplify-subscript-expr,
+ readability-use-anyofallof
+
+
+CheckOptions:
+ - key: readability-identifier-naming.MemberCase
+ value: camelBack
+ - key: readability-identifier-naming.ParameterCase
+ value: camelBack
+ - key: readability-identifier-naming.VariableCase
+ value: camelBack
>From 78336f8784260bc84245b6c83935beeff08eeea8 Mon Sep 17 00:00:00 2001
From: Nathan Lanza <nathanlanza at gmail.com>
Date: Mon, 7 Oct 2024 19:08:45 +0000
Subject: [PATCH 2/2] remove llvm-header-guard since it doens't work right
Created using spr 1.3.5
---
clang/include/clang/CIR/.clang-tidy | 1 +
clang/include/clang/CIRFrontendAction/.clang-tidy | 1 +
clang/lib/CIR/.clang-tidy | 1 +
3 files changed, 3 insertions(+)
diff --git a/clang/include/clang/CIR/.clang-tidy b/clang/include/clang/CIR/.clang-tidy
index dfbcf9ccf7c217..aaba4585494d66 100644
--- a/clang/include/clang/CIR/.clang-tidy
+++ b/clang/include/clang/CIR/.clang-tidy
@@ -1,6 +1,7 @@
InheritParentConfig: true
Checks: >
-misc-const-correctness,
+ -llvm-header-guard,
bugprone-argument-comment,
bugprone-assert-side-effect,
bugprone-branch-clone,
diff --git a/clang/include/clang/CIRFrontendAction/.clang-tidy b/clang/include/clang/CIRFrontendAction/.clang-tidy
index ffcc0a2903fe32..ef88dbcec488c8 100644
--- a/clang/include/clang/CIRFrontendAction/.clang-tidy
+++ b/clang/include/clang/CIRFrontendAction/.clang-tidy
@@ -1,6 +1,7 @@
InheritParentConfig: true
Checks: >
-misc-const-correctness,
+ -llvm-header-guard,
bugprone-argument-comment,
bugprone-assert-side-effect,
bugprone-branch-clone,
diff --git a/clang/lib/CIR/.clang-tidy b/clang/lib/CIR/.clang-tidy
index dfbcf9ccf7c217..aaba4585494d66 100644
--- a/clang/lib/CIR/.clang-tidy
+++ b/clang/lib/CIR/.clang-tidy
@@ -1,6 +1,7 @@
InheritParentConfig: true
Checks: >
-misc-const-correctness,
+ -llvm-header-guard,
bugprone-argument-comment,
bugprone-assert-side-effect,
bugprone-branch-clone,
More information about the cfe-commits
mailing list