-
Notifications
You must be signed in to change notification settings - Fork 197
Expand file tree
/
Copy path.clang-tidy
More file actions
149 lines (147 loc) · 6.53 KB
/
Copy path.clang-tidy
File metadata and controls
149 lines (147 loc) · 6.53 KB
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# Copyright (C) 2023-2024 Advanced Micro Devices, Inc.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
# bugprone-unchecked-optional-access was disabled through clang-tidy 17
# (llvm/llvm-project#55530: hung 180s+ on AIEAssignBufferDescriptorIDs.cpp);
# re-enabled since it completes in ~7s under the 20.1.0 pin.
# misc-include-cleaner is excluded, matching LLVM's own .clang-tidy: too
# unreliable on forward-declaration-heavy, template-heavy code.
# clang-analyzer-* is scoped to four suites (Chromium's precedent) rather
# than the full wildcard, which is noisy inside MLIR/LLVM header boilerplate.
# Four sub-checks within those suites are further disabled: they still fire
# on MLIR/LLVM's own internals (StorageUniquerSupport.h, APInt.h, etc., via
# templates instantiated from our code) rather than anything we own, and
# unlike ordinary checks, the static analyzer's diagnostics aren't scoped by
# --header-filter/-line-filter (confirmed: neither suppresses them) nor by
# NOLINT in our own files (the diagnostic's location is inside the vendored
# header, a different file than any NOLINT we could place).
# - StackAddressEscape false-positives on MLIR's StorageUniquerSupport.h
# lambda-returning helpers.
# - CallAndMessage false-positives in mlir::Value's null-check idiom.
# - BitwiseShift false-positives in llvm::SmallBitVector's bit-packing.
# - cplusplus.NewDelete false-positives in llvm::APInt's inline-vs-heap
# storage switch.
# readability-identifier-naming is disabled repo-wide for now: expanding
# enforcement to all 102 production files (see git history) surfaced 614
# pre-existing naming violations that aren't safely batch-fixable (clang-tidy
# -fix corrupted shared headers via overlapping cross-TU edits twice), and
# per-site manual review/rename is a separate, much larger effort tracked
# on its own. Re-enable once that renaming pass lands.
# misc-override-with-different-visibility (new in clang-tidy 22) fires on
# every MLIR pass: mlir::Pass declares runOnOperation() protected, and the
# standard MLIR pass idiom is to override it public. That's the codebase's
# convention, not a bug, so the check has no legitimate use here.
# misc-use-internal-linkage and llvm-prefer-static-over-anonymous-namespace
# both went from zero findings (clang-tidy 20.1.0) to 297 findings across 54
# files (clang-tidy 22.1.8), almost entirely on this codebase's dominant
# idiom of a single pass/pattern struct per .cpp file. Unlike llvm-use-ranges
# (fixed in place, same version bump), neither is safely batch-fixable:
# misc-use-internal-linkage offers no fix-it at all for structs/classes
# (confirmed by direct testing -- only free functions get one), and
# llvm-prefer-static-over-anonymous-namespace's fix-it reports as "applied"
# but does not actually rewrite the file. Disabled following the same
# precedent as readability-identifier-naming below: per-site manual fixes
# are a separate, much larger effort tracked on its own.
Checks: >
-*,
clang-diagnostic-*,
llvm-*,
-llvm-prefer-static-over-anonymous-namespace,
misc-*,
-misc-const-correctness,
-misc-unused-parameters,
-misc-non-private-member-variables-in-classes,
-misc-no-recursion,
-misc-use-anonymous-namespace,
-misc-use-internal-linkage,
-misc-include-cleaner,
-misc-override-with-different-visibility,
-readability-identifier-naming,
bugprone-argument-comment,
bugprone-assert-side-effect,
bugprone-bitwise-pointer-cast,
bugprone-branch-clone,
bugprone-copy-constructor-init,
bugprone-dangling-handle,
bugprone-dynamic-static-initializers,
bugprone-incorrect-enable-shared-from-this,
bugprone-macro-parentheses,
bugprone-macro-repeated-side-effects,
bugprone-misplaced-widening-cast,
bugprone-move-forwarding-reference,
bugprone-multiple-statement-macro,
bugprone-optional-value-conversion,
bugprone-pointer-arithmetic-on-polymorphic-object,
bugprone-return-const-ref-from-parameter,
bugprone-suspicious-semicolon,
bugprone-suspicious-stringview-data-usage,
bugprone-swapped-arguments,
bugprone-terminating-continue,
bugprone-unchecked-optional-access,
bugprone-unused-local-non-trivial-variable,
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-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,
clang-analyzer-core.*,
-clang-analyzer-core.StackAddressEscape,
-clang-analyzer-core.CallAndMessage,
-clang-analyzer-core.BitwiseShift,
clang-analyzer-cplusplus.*,
-clang-analyzer-cplusplus.NewDelete,
clang-analyzer-unix.*,
clang-analyzer-deadcode.*
CheckOptions:
# LLVM
- 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.FunctionIgnoredRegexp
value: "LLVMFuzzerTestOneInput"
- key: readability-identifier-naming.UnionCase
value: CamelCase
- key: readability-identifier-naming.IgnoreMainLikeFunctions
value: 1
- key: readability-redundant-member-init.IgnoreBaseInCopyConstructors
value: 1
- key: modernize-use-default-member-init.UseAssignment
value: 1
# MLIR
- key: readability-identifier-naming.MemberCase
value: camelBack
- key: readability-identifier-naming.ParameterCase
value: camelBack
- key: readability-identifier-naming.VariableCase
value: camelBack