xref: /llvm-project/clang/include/clang/Basic/DiagnosticGroups.td (revision 8a334af417ff2ef49e0bc74f9421b4f3aa479805)
1//==--- DiagnosticGroups.td - Diagnostic Group Definitions ----------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9def ImplicitFunctionDeclare : DiagGroup<"implicit-function-declaration">;
10def ImplicitInt : DiagGroup<"implicit-int">;
11
12// Aggregation warning settings.
13def Implicit : DiagGroup<"implicit", [
14    ImplicitFunctionDeclare,
15    ImplicitInt
16]>;
17
18// Empty DiagGroups are recognized by clang but ignored.
19def ODR : DiagGroup<"odr">;
20def : DiagGroup<"abi">;
21def : DiagGroup<"gnu-empty-initializer">; // Now a C extension, not GNU.
22def AbsoluteValue : DiagGroup<"absolute-value">;
23def MisspelledAssumption : DiagGroup<"misspelled-assumption">;
24def UnknownAssumption : DiagGroup<"unknown-assumption">;
25def AddressOfTemporary : DiagGroup<"address-of-temporary">;
26def : DiagGroup<"aggregate-return">;
27def GNUAlignofExpression : DiagGroup<"gnu-alignof-expression">;
28def AmbigMemberTemplate : DiagGroup<"ambiguous-member-template">;
29def GNUAnonymousStruct : DiagGroup<"gnu-anonymous-struct">;
30def GNUAutoType : DiagGroup<"gnu-auto-type">;
31def ArrayBounds : DiagGroup<"array-bounds">;
32def ArrayBoundsPointerArithmetic : DiagGroup<"array-bounds-pointer-arithmetic">;
33def ArrayParameter : DiagGroup<"array-parameter">;
34def AutoDisableVptrSanitizer : DiagGroup<"auto-disable-vptr-sanitizer">;
35def Availability : DiagGroup<"availability">;
36def Section : DiagGroup<"section">;
37def : DiagGroup<"auto-import">;
38def FrameworkHdrQuotedInclude : DiagGroup<"quoted-include-in-framework-header">;
39def FrameworkIncludePrivateFromPublic :
40  DiagGroup<"framework-include-private-from-public">;
41def DeprecatedModuleDotMap : DiagGroup<"deprecated-module-dot-map">;
42def FrameworkHdrAtImport : DiagGroup<"atimport-in-framework-header">;
43def CXX14BinaryLiteral : DiagGroup<"c++14-binary-literal">;
44def CXXPre14CompatBinaryLiteral : DiagGroup<"c++98-c++11-compat-binary-literal">;
45def BinaryLiteral : DiagGroup<"binary-literal", [CXX14BinaryLiteral,
46                                                 CXXPre14CompatBinaryLiteral]>;
47def GNUCompoundLiteralInitializer : DiagGroup<"gnu-compound-literal-initializer">;
48def SingleBitBitFieldConstantConversion :
49  DiagGroup<"single-bit-bitfield-constant-conversion">;
50def BitFieldConstantConversion : DiagGroup<"bitfield-constant-conversion",
51                                           [SingleBitBitFieldConstantConversion]>;
52def BitFieldEnumConversion : DiagGroup<"bitfield-enum-conversion">;
53def BitFieldWidth : DiagGroup<"bitfield-width">;
54def CompoundTokenSplitByMacro : DiagGroup<"compound-token-split-by-macro">;
55def CompoundTokenSplitBySpace : DiagGroup<"compound-token-split-by-space">;
56def CompoundTokenSplit : DiagGroup<"compound-token-split",
57                                   [CompoundTokenSplitByMacro,
58                                    CompoundTokenSplitBySpace]>;
59def CoroutineMissingUnhandledException :
60  DiagGroup<"coroutine-missing-unhandled-exception">;
61def DeprecatedCoroutine :
62  DiagGroup<"deprecated-coroutine">;
63def AlwaysInlineCoroutine :
64  DiagGroup<"always-inline-coroutine">;
65def CoroNonAlignedAllocationFunction :
66  DiagGroup<"coro-non-aligned-allocation-function">;
67def Coroutine : DiagGroup<"coroutine", [CoroutineMissingUnhandledException, DeprecatedCoroutine,
68                                        AlwaysInlineCoroutine, CoroNonAlignedAllocationFunction]>;
69def ObjCBoolConstantConversion : DiagGroup<"objc-bool-constant-conversion">;
70def ConstantConversion : DiagGroup<"constant-conversion",
71                                   [BitFieldConstantConversion,
72                                    ObjCBoolConstantConversion]>;
73def LiteralConversion : DiagGroup<"literal-conversion">;
74def StringConversion : DiagGroup<"string-conversion">;
75def SignConversion : DiagGroup<"sign-conversion">;
76def PointerBoolConversion : DiagGroup<"pointer-bool-conversion">;
77def UndefinedBoolConversion : DiagGroup<"undefined-bool-conversion">;
78def BitwiseInsteadOfLogical : DiagGroup<"bitwise-instead-of-logical">;
79def BoolOperation : DiagGroup<"bool-operation", [BitwiseInsteadOfLogical]>;
80def BoolConversion : DiagGroup<"bool-conversion", [PointerBoolConversion,
81                                                   UndefinedBoolConversion]>;
82def IntConversion : DiagGroup<"int-conversion">;
83def ClassConversion: DiagGroup<"class-conversion">;
84def DeprecatedEnumCompareConditional :
85  DiagGroup<"deprecated-enum-compare-conditional">;
86def EnumCompareConditional : DiagGroup<"enum-compare-conditional",
87                                       [DeprecatedEnumCompareConditional]>;
88def EnumCompareSwitch : DiagGroup<"enum-compare-switch">;
89def DeprecatedEnumCompare : DiagGroup<"deprecated-enum-compare">;
90def EnumCompare : DiagGroup<"enum-compare", [EnumCompareSwitch,
91                                             DeprecatedEnumCompare]>;
92def DeprecatedAnonEnumEnumConversion : DiagGroup<"deprecated-anon-enum-enum-conversion">;
93def DeprecatedEnumEnumConversion : DiagGroup<"deprecated-enum-enum-conversion">;
94def DeprecatedEnumFloatConversion : DiagGroup<"deprecated-enum-float-conversion">;
95def AnonEnumEnumConversion : DiagGroup<"anon-enum-enum-conversion",
96                                   [DeprecatedAnonEnumEnumConversion]>;
97def EnumEnumConversion : DiagGroup<"enum-enum-conversion",
98                                   [DeprecatedEnumEnumConversion]>;
99def EnumFloatConversion : DiagGroup<"enum-float-conversion",
100                                    [DeprecatedEnumFloatConversion]>;
101def EnumConversion : DiagGroup<"enum-conversion",
102                               [EnumEnumConversion,
103                                EnumFloatConversion,
104                                EnumCompareConditional]>;
105def DeprecatedOFast : DiagGroup<"deprecated-ofast">;
106def ObjCSignedCharBoolImplicitIntConversion :
107  DiagGroup<"objc-signed-char-bool-implicit-int-conversion">;
108def Shorten64To32 : DiagGroup<"shorten-64-to-32">;
109def ImplicitIntConversion : DiagGroup<"implicit-int-conversion",
110                                     [Shorten64To32,
111                                      ObjCSignedCharBoolImplicitIntConversion]>;
112def ImplicitConstIntFloatConversion : DiagGroup<"implicit-const-int-float-conversion">;
113def ImplicitIntFloatConversion : DiagGroup<"implicit-int-float-conversion",
114 [ImplicitConstIntFloatConversion]>;
115def ObjCSignedCharBoolImplicitFloatConversion :
116  DiagGroup<"objc-signed-char-bool-implicit-float-conversion">;
117def ImplicitFloatConversion : DiagGroup<"implicit-float-conversion",
118  [ImplicitIntFloatConversion,
119   ObjCSignedCharBoolImplicitFloatConversion]>;
120def ImplicitFixedPointConversion : DiagGroup<"implicit-fixed-point-conversion">;
121
122def FloatOverflowConversion : DiagGroup<"float-overflow-conversion">;
123def FloatZeroConversion : DiagGroup<"float-zero-conversion">;
124def FloatConversion :
125  DiagGroup<"float-conversion", [FloatOverflowConversion,
126                                 FloatZeroConversion]>;
127def MathErrnoEnabledWithVecLib : DiagGroup<"math-errno-enabled-with-veclib">;
128
129def FrameAddress : DiagGroup<"frame-address">;
130def FreeNonHeapObject : DiagGroup<"free-nonheap-object">;
131def DoublePromotion : DiagGroup<"double-promotion">;
132def EnumTooLarge : DiagGroup<"enum-too-large">;
133def UnsupportedNan : DiagGroup<"unsupported-nan">;
134def UnsupportedAbs : DiagGroup<"unsupported-abs">;
135def UnsupportedFPOpt : DiagGroup<"unsupported-floating-point-opt">;
136def UnsupportedCB : DiagGroup<"unsupported-cb">;
137def UnsupportedGPOpt : DiagGroup<"unsupported-gpopt">;
138def UnsupportedTargetOpt : DiagGroup<"unsupported-target-opt">;
139def NonLiteralNullConversion : DiagGroup<"non-literal-null-conversion">;
140def NullConversion : DiagGroup<"null-conversion">;
141def ImplicitConversionFloatingPointToBool :
142  DiagGroup<"implicit-conversion-floating-point-to-bool">;
143def ObjCLiteralConversion : DiagGroup<"objc-literal-conversion">;
144def MacroRedefined : DiagGroup<"macro-redefined">;
145def BuiltinMacroRedefined : DiagGroup<"builtin-macro-redefined">;
146def BuiltinRequiresHeader : DiagGroup<"builtin-requires-header">;
147def C99Compat : DiagGroup<"c99-compat">;
148def C23Compat : DiagGroup<"c23-compat">;
149def : DiagGroup<"c2x-compat", [C23Compat]>;
150
151def CXXCompat: DiagGroup<"c++-compat">;
152def ExternCCompat : DiagGroup<"extern-c-compat">;
153def KeywordCompat : DiagGroup<"keyword-compat">;
154def GNUCaseRange : DiagGroup<"gnu-case-range">;
155def CastAlign : DiagGroup<"cast-align">;
156def CastQual : DiagGroup<"cast-qual">;
157def : DiagGroup<"char-align">;
158def Comment : DiagGroup<"comment">;
159def GNUComplexInteger : DiagGroup<"gnu-complex-integer">;
160def GNUConditionalOmittedOperand : DiagGroup<"gnu-conditional-omitted-operand">;
161def ConfigMacros : DiagGroup<"config-macros">;
162def : DiagGroup<"ctor-dtor-privacy">;
163def GNUStringLiteralOperatorTemplate :
164  DiagGroup<"gnu-string-literal-operator-template">;
165def UndefinedVarTemplate : DiagGroup<"undefined-var-template">;
166def UndefinedFuncTemplate : DiagGroup<"undefined-func-template">;
167def MissingNoEscape : DiagGroup<"missing-noescape">;
168
169def DefaultedFunctionDeleted : DiagGroup<"defaulted-function-deleted">;
170def DeleteIncomplete : DiagGroup<"delete-incomplete">;
171def DeleteNonAbstractNonVirtualDtor : DiagGroup<"delete-non-abstract-non-virtual-dtor">;
172def DeleteAbstractNonVirtualDtor : DiagGroup<"delete-abstract-non-virtual-dtor">;
173def DeleteNonVirtualDtor : DiagGroup<"delete-non-virtual-dtor",
174                                     [DeleteNonAbstractNonVirtualDtor,
175                                      DeleteAbstractNonVirtualDtor]>;
176def AbstractFinalClass : DiagGroup<"abstract-final-class">;
177def FinalDtorNonFinalClass : DiagGroup<"final-dtor-non-final-class">;
178def GNUOffsetofExtensions : DiagGroup<"gnu-offsetof-extensions">;
179
180def CXX11CompatDeprecatedWritableStr :
181  DiagGroup<"c++11-compat-deprecated-writable-strings">;
182
183def DeprecatedArrayCompare : DiagGroup<"deprecated-array-compare">;
184def DeprecatedAttributes : DiagGroup<"deprecated-attributes">;
185def DeprecatedCommaSubscript : DiagGroup<"deprecated-comma-subscript">;
186def DeprecatedCopyWithUserProvidedCopy : DiagGroup<"deprecated-copy-with-user-provided-copy">;
187def DeprecatedCopyWithUserProvidedDtor : DiagGroup<"deprecated-copy-with-user-provided-dtor">;
188def DeprecatedCopy : DiagGroup<"deprecated-copy", [DeprecatedCopyWithUserProvidedCopy]>;
189def DeprecatedCopyWithDtor : DiagGroup<"deprecated-copy-with-dtor", [DeprecatedCopyWithUserProvidedDtor]>;
190def DeprecatedLiteralOperator : DiagGroup<"deprecated-literal-operator">;
191// For compatibility with GCC.
192def : DiagGroup<"deprecated-copy-dtor", [DeprecatedCopyWithDtor]>;
193def DeprecatedDeclarations : DiagGroup<"deprecated-declarations">;
194def DeprecatedRedundantConstexprStaticDef : DiagGroup<"deprecated-redundant-constexpr-static-def">;
195def UnavailableDeclarations : DiagGroup<"unavailable-declarations">;
196def UnguardedAvailabilityNew : DiagGroup<"unguarded-availability-new">;
197def UnguardedAvailability : DiagGroup<"unguarded-availability",
198                                      [UnguardedAvailabilityNew]>;
199// partial-availability is an alias of unguarded-availability.
200def : DiagGroup<"partial-availability", [UnguardedAvailability]>;
201def DeprecatedDynamicExceptionSpec
202    : DiagGroup<"deprecated-dynamic-exception-spec">;
203def DeprecatedBuiltins : DiagGroup<"deprecated-builtins">;
204def DeprecatedImplementations :DiagGroup<"deprecated-implementations">;
205def DeprecatedIncrementBool : DiagGroup<"deprecated-increment-bool">;
206def DeprecatedRegister : DiagGroup<"deprecated-register">;
207def DeprecatedThisCapture : DiagGroup<"deprecated-this-capture">;
208def DeprecatedVolatile : DiagGroup<"deprecated-volatile">;
209def DeprecatedWritableStr : DiagGroup<"deprecated-writable-strings",
210                                      [CXX11CompatDeprecatedWritableStr]>;
211def DeprecatedPragma : DiagGroup<"deprecated-pragma">;
212def DeprecatedType : DiagGroup<"deprecated-type">;
213def DeprecatedMissingCommaVariadicParam : DiagGroup<"deprecated-missing-comma-variadic-parameter">;
214// FIXME: Why is DeprecatedImplementations not in this group?
215def Deprecated : DiagGroup<"deprecated", [DeprecatedAnonEnumEnumConversion,
216                                          DeprecatedArrayCompare,
217                                          DeprecatedAttributes,
218                                          DeprecatedCommaSubscript,
219                                          DeprecatedCopy,
220                                          DeprecatedCopyWithDtor,
221                                          DeprecatedDeclarations,
222                                          DeprecatedDynamicExceptionSpec,
223                                          DeprecatedEnumCompare,
224                                          DeprecatedEnumCompareConditional,
225                                          DeprecatedEnumEnumConversion,
226                                          DeprecatedEnumFloatConversion,
227                                          DeprecatedBuiltins,
228                                          DeprecatedIncrementBool,
229                                          DeprecatedLiteralOperator,
230                                          DeprecatedPragma,
231                                          DeprecatedRegister,
232                                          DeprecatedOFast,
233                                          DeprecatedThisCapture,
234                                          DeprecatedType,
235                                          DeprecatedVolatile,
236                                          DeprecatedWritableStr,
237                                          DeprecatedRedundantConstexprStaticDef,
238                                          DeprecatedMissingCommaVariadicParam
239                                          ]>,
240                 DiagCategory<"Deprecations">;
241
242def CXX20Designator : DiagGroup<"c++20-designator">;
243// Allow -Wno-c99-designator to be used to turn off all warnings on valid C99
244// designators (including the warning controlled by -Wc++20-designator).
245def C99Designator : DiagGroup<"c99-designator", [CXX20Designator]>;
246def GNUDesignator : DiagGroup<"gnu-designator">;
247def DtorName : DiagGroup<"dtor-name">;
248
249def DynamicExceptionSpec
250    : DiagGroup<"dynamic-exception-spec", [DeprecatedDynamicExceptionSpec]>;
251
252def LibLTO : DiagGroup<"liblto">;
253def : DiagGroup<"disabled-optimization">;
254def : DiagGroup<"discard-qual">;
255def DivZero : DiagGroup<"division-by-zero">;
256def : DiagGroup<"div-by-zero", [DivZero]>;
257
258def DocumentationHTML : DiagGroup<"documentation-html">;
259def DocumentationUnknownCommand : DiagGroup<"documentation-unknown-command">;
260def DocumentationPedantic : DiagGroup<"documentation-pedantic",
261                                      [DocumentationUnknownCommand]>;
262def DocumentationDeprecatedSync : DiagGroup<"documentation-deprecated-sync">;
263def Documentation : DiagGroup<"documentation",
264                              [DocumentationHTML,
265                               DocumentationDeprecatedSync]>;
266
267def EmptyBody : DiagGroup<"empty-body">;
268def Exceptions : DiagGroup<"exceptions">;
269def DeclarationAfterStatement : DiagGroup<"declaration-after-statement">;
270
271def GNUEmptyStruct : DiagGroup<"gnu-empty-struct">;
272def ExtraTokens : DiagGroup<"extra-tokens">;
273def CXX98CompatExtraSemi : DiagGroup<"c++98-compat-extra-semi">;
274def CXX11ExtraSemi : DiagGroup<"c++11-extra-semi">;
275def EmptyInitStatement : DiagGroup<"empty-init-stmt">;
276def ExportUnnamed : DiagGroup<"export-unnamed">;
277def ExtraSemiStmt : DiagGroup<"extra-semi-stmt", [EmptyInitStatement]>;
278def ExtraSemi : DiagGroup<"extra-semi", [CXX98CompatExtraSemi,
279                                         CXX11ExtraSemi]>;
280
281def GNUFlexibleArrayInitializer : DiagGroup<"gnu-flexible-array-initializer">;
282def GNUFlexibleArrayUnionMember : DiagGroup<"gnu-flexible-array-union-member">;
283def GNUFoldingConstant : DiagGroup<"gnu-folding-constant">;
284def FormatInsufficientArgs : DiagGroup<"format-insufficient-args">;
285def FormatExtraArgs : DiagGroup<"format-extra-args">;
286def FormatZeroLength : DiagGroup<"format-zero-length">;
287
288def InvalidIOSDeploymentTarget : DiagGroup<"invalid-ios-deployment-target">;
289
290def CXX17CompatMangling : DiagGroup<"c++17-compat-mangling">;
291def : DiagGroup<"c++1z-compat-mangling", [CXX17CompatMangling]>;
292// Name of this warning in GCC.
293def NoexceptType : DiagGroup<"noexcept-type", [CXX17CompatMangling]>;
294
295def VariadicMacroArgumentsOmitted : DiagGroup<"variadic-macro-arguments-omitted">;
296
297// Warnings for C code which is not compatible with previous C standards.
298def CPre11Compat : DiagGroup<"pre-c11-compat">;
299def CPre11CompatPedantic : DiagGroup<"pre-c11-compat-pedantic",
300                                     [CPre11Compat]>;
301def CPre23Compat : DiagGroup<"pre-c23-compat", [VariadicMacroArgumentsOmitted]>;
302def CPre23CompatPedantic : DiagGroup<"pre-c23-compat-pedantic",
303                                     [CPre23Compat]>;
304def : DiagGroup<"pre-c2x-compat", [CPre23Compat]>;
305def : DiagGroup<"pre-c2x-compat-pedantic", [CPre23CompatPedantic]>;
306
307def CPre2yCompat : DiagGroup<"pre-c2y-compat">;
308def CPre2yCompatPedantic : DiagGroup<"pre-c2y-compat-pedantic",
309                                     [CPre2yCompat]>;
310
311// Warnings for C++ code which is not compatible with previous C++ standards.
312def CXXPre14Compat : DiagGroup<"pre-c++14-compat">;
313def : DiagGroup<"c++98-c++11-compat", [CXXPre14Compat]>;
314def CXXPre14CompatPedantic : DiagGroup<"pre-c++14-compat-pedantic",
315                                       [CXXPre14Compat,
316                                        CXXPre14CompatBinaryLiteral]>;
317def : DiagGroup<"c++98-c++11-compat-pedantic", [CXXPre14CompatPedantic]>;
318def CXXPre17Compat : DiagGroup<"pre-c++17-compat">;
319def : DiagGroup<"c++98-c++11-c++14-compat", [CXXPre17Compat]>;
320def CXXPre17CompatPedantic : DiagGroup<"pre-c++17-compat-pedantic",
321                                       [CXXPre17Compat]>;
322def : DiagGroup<"c++98-c++11-c++14-compat-pedantic",
323                [CXXPre17CompatPedantic]>;
324def CXXPre20Compat : DiagGroup<"pre-c++20-compat">;
325def : DiagGroup<"c++98-c++11-c++14-c++17-compat", [CXXPre20Compat]>;
326def CXXPre20CompatPedantic : DiagGroup<"pre-c++20-compat-pedantic",
327                                       [CXXPre20Compat]>;
328def : DiagGroup<"c++98-c++11-c++14-c++17-compat-pedantic",
329                [CXXPre20CompatPedantic]>;
330def CXXPre23Compat : DiagGroup<"pre-c++23-compat">;
331def CXXPre23CompatPedantic :
332  DiagGroup<"pre-c++23-compat-pedantic", [CXXPre23Compat]>;
333def CXXPre26Compat : DiagGroup<"pre-c++26-compat">;
334def CXXPre26CompatPedantic :
335  DiagGroup<"pre-c++26-compat-pedantic", [CXXPre26Compat]>;
336def : DiagGroup<"pre-c++2c-compat", [CXXPre26Compat]>;
337def : DiagGroup<"pre-c++2c-compat-pedantic", [CXXPre26CompatPedantic]>;
338
339def CXX98CompatBindToTemporaryCopy :
340  DiagGroup<"c++98-compat-bind-to-temporary-copy">;
341def CXX98CompatLocalTypeTemplateArgs :
342  DiagGroup<"c++98-compat-local-type-template-args">;
343def CXX98CompatUnnamedTypeTemplateArgs :
344  DiagGroup<"c++98-compat-unnamed-type-template-args">;
345
346def CXX98Compat : DiagGroup<"c++98-compat",
347                            [CXX98CompatLocalTypeTemplateArgs,
348                             CXX98CompatUnnamedTypeTemplateArgs,
349                             CXXPre14Compat,
350                             CXXPre17Compat,
351                             CXXPre20Compat,
352                             CXXPre23Compat,
353                             CXXPre26Compat]>;
354// Warnings for C++11 features which are Extensions in C++98 mode.
355def CXX98CompatPedantic : DiagGroup<"c++98-compat-pedantic",
356                                    [CXX98Compat,
357                                     CXX98CompatBindToTemporaryCopy,
358                                     CXX98CompatExtraSemi,
359                                     CXXPre14CompatPedantic,
360                                     CXXPre17CompatPedantic,
361                                     CXXPre20CompatPedantic,
362                                     CXXPre23CompatPedantic,
363                                     CXXPre26CompatPedantic]>;
364
365def CXX11NarrowingConstReference : DiagGroup<"c++11-narrowing-const-reference">;
366def CXX11Narrowing : DiagGroup<"c++11-narrowing", [CXX11NarrowingConstReference]>;
367
368def CXX11WarnInconsistentOverrideDestructor :
369  DiagGroup<"inconsistent-missing-destructor-override">;
370def CXX11WarnInconsistentOverrideMethod :
371  DiagGroup<"inconsistent-missing-override">;
372def CXX11WarnSuggestOverrideDestructor : DiagGroup<"suggest-destructor-override">;
373def CXX11WarnSuggestOverride : DiagGroup<"suggest-override">;
374
375// Original name of this warning in Clang
376def : DiagGroup<"c++0x-narrowing", [CXX11Narrowing]>;
377
378// Name of this warning in GCC
379def : DiagGroup<"narrowing", [CXX11Narrowing]>;
380
381def CXX11CompatReservedUserDefinedLiteral :
382  DiagGroup<"c++11-compat-reserved-user-defined-literal">;
383def ReservedUserDefinedLiteral :
384  DiagGroup<"reserved-user-defined-literal",
385            [CXX11CompatReservedUserDefinedLiteral]>;
386
387def CXX11Compat : DiagGroup<"c++11-compat",
388                            [CXX11Narrowing,
389                             CXX11CompatReservedUserDefinedLiteral,
390                             CXX11CompatDeprecatedWritableStr,
391                             CXXPre14Compat,
392                             CXXPre17Compat,
393                             CXXPre20Compat,
394                             CXXPre23Compat,
395                             CXXPre26Compat]>;
396def : DiagGroup<"c++0x-compat", [CXX11Compat]>;
397def CXX11CompatPedantic : DiagGroup<"c++11-compat-pedantic",
398                                    [CXX11Compat,
399                                     CXXPre14CompatPedantic,
400                                     CXXPre17CompatPedantic,
401                                     CXXPre20CompatPedantic,
402                                     CXXPre23CompatPedantic,
403                                     CXXPre26CompatPedantic]>;
404
405def CXX14Compat : DiagGroup<"c++14-compat", [CXXPre17Compat,
406                                             CXXPre20Compat,
407                                             CXXPre23Compat,
408                                             CXXPre26Compat]>;
409def CXX14CompatPedantic : DiagGroup<"c++14-compat-pedantic",
410                                    [CXX14Compat,
411                                     CXXPre17CompatPedantic,
412                                     CXXPre20CompatPedantic,
413                                     CXXPre23CompatPedantic,
414                                     CXXPre26CompatPedantic]>;
415
416def CXX17Compat : DiagGroup<"c++17-compat", [DeprecatedRegister,
417                                             DeprecatedIncrementBool,
418                                             CXX17CompatMangling,
419                                             CXXPre20Compat,
420                                             CXXPre23Compat,
421                                             CXXPre26Compat]>;
422def CXX17CompatPedantic : DiagGroup<"c++17-compat-pedantic",
423                                    [CXX17Compat,
424                                     CXXPre20CompatPedantic,
425                                     CXXPre23CompatPedantic,
426                                     CXXPre26CompatPedantic]>;
427def : DiagGroup<"c++1z-compat", [CXX17Compat]>;
428
429def CXX20Compat : DiagGroup<"c++20-compat", [CXXPre23Compat,
430                                             CXXPre26Compat]>;
431def CXX20CompatPedantic : DiagGroup<"c++20-compat-pedantic",
432                                    [CXX20Compat,
433                                     CXXPre23CompatPedantic,
434                                     CXXPre26CompatPedantic]>;
435def : DiagGroup<"c++2a-compat", [CXX20Compat]>;
436def : DiagGroup<"c++2a-compat-pedantic", [CXX20CompatPedantic]>;
437
438def CXX23Compat : DiagGroup<"c++23-compat", [CXXPre26Compat]>;
439
440def CXX26Compat : DiagGroup<"c++2c-compat", [DeleteIncomplete]>;
441
442def ExitTimeDestructors : DiagGroup<"exit-time-destructors">;
443def FlexibleArrayExtensions : DiagGroup<"flexible-array-extensions">;
444def FourByteMultiChar : DiagGroup<"four-char-constants">;
445def GlobalConstructors : DiagGroup<"global-constructors"> {
446 code Documentation = [{
447Emit a warning for each variable declaration that generates code run at startup.
448 }];
449}
450def BitwiseConditionalParentheses: DiagGroup<"bitwise-conditional-parentheses">;
451def BitwiseOpParentheses: DiagGroup<"bitwise-op-parentheses">;
452def LogicalOpParentheses: DiagGroup<"logical-op-parentheses">;
453def LogicalNotParentheses: DiagGroup<"logical-not-parentheses">;
454def ShiftOpParentheses: DiagGroup<"shift-op-parentheses">;
455def OverloadedShiftOpParentheses: DiagGroup<"overloaded-shift-op-parentheses">;
456def DanglingAssignment: DiagGroup<"dangling-assignment">;
457def DanglingAssignmentGsl : DiagGroup<"dangling-assignment-gsl">;
458def DanglingCapture : DiagGroup<"dangling-capture">;
459def DanglingElse: DiagGroup<"dangling-else">;
460def DanglingField : DiagGroup<"dangling-field">;
461def DanglingInitializerList : DiagGroup<"dangling-initializer-list">;
462def DanglingGsl : DiagGroup<"dangling-gsl">;
463def ReturnStackAddress : DiagGroup<"return-stack-address">;
464// Name of this warning in GCC
465def : DiagGroup<"return-local-addr", [ReturnStackAddress]>;
466def Dangling : DiagGroup<"dangling", [DanglingAssignment,
467                                      DanglingAssignmentGsl,
468                                      DanglingCapture,
469                                      DanglingField,
470                                      DanglingInitializerList,
471                                      DanglingGsl,
472                                      ReturnStackAddress]>;
473def DistributedObjectModifiers : DiagGroup<"distributed-object-modifiers">;
474def DllexportExplicitInstantiationDecl : DiagGroup<"dllexport-explicit-instantiation-decl">;
475def ExcessInitializers : DiagGroup<"excess-initializers">;
476def ExpansionToDefined : DiagGroup<"expansion-to-defined">;
477def FlagEnum : DiagGroup<"flag-enum">;
478def IncrementBool : DiagGroup<"increment-bool", [DeprecatedIncrementBool]>;
479def InfiniteRecursion : DiagGroup<"infinite-recursion">;
480def PureVirtualCallFromCtorDtor: DiagGroup<"call-to-pure-virtual-from-ctor-dtor">;
481def GNUImaginaryConstant : DiagGroup<"gnu-imaginary-constant">;
482def IgnoredGCH : DiagGroup<"ignored-gch">;
483def IgnoredReferenceQualifiers : DiagGroup<"ignored-reference-qualifiers">;
484def IgnoredQualifiers : DiagGroup<"ignored-qualifiers", [IgnoredReferenceQualifiers]>;
485def : DiagGroup<"import">;
486def GNUIncludeNext : DiagGroup<"gnu-include-next">;
487def IncompatibleMSStruct : DiagGroup<"incompatible-ms-struct">;
488def IncompatibleMSPragmaSection : DiagGroup<"incompatible-ms-pragma-section">;
489def IncompatiblePointerTypesDiscardsQualifiers
490  : DiagGroup<"incompatible-pointer-types-discards-qualifiers">;
491def IncompatibleFunctionPointerTypes
492  : DiagGroup<"incompatible-function-pointer-types">;
493def IncompatiblePointerTypes
494  : DiagGroup<"incompatible-pointer-types",
495    [IncompatiblePointerTypesDiscardsQualifiers,
496     IncompatibleFunctionPointerTypes]>;
497def IncompleteUmbrella : DiagGroup<"incomplete-umbrella">;
498def IncompleteFrameworkModuleDeclaration
499  : DiagGroup<"incomplete-framework-module-declaration">;
500def NonModularIncludeInFrameworkModule
501  : DiagGroup<"non-modular-include-in-framework-module">;
502def NonModularIncludeInModule : DiagGroup<"non-modular-include-in-module",
503                                          [NonModularIncludeInFrameworkModule]>;
504def IncompleteModule : DiagGroup<"incomplete-module",
505    [IncompleteUmbrella, NonModularIncludeInModule]>;
506def PrivateModule : DiagGroup<"private-module">;
507
508def CXX11InlineNamespace : DiagGroup<"c++11-inline-namespace">;
509def InlineNamespaceReopenedNoninline
510    : DiagGroup<"inline-namespace-reopened-noninline">;
511def InvalidNoreturn : DiagGroup<"invalid-noreturn">;
512def InvalidSourceEncoding : DiagGroup<"invalid-source-encoding">;
513def KNRPromotedParameter : DiagGroup<"knr-promoted-parameter">;
514def DeprecatedNonPrototype : DiagGroup<"deprecated-non-prototype">;
515def StrictPrototypes : DiagGroup<"strict-prototypes", [DeprecatedNonPrototype]>;
516def : DiagGroup<"init-self">;
517def : DiagGroup<"inline">;
518def : DiagGroup<"invalid-pch">;
519def GNULabelsAsValue : DiagGroup<"gnu-label-as-value">;
520def GNULineMarker : DiagGroup<"gnu-line-marker">;
521def LiteralRange : DiagGroup<"literal-range">;
522def LocalTypeTemplateArgs : DiagGroup<"local-type-template-args",
523                                      [CXX98CompatLocalTypeTemplateArgs]>;
524def RangeLoopConstruct : DiagGroup<"range-loop-construct">;
525def RangeLoopBindReference : DiagGroup<"range-loop-bind-reference">;
526def RangeLoopAnalysis : DiagGroup<"range-loop-analysis",
527                                  [RangeLoopConstruct, RangeLoopBindReference]>;
528def ForLoopAnalysis : DiagGroup<"for-loop-analysis">;
529def LoopAnalysis : DiagGroup<"loop-analysis", [ForLoopAnalysis,
530                                               RangeLoopAnalysis]>;
531def MalformedWarningCheck : DiagGroup<"malformed-warning-check">;
532def Main : DiagGroup<"main">;
533def MainReturnType : DiagGroup<"main-return-type">;
534def MaxUnsignedZero : DiagGroup<"max-unsigned-zero">;
535def MissingBraces : DiagGroup<"missing-braces">;
536def MissingDeclarations: DiagGroup<"missing-declarations">;
537def : DiagGroup<"missing-format-attribute">;
538def MissingIncludeDirs : DiagGroup<"missing-include-dirs">;
539def MissingNoreturn : DiagGroup<"missing-noreturn">;
540def MultiChar : DiagGroup<"multichar">;
541def : DiagGroup<"nested-externs">;
542def CXX11LongLong : DiagGroup<"c++11-long-long">;
543def LongLong : DiagGroup<"long-long", [CXX11LongLong]>;
544def ImplicitlyUnsignedLiteral : DiagGroup<"implicitly-unsigned-literal">;
545def MethodSignatures : DiagGroup<"method-signatures">;
546def MismatchedParameterTypes : DiagGroup<"mismatched-parameter-types">;
547def MismatchedReturnTypes : DiagGroup<"mismatched-return-types">;
548def MismatchedTags : DiagGroup<"mismatched-tags">;
549def MissingDesignatedFieldInitializers : DiagGroup<"missing-designated-field-initializers">{
550  code Documentation = [{
551Warn about designated initializers with some fields missing (only in C++).
552  }];
553}
554// Default -Wmissing-field-initializers matches gcc behavior,
555// but missing-designated-field-initializers can be turned off to match old clang behavior.
556def MissingFieldInitializers : DiagGroup<"missing-field-initializers",
557                                         [MissingDesignatedFieldInitializers]>;
558def ModuleLock : DiagGroup<"module-lock">;
559def ModuleBuild : DiagGroup<"module-build">;
560def ModuleImport : DiagGroup<"module-import">;
561def ModuleConflict : DiagGroup<"module-conflict">;
562def ModuleFileExtension : DiagGroup<"module-file-extension">;
563def ModuleIncludeDirectiveTranslation : DiagGroup<"module-include-translation">;
564def RoundTripCC1Args : DiagGroup<"round-trip-cc1-args">;
565def NewlineEOF : DiagGroup<"newline-eof">;
566def Nullability : DiagGroup<"nullability">;
567def NullabilityDeclSpec : DiagGroup<"nullability-declspec">;
568def NullabilityInferredOnNestedType : DiagGroup<"nullability-inferred-on-nested-type">;
569def NullableToNonNullConversion : DiagGroup<"nullable-to-nonnull-conversion">;
570def NullabilityCompletenessOnArrays : DiagGroup<"nullability-completeness-on-arrays">;
571def NullabilityCompleteness : DiagGroup<"nullability-completeness",
572                                        [NullabilityCompletenessOnArrays]>;
573def NullArithmetic : DiagGroup<"null-arithmetic">;
574def NullCharacter : DiagGroup<"null-character">;
575def NullDereference : DiagGroup<"null-dereference">;
576def InitializerOverrides : DiagGroup<"initializer-overrides">;
577// For compatibility with GCC; -Woverride-init = -Winitializer-overrides
578def : DiagGroup<"override-init", [InitializerOverrides]>;
579def NonNull : DiagGroup<"nonnull">;
580def NonPODVarargs : DiagGroup<"non-pod-varargs">;
581def ClassVarargs : DiagGroup<"class-varargs", [NonPODVarargs]>;
582def : DiagGroup<"nonportable-cfstrings">;
583def NonVirtualDtor : DiagGroup<"non-virtual-dtor">;
584def GNUNullPointerArithmetic : DiagGroup<"gnu-null-pointer-arithmetic">;
585def NullPointerArithmetic
586    : DiagGroup<"null-pointer-arithmetic", [GNUNullPointerArithmetic]>;
587def NullPointerSubtraction : DiagGroup<"null-pointer-subtraction">;
588def : DiagGroup<"effc++", [NonVirtualDtor]>;
589def OveralignedType : DiagGroup<"over-aligned">;
590def OldStyleCast : DiagGroup<"old-style-cast">;
591def : DiagGroup<"old-style-definition">;
592def OutOfLineDeclaration : DiagGroup<"out-of-line-declaration">;
593def : DiagGroup<"overflow">;
594def ForwardClassReceiver : DiagGroup<"receiver-forward-class">;
595def MethodAccess : DiagGroup<"objc-method-access">;
596def ObjCReceiver : DiagGroup<"receiver-expr">;
597def OperatorNewReturnsNull : DiagGroup<"new-returns-null">;
598def OverlengthStrings : DiagGroup<"overlength-strings">;
599def OverloadedVirtual : DiagGroup<"overloaded-virtual">;
600def PrivateExtern : DiagGroup<"private-extern">;
601def SelTypeCast : DiagGroup<"cast-of-sel-type">;
602def FunctionDefInObjCContainer : DiagGroup<"function-def-in-objc-container">;
603def BadFunctionCast : DiagGroup<"bad-function-cast">;
604def CastFunctionTypeStrict : DiagGroup<"cast-function-type-strict">;
605def CastFunctionTypeMismatch : DiagGroup<"cast-function-type-mismatch">;
606def CastFunctionType : DiagGroup<"cast-function-type",
607                                 [CastFunctionTypeStrict,
608                                  CastFunctionTypeMismatch]>;
609def ObjCPropertyImpl : DiagGroup<"objc-property-implementation">;
610def ObjCPropertyNoAttribute : DiagGroup<"objc-property-no-attribute">;
611def ObjCPropertyAssignOnObjectType : DiagGroup<"objc-property-assign-on-object-type">;
612def ObjCProtocolQualifiers : DiagGroup<"objc-protocol-qualifiers">;
613def ObjCMissingSuperCalls : DiagGroup<"objc-missing-super-calls">;
614def ObjCDesignatedInit : DiagGroup<"objc-designated-initializers">;
615def ObjCRetainBlockProperty : DiagGroup<"objc-noncopy-retain-block-property">;
616def ObjCReadonlyPropertyHasSetter : DiagGroup<"objc-readonly-with-setter-property">;
617def ObjCInvalidIBOutletProperty : DiagGroup<"invalid-iboutlet">;
618def ObjCRootClass : DiagGroup<"objc-root-class">;
619def ObjCPointerIntrospectPerformSelector : DiagGroup<"deprecated-objc-pointer-introspection-performSelector">;
620def ObjCPointerIntrospect : DiagGroup<"deprecated-objc-pointer-introspection", [ObjCPointerIntrospectPerformSelector]>;
621def ObjCMultipleMethodNames : DiagGroup<"objc-multiple-method-names">;
622def ObjCFlexibleArray : DiagGroup<"objc-flexible-array">;
623def ObjCBoxing : DiagGroup<"objc-boxing">;
624def CompletionHandler : DiagGroup<"completion-handler">;
625def CalledOnceParameter : DiagGroup<"called-once-parameter", [CompletionHandler]>;
626def OpenCLUnsupportedRGBA: DiagGroup<"opencl-unsupported-rgba">;
627def UnderalignedExceptionObject : DiagGroup<"underaligned-exception-object">;
628def DeprecatedObjCIsaUsage : DiagGroup<"deprecated-objc-isa-usage">;
629def ExplicitInitializeCall : DiagGroup<"explicit-initialize-call">;
630def OrderedCompareFunctionPointers : DiagGroup<"ordered-compare-function-pointers">;
631def PackedNonPod : DiagGroup<"packed-non-pod">;
632def Packed : DiagGroup<"packed", [PackedNonPod]>;
633def PaddedBitField : DiagGroup<"padded-bitfield">;
634def Padded : DiagGroup<"padded", [PaddedBitField]>;
635def UnalignedAccess : DiagGroup<"unaligned-access">;
636
637def PessimizingMove : DiagGroup<"pessimizing-move">;
638def ReturnStdMove : DiagGroup<"return-std-move">;
639
640def GNUPointerArith : DiagGroup<"gnu-pointer-arith">;
641def PointerArith : DiagGroup<"pointer-arith", [GNUPointerArith]>;
642
643def PoundWarning : DiagGroup<"#warnings">;
644def PoundPragmaMessage : DiagGroup<"#pragma-messages">,
645                         DiagCategory<"#pragma message Directive">;
646def : DiagGroup<"redundant-decls">;
647def RedeclaredClassMember : DiagGroup<"redeclared-class-member">;
648def GNURedeclaredEnum : DiagGroup<"gnu-redeclared-enum">;
649def RedundantAttribute : DiagGroup<"redundant-attribute">;
650def RedundantMove : DiagGroup<"redundant-move">;
651def Register : DiagGroup<"register", [DeprecatedRegister]>;
652def ReturnTypeCLinkage : DiagGroup<"return-type-c-linkage">;
653def ReturnMismatch : DiagGroup<"return-mismatch">;
654def ReturnType : DiagGroup<"return-type", [ReturnTypeCLinkage, ReturnMismatch]>;
655
656def BindToTemporaryCopy : DiagGroup<"bind-to-temporary-copy",
657                                    [CXX98CompatBindToTemporaryCopy]>;
658def SelfAssignmentField : DiagGroup<"self-assign-field">;
659def SelfAssignmentOverloaded : DiagGroup<"self-assign-overloaded">;
660def SelfAssignment : DiagGroup<"self-assign", [SelfAssignmentOverloaded, SelfAssignmentField]>;
661def SelfMove : DiagGroup<"self-move">;
662def SemiBeforeMethodBody : DiagGroup<"semicolon-before-method-body">;
663def Sentinel : DiagGroup<"sentinel">;
664def MissingMethodReturnType : DiagGroup<"missing-method-return-type">;
665
666def ShadowField : DiagGroup<"shadow-field">;
667def ShadowFieldInConstructorModified : DiagGroup<"shadow-field-in-constructor-modified">;
668def ShadowFieldInConstructor : DiagGroup<"shadow-field-in-constructor",
669                                         [ShadowFieldInConstructorModified]>;
670def ShadowIvar : DiagGroup<"shadow-ivar">;
671def ShadowUncapturedLocal : DiagGroup<"shadow-uncaptured-local">;
672
673// -Wshadow-all is a catch-all for all shadowing. -Wshadow is just the
674// shadowing that we think is unsafe.
675def Shadow : DiagGroup<"shadow", [ShadowFieldInConstructorModified,
676                                  ShadowIvar]>;
677def ShadowAll : DiagGroup<"shadow-all", [Shadow, ShadowFieldInConstructor,
678                                         ShadowUncapturedLocal, ShadowField]>;
679
680def : DiagGroup<"sign-promo">;
681def SignCompare : DiagGroup<"sign-compare">;
682def SwitchDefault  : DiagGroup<"switch-default">;
683def : DiagGroup<"synth">;
684def SizeofArrayArgument : DiagGroup<"sizeof-array-argument">;
685def SizeofArrayDecay : DiagGroup<"sizeof-array-decay">;
686def SizeofPointerMemaccess : DiagGroup<"sizeof-pointer-memaccess">;
687def MemsetTransposedArgs : DiagGroup<"memset-transposed-args">;
688def DynamicClassMemaccess : DiagGroup<"dynamic-class-memaccess">;
689def NonTrivialMemcall : DiagGroup<"nontrivial-memcall">;
690def NonTrivialMemaccess : DiagGroup<"nontrivial-memaccess", [NonTrivialMemcall]>;
691def SuspiciousBzero : DiagGroup<"suspicious-bzero">;
692def SuspiciousMemaccess : DiagGroup<"suspicious-memaccess",
693  [SizeofPointerMemaccess, DynamicClassMemaccess,
694   NonTrivialMemaccess, MemsetTransposedArgs, SuspiciousBzero]>;
695def StaticInInline : DiagGroup<"static-in-inline">;
696def StaticLocalInInline : DiagGroup<"static-local-in-inline">;
697def GNUStaticFloatInit : DiagGroup<"gnu-static-float-init">;
698def StaticFloatInit : DiagGroup<"static-float-init", [GNUStaticFloatInit]>;
699// Allow differentiation between GNU statement expressions in a macro versus
700// written directly in source.
701def GNUStatementExpressionFromMacroExpansion :
702  DiagGroup<"gnu-statement-expression-from-macro-expansion">;
703def GNUStatementExpression : DiagGroup<"gnu-statement-expression",
704                                       [GNUStatementExpressionFromMacroExpansion]>;
705def StringConcatation : DiagGroup<"string-concatenation">;
706def StringCompare : DiagGroup<"string-compare">;
707def StringPlusInt : DiagGroup<"string-plus-int">;
708def StringPlusChar : DiagGroup<"string-plus-char">;
709def StrncatSize : DiagGroup<"strncat-size">;
710def SwiftNameAttribute : DiagGroup<"swift-name-attribute">;
711def IntInBoolContext : DiagGroup<"int-in-bool-context">;
712def TautologicalTypeLimitCompare : DiagGroup<"tautological-type-limit-compare">;
713def TautologicalUnsignedZeroCompare : DiagGroup<"tautological-unsigned-zero-compare">;
714def TautologicalUnsignedCharZeroCompare : DiagGroup<"tautological-unsigned-char-zero-compare">;
715def TautologicalUnsignedEnumZeroCompare : DiagGroup<"tautological-unsigned-enum-zero-compare">;
716// For compatibility with GCC. Tautological comparison warnings for constants
717// that are an extremal value of the type.
718def TypeLimits : DiagGroup<"type-limits", [TautologicalTypeLimitCompare,
719                                           TautologicalUnsignedZeroCompare,
720                                           TautologicalUnsignedCharZeroCompare,
721                                           TautologicalUnsignedEnumZeroCompare]>;
722// Additional tautological comparison warnings based on the expression, not
723// only on its type.
724def TautologicalValueRangeCompare : DiagGroup<"tautological-value-range-compare">;
725def TautologicalInRangeCompare : DiagGroup<"tautological-constant-in-range-compare",
726                                           [TypeLimits, TautologicalValueRangeCompare]>;
727def TautologicalOutOfRangeCompare : DiagGroup<"tautological-constant-out-of-range-compare">;
728def TautologicalConstantCompare : DiagGroup<"tautological-constant-compare",
729                                            [TautologicalOutOfRangeCompare]>;
730def TautologicalPointerCompare : DiagGroup<"tautological-pointer-compare">;
731def TautologicalOverlapCompare : DiagGroup<"tautological-overlap-compare">;
732def TautologicalBitwiseCompare : DiagGroup<"tautological-bitwise-compare">;
733def TautologicalUndefinedCompare : DiagGroup<"tautological-undefined-compare">;
734def TautologicalObjCBoolCompare : DiagGroup<"tautological-objc-bool-compare">;
735def TautologicalNegationCompare : DiagGroup<"tautological-negation-compare">;
736def TautologicalCompare : DiagGroup<"tautological-compare",
737                                    [TautologicalConstantCompare,
738                                     TautologicalPointerCompare,
739                                     TautologicalOverlapCompare,
740                                     TautologicalBitwiseCompare,
741                                     TautologicalUndefinedCompare,
742                                     TautologicalObjCBoolCompare,
743                                     TautologicalNegationCompare]>;
744def HeaderHygiene : DiagGroup<"header-hygiene">;
745def DuplicateDeclSpecifier : DiagGroup<"duplicate-decl-specifier">;
746def CompareDistinctPointerType : DiagGroup<"compare-distinct-pointer-types">;
747def GNUUnionCast : DiagGroup<"gnu-union-cast">;
748def GNUVariableSizedTypeNotAtEnd : DiagGroup<"gnu-variable-sized-type-not-at-end">;
749def Varargs : DiagGroup<"varargs">;
750def XorUsedAsPow : DiagGroup<"xor-used-as-pow">;
751
752def Unsequenced : DiagGroup<"unsequenced">;
753// GCC name for -Wunsequenced
754def : DiagGroup<"sequence-point", [Unsequenced]>;
755
756// Preprocessor warnings.
757def AmbiguousMacro : DiagGroup<"ambiguous-macro">;
758def KeywordAsMacro : DiagGroup<"keyword-macro">;
759def ReservedIdAsMacro : DiagGroup<"reserved-macro-identifier">;
760def ReservedIdAsMacroAlias : DiagGroup<"reserved-id-macro", [ReservedIdAsMacro]>;
761def ReservedAttributeIdentifier : DiagGroup<"reserved-attribute-identifier">;
762def RestrictExpansionMacro : DiagGroup<"restrict-expansion">;
763def FinalMacro : DiagGroup<"final-macro">;
764
765// Just silence warnings about -Wstrict-aliasing for now.
766def : DiagGroup<"strict-aliasing=0">;
767def : DiagGroup<"strict-aliasing=1">;
768def : DiagGroup<"strict-aliasing=2">;
769def : DiagGroup<"strict-aliasing">;
770
771// Just silence warnings about -Wstrict-overflow for now.
772def : DiagGroup<"strict-overflow=0">;
773def : DiagGroup<"strict-overflow=1">;
774def : DiagGroup<"strict-overflow=2">;
775def : DiagGroup<"strict-overflow=3">;
776def : DiagGroup<"strict-overflow=4">;
777def : DiagGroup<"strict-overflow=5">;
778def : DiagGroup<"strict-overflow">;
779
780def InvalidOffsetof : DiagGroup<"invalid-offsetof">;
781def StrictSelector : DiagGroup<"strict-selector-match">;
782def MethodDuplicate : DiagGroup<"duplicate-method-match">;
783def ObjCCStringFormat : DiagGroup<"cstring-format-directive">;
784def CoveredSwitchDefault : DiagGroup<"covered-switch-default">;
785def SwitchBool     : DiagGroup<"switch-bool">;
786def SwitchEnum     : DiagGroup<"switch-enum">;
787def Switch         : DiagGroup<"switch">;
788def ImplicitFallthroughPerFunction :
789  DiagGroup<"implicit-fallthrough-per-function">;
790def ImplicitFallthrough  : DiagGroup<"implicit-fallthrough",
791                                     [ImplicitFallthroughPerFunction]>;
792def InvalidPPToken : DiagGroup<"invalid-pp-token">;
793def Trigraphs      : DiagGroup<"trigraphs">;
794
795def UndefinedReinterpretCast : DiagGroup<"undefined-reinterpret-cast">;
796def ReinterpretBaseClass : DiagGroup<"reinterpret-base-class">;
797def Unicode  : DiagGroup<"unicode">;
798def UninitializedExplicitInit : DiagGroup<"uninitialized-explicit-init">;
799def UninitializedMaybe : DiagGroup<"conditional-uninitialized">;
800def UninitializedSometimes : DiagGroup<"sometimes-uninitialized">;
801def UninitializedStaticSelfInit : DiagGroup<"static-self-init">;
802def UninitializedConstReference : DiagGroup<"uninitialized-const-reference">;
803def Uninitialized  : DiagGroup<"uninitialized", [UninitializedSometimes,
804                                                 UninitializedStaticSelfInit,
805                                                 UninitializedConstReference]>;
806def IgnoredPragmaIntrinsic : DiagGroup<"ignored-pragma-intrinsic">;
807// #pragma optimize is often used to avoid to work around MSVC codegen bugs or
808// to disable inlining. It's not completely clear what alternative to suggest
809// (#pragma clang optimize, noinline) so suggest nothing for now.
810def IgnoredPragmaOptimize : DiagGroup<"ignored-pragma-optimize">;
811def UnknownPragmas : DiagGroup<"unknown-pragmas">;
812def IgnoredPragmas : DiagGroup<"ignored-pragmas",
813    [IgnoredPragmaIntrinsic, IgnoredPragmaOptimize]>;
814def PragmaClangAttribute : DiagGroup<"pragma-clang-attribute">;
815def PragmaPackSuspiciousInclude : DiagGroup<"pragma-pack-suspicious-include">;
816def PragmaPack : DiagGroup<"pragma-pack", [PragmaPackSuspiciousInclude]>;
817def Pragmas : DiagGroup<"pragmas", [UnknownPragmas, IgnoredPragmas,
818                                    PragmaClangAttribute, PragmaPack]>;
819def UnknownWarningOption : DiagGroup<"unknown-warning-option">;
820def NSobjectAttribute : DiagGroup<"NSObject-attribute">;
821def NSConsumedMismatch : DiagGroup<"nsconsumed-mismatch">;
822def NSReturnsMismatch : DiagGroup<"nsreturns-mismatch">;
823
824def IndependentClassAttribute : DiagGroup<"IndependentClass-attribute">;
825def UnknownAttributes : DiagGroup<"unknown-attributes">;
826def IgnoredAttributes : DiagGroup<"ignored-attributes">;
827def Attributes : DiagGroup<"attributes", [UnknownAttributes,
828                                          IgnoredAttributes]>;
829def UnknownSanitizers : DiagGroup<"unknown-sanitizers">;
830def UnnamedTypeTemplateArgs : DiagGroup<"unnamed-type-template-args",
831                                        [CXX98CompatUnnamedTypeTemplateArgs]>;
832def UnsupportedFriend : DiagGroup<"unsupported-friend">;
833def UnusedArgument : DiagGroup<"unused-argument">;
834def UnusedCommandLineArgument : DiagGroup<"unused-command-line-argument">;
835def IgnoredOptimizationArgument : DiagGroup<"ignored-optimization-argument">;
836def InvalidCommandLineArgument : DiagGroup<"invalid-command-line-argument",
837                                           [IgnoredOptimizationArgument]>;
838def UnusedComparison : DiagGroup<"unused-comparison">;
839def UnusedExceptionParameter : DiagGroup<"unused-exception-parameter">;
840def UnneededInternalDecl : DiagGroup<"unneeded-internal-declaration">;
841def UnneededMemberFunction : DiagGroup<"unneeded-member-function">;
842def UnusedPrivateField : DiagGroup<"unused-private-field">;
843def UnusedFunction : DiagGroup<"unused-function", [UnneededInternalDecl]>;
844def UnusedTemplate : DiagGroup<"unused-template", [UnneededInternalDecl]>;
845def UnusedMemberFunction : DiagGroup<"unused-member-function",
846                                     [UnneededMemberFunction]>;
847def UnusedLabel : DiagGroup<"unused-label">;
848def UnusedLambdaCapture : DiagGroup<"unused-lambda-capture">;
849def UnusedParameter : DiagGroup<"unused-parameter">;
850def UnusedButSetParameter : DiagGroup<"unused-but-set-parameter">;
851def UnusedResult : DiagGroup<"unused-result">;
852def PotentiallyEvaluatedExpression : DiagGroup<"potentially-evaluated-expression">;
853def UnevaluatedExpression : DiagGroup<"unevaluated-expression",
854                                      [PotentiallyEvaluatedExpression]>;
855def UnusedValue : DiagGroup<"unused-value", [UnusedComparison, UnusedResult,
856                                             UnevaluatedExpression]>;
857def UnusedConstVariable : DiagGroup<"unused-const-variable">;
858def UnusedVariable : DiagGroup<"unused-variable",
859                               [UnusedConstVariable]>;
860def UnusedButSetVariable : DiagGroup<"unused-but-set-variable">;
861def UnusedLocalTypedef : DiagGroup<"unused-local-typedef">;
862def UnusedPropertyIvar :  DiagGroup<"unused-property-ivar">;
863def UnusedGetterReturnValue : DiagGroup<"unused-getter-return-value">;
864def UsedButMarkedUnused : DiagGroup<"used-but-marked-unused">;
865def UsedSearchPath : DiagGroup<"search-path-usage">;
866def UserDefinedLiterals : DiagGroup<"user-defined-literals">;
867def UserDefinedWarnings : DiagGroup<"user-defined-warnings">;
868def ReorderCtor : DiagGroup<"reorder-ctor">;
869def ReorderInitList : DiagGroup<"reorder-init-list">;
870def Reorder : DiagGroup<"reorder", [ReorderCtor, ReorderInitList]>;
871def UndeclaredSelector : DiagGroup<"undeclared-selector">;
872def ImplicitAtomic : DiagGroup<"implicit-atomic-properties">;
873def AtomicAlignment : DiagGroup<"atomic-alignment">;
874def CustomAtomic : DiagGroup<"custom-atomic-properties">;
875def AtomicProperties : DiagGroup<"atomic-properties",
876                                 [ImplicitAtomic, CustomAtomic]>;
877def SyncAlignment : DiagGroup<"sync-alignment">;
878def ARCUnsafeRetainedAssign : DiagGroup<"arc-unsafe-retained-assign">;
879def ARCRetainCycles : DiagGroup<"arc-retain-cycles">;
880def ARCNonPodMemAccess : DiagGroup<"arc-non-pod-memaccess">;
881def AutomaticReferenceCounting : DiagGroup<"arc",
882                                           [ARCUnsafeRetainedAssign,
883                                            ARCRetainCycles,
884                                            ARCNonPodMemAccess]>;
885def ARCRepeatedUseOfWeakMaybe : DiagGroup<"arc-maybe-repeated-use-of-weak">;
886def ARCRepeatedUseOfWeak : DiagGroup<"arc-repeated-use-of-weak",
887                                     [ARCRepeatedUseOfWeakMaybe]>;
888def BlockCaptureAutoReleasing : DiagGroup<"block-capture-autoreleasing">;
889def ObjCBridge : DiagGroup<"bridge-cast">;
890
891def DeallocInCategory:DiagGroup<"dealloc-in-category">;
892def SelectorTypeMismatch : DiagGroup<"selector-type-mismatch">;
893def Selector : DiagGroup<"selector", [SelectorTypeMismatch]>;
894def Protocol : DiagGroup<"protocol">;
895// No longer in use, preserve for backwards compatibility.
896def : DiagGroup<"at-protocol">;
897def PropertyAccessDotSyntax: DiagGroup<"property-access-dot-syntax">;
898def PropertyAttr : DiagGroup<"property-attribute-mismatch">;
899def SuperSubClassMismatch : DiagGroup<"super-class-method-mismatch">;
900def OverridingMethodMismatch : DiagGroup<"overriding-method-mismatch">;
901def VariadicMacros : DiagGroup<"variadic-macros">;
902def VectorConversion : DiagGroup<"vector-conversion">;      // clang specific
903def VexingParse : DiagGroup<"vexing-parse">;
904def VLAUseStaticAssert : DiagGroup<"vla-extension-static-assert">;
905def VLACxxExtension : DiagGroup<"vla-cxx-extension", [VLAUseStaticAssert]>;
906def VLAExtension : DiagGroup<"vla-extension", [VLACxxExtension]>;
907def VLA : DiagGroup<"vla", [VLAExtension]>;
908def VolatileRegisterVar : DiagGroup<"volatile-register-var">;
909def Visibility : DiagGroup<"visibility">;
910def ZeroLengthArray : DiagGroup<"zero-length-array">;
911def GNUZeroLineDirective : DiagGroup<"gnu-zero-line-directive">;
912def GNUZeroVariadicMacroArguments : DiagGroup<"gnu-zero-variadic-macro-arguments", [VariadicMacroArgumentsOmitted]>;
913def MisleadingIndentation : DiagGroup<"misleading-indentation">;
914def PtrAuthNullPointers : DiagGroup<"ptrauth-null-pointers">;
915
916// This covers both the deprecated case (in C++98)
917// and the extension case (in C++11 onwards).
918def WritableStrings : DiagGroup<"writable-strings", [DeprecatedWritableStr]>;
919
920// GCC calls -Wdeprecated-writable-strings -Wwrite-strings.
921//
922// Bizarrely, this warning flag enables -fconst-strings in C. This is
923// GCC-compatible, but really weird.
924//
925// FIXME: Should this affect C++11 (where this is an error,
926//        not just deprecated) or not?
927def GCCWriteStrings : DiagGroup<"write-strings" , [WritableStrings],
928                                GCCWriteStringsDocs>;
929
930def CharSubscript : DiagGroup<"char-subscripts">;
931def LargeByValueCopy : DiagGroup<"large-by-value-copy">;
932def DuplicateArgDecl : DiagGroup<"duplicate-method-arg">;
933def SignedEnumBitfield : DiagGroup<"signed-enum-bitfield">;
934
935def ReservedModuleIdentifier : DiagGroup<"reserved-module-identifier">;
936def ReservedIdentifier : DiagGroup<"reserved-identifier",
937    [ReservedIdAsMacro, ReservedModuleIdentifier,
938     UserDefinedLiterals, ReservedAttributeIdentifier]>;
939
940// Unreachable code warning groups.
941//
942//  The goal is make -Wunreachable-code on by default, in -Wall, or at
943//  least actively used, with more noisy versions of the warning covered
944//  under separate flags.
945//
946def UnreachableCodeLoopIncrement : DiagGroup<"unreachable-code-loop-increment">;
947def UnreachableCodeFallthrough : DiagGroup<"unreachable-code-fallthrough">;
948def UnreachableCodeGenericAssoc : DiagGroup<"unreachable-code-generic-assoc">;
949def UnreachableCode : DiagGroup<"unreachable-code",
950                                [UnreachableCodeLoopIncrement,
951                                 UnreachableCodeFallthrough,
952                                 UnreachableCodeGenericAssoc]>;
953def UnreachableCodeBreak : DiagGroup<"unreachable-code-break">;
954def UnreachableCodeReturn : DiagGroup<"unreachable-code-return">;
955def UnreachableCodeAggressive : DiagGroup<"unreachable-code-aggressive",
956                                    [UnreachableCode,
957                                     UnreachableCodeBreak,
958                                     UnreachableCodeReturn]>;
959
960// Aggregation warning settings.
961
962// Populate -Waddress with warnings from other groups.
963def : DiagGroup<"address", [PointerBoolConversion,
964                            StringCompare,
965                            TautologicalPointerCompare]>;
966
967// -Widiomatic-parentheses contains warnings about 'idiomatic'
968// missing parentheses;  it is off by default.  We do not include it
969// in -Wparentheses because most users who use -Wparentheses explicitly
970// do not want these warnings.
971def ParenthesesOnEquality : DiagGroup<"parentheses-equality">;
972def Parentheses : DiagGroup<"parentheses",
973                            [LogicalOpParentheses,
974                             LogicalNotParentheses,
975                             BitwiseConditionalParentheses,
976                             BitwiseOpParentheses,
977                             ShiftOpParentheses,
978                             OverloadedShiftOpParentheses,
979                             ParenthesesOnEquality,
980                             DanglingElse]>;
981
982// -Wconversion has its own warnings, but we split a few out for
983// legacy reasons:
984//   - some people want just 64-to-32 warnings
985//   - conversion warnings with constant sources are on by default
986//   - conversion warnings for literals are on by default
987//   - bool-to-pointer conversion warnings are on by default
988//   - __null-to-integer conversion warnings are on by default
989def Conversion : DiagGroup<"conversion",
990                           [BoolConversion,
991                            ConstantConversion,
992                            EnumConversion,
993                            BitFieldEnumConversion,
994                            FloatConversion,
995                            IntConversion,
996                            ImplicitIntConversion,
997                            ImplicitFloatConversion,
998                            LiteralConversion,
999                            NonLiteralNullConversion, // (1-1)->pointer (etc)
1000                            NullConversion, // NULL->non-pointer
1001                            ObjCLiteralConversion,
1002                            SignConversion,
1003                            StringConversion]>,
1004                 DiagCategory<"Value Conversion Issue">;
1005
1006def Unused : DiagGroup<"unused",
1007                       [UnusedArgument, UnusedFunction, UnusedLabel,
1008                        // UnusedParameter, (matches GCC's behavior)
1009                        // UnusedTemplate, (clean-up libc++ before enabling)
1010                        // UnusedMemberFunction, (clean-up llvm before enabling)
1011                        UnusedPrivateField, UnusedLambdaCapture,
1012                        UnusedLocalTypedef, UnusedValue, UnusedVariable,
1013                        UnusedButSetVariable, UnusedPropertyIvar]>,
1014                        DiagCategory<"Unused Entity Issue">;
1015
1016// Format settings.
1017def FormatInvalidSpecifier : DiagGroup<"format-invalid-specifier">;
1018def FormatSecurity : DiagGroup<"format-security">;
1019def FormatNonStandard : DiagGroup<"format-non-iso">;
1020def FormatY2K : DiagGroup<"format-y2k">;
1021def FormatPedantic : DiagGroup<"format-pedantic">;
1022def FormatSignedness : DiagGroup<"format-signedness">;
1023def FormatTypeConfusion : DiagGroup<"format-type-confusion">;
1024
1025def FormatOverflowNonKprintf: DiagGroup<"format-overflow-non-kprintf">;
1026def FormatOverflow: DiagGroup<"format-overflow", [FormatOverflowNonKprintf]>;
1027def FormatTruncationNonKprintf: DiagGroup<"format-truncation-non-kprintf">;
1028def FormatTruncation: DiagGroup<"format-truncation", [FormatTruncationNonKprintf]>;
1029
1030def Format : DiagGroup<"format",
1031                       [FormatExtraArgs, FormatZeroLength, NonNull,
1032                        FormatSecurity, FormatY2K, FormatInvalidSpecifier,
1033                        FormatInsufficientArgs, FormatOverflow, FormatTruncation]>,
1034             DiagCategory<"Format String Issue">;
1035def FormatNonLiteral : DiagGroup<"format-nonliteral">;
1036def Format2 : DiagGroup<"format=2",
1037                        [FormatNonLiteral, FormatSecurity, FormatY2K]>;
1038
1039def TypeSafety : DiagGroup<"type-safety">;
1040
1041def IncompatibleExceptionSpec : DiagGroup<"incompatible-exception-spec">;
1042
1043def IntToVoidPointerCast : DiagGroup<"int-to-void-pointer-cast">;
1044def IntToPointerCast : DiagGroup<"int-to-pointer-cast",
1045                                 [IntToVoidPointerCast]>;
1046def VoidPointerToEnumCast : DiagGroup<"void-pointer-to-enum-cast">;
1047def VoidPointerToIntCast : DiagGroup<"void-pointer-to-int-cast",
1048                                     [VoidPointerToEnumCast]>;
1049def PointerToEnumCast : DiagGroup<"pointer-to-enum-cast",
1050                                  [VoidPointerToEnumCast]>;
1051def PointerToIntCast : DiagGroup<"pointer-to-int-cast",
1052                                 [PointerToEnumCast, VoidPointerToIntCast]>;
1053def VoidPointerDeref : DiagGroup<"void-ptr-dereference">;
1054
1055def FUseLdPath : DiagGroup<"fuse-ld-path">;
1056
1057def Move : DiagGroup<"move", [
1058    PessimizingMove,
1059    RedundantMove,
1060    ReturnStdMove,
1061    SelfMove
1062  ]>;
1063
1064def Extra : DiagGroup<"extra", [
1065    DeprecatedCopy,
1066    MissingFieldInitializers,
1067    IgnoredQualifiers,
1068    InitializerOverrides,
1069    SemiBeforeMethodBody,
1070    MissingMethodReturnType,
1071    SignCompare,
1072    UnusedParameter,
1073    UnusedButSetParameter,
1074    NullPointerArithmetic,
1075    NullPointerSubtraction,
1076    EmptyInitStatement,
1077    StringConcatation,
1078    FUseLdPath,
1079    CastFunctionTypeMismatch,
1080  ]>;
1081
1082def Most : DiagGroup<"most", [
1083    ArrayParameter,
1084    BoolOperation,
1085    CharSubscript,
1086    Comment,
1087    DeleteNonVirtualDtor,
1088    Format,
1089    ForLoopAnalysis,
1090    FrameAddress,
1091    Implicit,
1092    InfiniteRecursion,
1093    IntInBoolContext,
1094    MismatchedTags,
1095    MissingBraces,
1096    Move,
1097    MultiChar,
1098    RangeLoopConstruct,
1099    Reorder,
1100    ReturnType,
1101    SelfAssignment,
1102    SelfMove,
1103    SizeofArrayArgument,
1104    SizeofArrayDecay,
1105    StringPlusInt,
1106    TautologicalCompare,
1107    Trigraphs,
1108    Uninitialized,
1109    UnknownPragmas,
1110    Unused,
1111    VolatileRegisterVar,
1112    ObjCMissingSuperCalls,
1113    ObjCDesignatedInit,
1114    ObjCFlexibleArray,
1115    OverloadedVirtual,
1116    PrivateExtern,
1117    SelTypeCast,
1118    ExternCCompat,
1119    UserDefinedWarnings
1120 ]>;
1121
1122// Thread Safety warnings
1123def ThreadSafetyAttributes : DiagGroup<"thread-safety-attributes">;
1124def ThreadSafetyAnalysis   : DiagGroup<"thread-safety-analysis">;
1125def ThreadSafetyPrecise    : DiagGroup<"thread-safety-precise">;
1126def ThreadSafetyReferenceReturn  : DiagGroup<"thread-safety-reference-return">;
1127def ThreadSafetyReference  : DiagGroup<"thread-safety-reference",
1128                                             [ThreadSafetyReferenceReturn]>;
1129def ThreadSafetyNegative   : DiagGroup<"thread-safety-negative">;
1130def ThreadSafety : DiagGroup<"thread-safety",
1131                             [ThreadSafetyAttributes,
1132                              ThreadSafetyAnalysis,
1133                              ThreadSafetyPrecise,
1134                              ThreadSafetyReference]>;
1135def ThreadSafetyVerbose : DiagGroup<"thread-safety-verbose">;
1136def ThreadSafetyBeta : DiagGroup<"thread-safety-beta">;
1137
1138// Warnings and notes related to the function effects system which underlies
1139// the nonblocking and nonallocating attributes.
1140def FunctionEffects : DiagGroup<"function-effects">;
1141def PerfConstraintImpliesNoexcept : DiagGroup<"perf-constraint-implies-noexcept">;
1142
1143// Uniqueness Analysis warnings
1144def Consumed       : DiagGroup<"consumed">;
1145
1146// Note that putting warnings in -Wall will not disable them by default. If a
1147// warning should be active _only_ when -Wall is passed in, mark it as
1148// DefaultIgnore in addition to putting it here.
1149def All : DiagGroup<"all", [Most, Parentheses, Switch, SwitchBool,
1150                            MisleadingIndentation, PackedNonPod,
1151                            VLACxxExtension, PerfConstraintImpliesNoexcept]>;
1152
1153// Warnings that should be in clang-cl /w4.
1154def : DiagGroup<"CL4", [All, Extra]>;
1155
1156// Warnings enabled by -pedantic.  This is magically filled in by TableGen.
1157def Pedantic : DiagGroup<"pedantic">;
1158
1159// Aliases.
1160def : DiagGroup<"", [Extra]>;                   // -W = -Wextra
1161def : DiagGroup<"endif-labels", [ExtraTokens]>; // -Wendif-labels=-Wextra-tokens
1162def : DiagGroup<"cpp", [PoundWarning]>;         // -Wcpp = -W#warnings
1163def : DiagGroup<"comments", [Comment]>;         // -Wcomments = -Wcomment
1164def : DiagGroup<"conversion-null",
1165                [NullConversion]>; // -Wconversion-null = -Wnull-conversion
1166def : DiagGroup<"bool-conversions",
1167                [BoolConversion]>; // -Wbool-conversions  = -Wbool-conversion
1168def : DiagGroup<"int-conversions",
1169                [IntConversion]>; // -Wint-conversions = -Wint-conversion
1170def : DiagGroup<"vector-conversions",
1171                [VectorConversion]>; // -Wvector-conversions = -Wvector-conversion
1172def : DiagGroup<"unused-local-typedefs", [UnusedLocalTypedef]>;
1173                // -Wunused-local-typedefs = -Wunused-local-typedef
1174
1175// A warning group for warnings that we want to have on by default in clang,
1176// but which aren't on by default in GCC.
1177def NonGCC : DiagGroup<"non-gcc",
1178    [SignCompare, Conversion, LiteralRange]>;
1179
1180def CXX14Attrs : DiagGroup<"c++14-attribute-extensions">;
1181def CXX17Attrs : DiagGroup<"c++17-attribute-extensions">;
1182def CXX20Attrs : DiagGroup<"c++20-attribute-extensions">;
1183def CXX23Attrs : DiagGroup<"c++23-attribute-extensions">;
1184def FutureAttrs : DiagGroup<"future-attribute-extensions", [CXX14Attrs,
1185                                                            CXX17Attrs,
1186                                                            CXX20Attrs,
1187                                                            CXX23Attrs]>;
1188
1189def CXX23AttrsOnLambda : DiagGroup<"c++23-lambda-attributes">;
1190
1191// A warning group for warnings about using C++11 features as extensions in
1192// earlier C++ versions.
1193def CXX11 : DiagGroup<"c++11-extensions", [CXX11ExtraSemi, CXX11InlineNamespace,
1194                                           CXX11LongLong]>;
1195
1196// A warning group for warnings about using C++14 features as extensions in
1197// earlier C++ versions.
1198def CXX14 : DiagGroup<"c++14-extensions", [CXX14BinaryLiteral, CXX14Attrs]>;
1199
1200// A warning group for warnings about using C++17 features as extensions in
1201// earlier C++ versions.
1202def CXX17 : DiagGroup<"c++17-extensions", [CXX17Attrs]>;
1203
1204// A warning group for warnings about using C++20 features as extensions in
1205// earlier C++ versions.
1206def CXX20 : DiagGroup<"c++20-extensions", [CXX20Designator, CXX20Attrs, VariadicMacroArgumentsOmitted]>;
1207
1208// A warning group for warnings about using C++23 features as extensions in
1209// earlier C++ versions.
1210def CXX23 : DiagGroup<"c++23-extensions", [CXX23AttrsOnLambda]>;
1211
1212// A warning group for warnings about using C++26 features as extensions in
1213// earlier C++ versions.
1214def CXX26 : DiagGroup<"c++26-extensions">;
1215
1216def : DiagGroup<"c++0x-extensions", [CXX11]>;
1217def : DiagGroup<"c++1y-extensions", [CXX14]>;
1218def : DiagGroup<"c++1z-extensions", [CXX17]>;
1219def : DiagGroup<"c++2a-extensions", [CXX20]>;
1220def : DiagGroup<"c++2b-extensions", [CXX23]>;
1221def : DiagGroup<"c++2c-extensions", [CXX26]>;
1222
1223def DelegatingCtorCycles :
1224  DiagGroup<"delegating-ctor-cycles">;
1225
1226// A warning group for warnings about using C11 features as extensions.
1227def C11 : DiagGroup<"c11-extensions">;
1228
1229// A warning group for warnings about using C99 features as extensions.
1230def C99 : DiagGroup<"c99-extensions", [C99Designator]>;
1231
1232// A warning group for warnings about using C23 features as extensions.
1233def C23 : DiagGroup<"c23-extensions", [VariadicMacroArgumentsOmitted]>;
1234
1235def : DiagGroup<"c2x-extensions", [C23]>;
1236
1237// A warning group for warnings about using C2y features as extensions.
1238def C2y : DiagGroup<"c2y-extensions">;
1239
1240// Previously supported warning group which is no longer pertinent as binary
1241// literals are a C++14 and C23 extension now instead of a GNU extension.
1242def GNUBinaryLiteral : DiagGroup<"gnu-binary-literal">;
1243
1244// A warning group for warnings about GCC extensions.
1245def GNU : DiagGroup<"gnu", [GNUAlignofExpression, GNUAnonymousStruct,
1246                            GNUAutoType, GNUBinaryLiteral, GNUCaseRange,
1247                            GNUComplexInteger, GNUCompoundLiteralInitializer,
1248                            GNUConditionalOmittedOperand, GNUDesignator,
1249                            GNUEmptyStruct,
1250                            VLAExtension, GNUFlexibleArrayInitializer,
1251                            GNUFlexibleArrayUnionMember, GNUFoldingConstant,
1252                            GNUImaginaryConstant, GNUIncludeNext,
1253                            GNULabelsAsValue, GNULineMarker, GNUNullPointerArithmetic,
1254                            GNUOffsetofExtensions, GNUPointerArith,
1255                            RedeclaredClassMember, GNURedeclaredEnum,
1256                            GNUStatementExpression, GNUStaticFloatInit,
1257                            GNUStringLiteralOperatorTemplate, GNUUnionCast,
1258                            GNUVariableSizedTypeNotAtEnd, ZeroLengthArray,
1259                            GNUZeroLineDirective,
1260                            GNUZeroVariadicMacroArguments]>;
1261// A warning group for warnings about code that clang accepts but gcc doesn't.
1262def GccCompat : DiagGroup<"gcc-compat">;
1263
1264// A warning group for warnings about code that may be incompatible on AIX.
1265def AIXCompat : DiagGroup<"aix-compat">;
1266
1267// Warnings for Microsoft extensions.
1268def MicrosoftCharize : DiagGroup<"microsoft-charize">;
1269def MicrosoftDrectveSection : DiagGroup<"microsoft-drectve-section">;
1270def MicrosoftInclude : DiagGroup<"microsoft-include">;
1271def MicrosoftCppMacro : DiagGroup<"microsoft-cpp-macro">;
1272def MicrosoftFixedEnum : DiagGroup<"microsoft-fixed-enum">;
1273def MicrosoftSealed : DiagGroup<"microsoft-sealed">;
1274def MicrosoftAbstract : DiagGroup<"microsoft-abstract">;
1275def MicrosoftUnqualifiedFriend : DiagGroup<"microsoft-unqualified-friend">;
1276def MicrosoftExceptionSpec : DiagGroup<"microsoft-exception-spec">;
1277def MicrosoftUsingDecl : DiagGroup<"microsoft-using-decl">;
1278def MicrosoftMutableReference : DiagGroup<"microsoft-mutable-reference">;
1279def MicrosoftPureDefinition : DiagGroup<"microsoft-pure-definition">;
1280def MicrosoftUnionMemberReference : DiagGroup<
1281    "microsoft-union-member-reference">;
1282def MicrosoftExplicitConstructorCall : DiagGroup<
1283    "microsoft-explicit-constructor-call">;
1284def MicrosoftEnumValue : DiagGroup<"microsoft-enum-value">;
1285def MicrosoftDefaultArgRedefinition :
1286    DiagGroup<"microsoft-default-arg-redefinition">;
1287def MicrosoftTemplateShadow : DiagGroup<"microsoft-template-shadow">;
1288def MicrosoftTemplate : DiagGroup<"microsoft-template", [MicrosoftTemplateShadow]>;
1289def MicrosoftInconsistentDllImport : DiagGroup<"inconsistent-dllimport">;
1290def MicrosoftRedeclareStatic : DiagGroup<"microsoft-redeclare-static">;
1291def MicrosoftEnumForwardReference :
1292    DiagGroup<"microsoft-enum-forward-reference">;
1293def MicrosoftGoto : DiagGroup<"microsoft-goto">;
1294def MicrosoftFlexibleArray : DiagGroup<"microsoft-flexible-array">;
1295def MicrosoftExtraQualification : DiagGroup<"microsoft-extra-qualification">;
1296def MicrosoftCast : DiagGroup<"microsoft-cast">;
1297def MicrosoftConstInit : DiagGroup<"microsoft-const-init">;
1298def MicrosoftVoidPseudoDtor : DiagGroup<"microsoft-void-pseudo-dtor">;
1299def MicrosoftAnonTag : DiagGroup<"microsoft-anon-tag">;
1300def MicrosoftCommentPaste : DiagGroup<"microsoft-comment-paste">;
1301def MicrosoftEndOfFile : DiagGroup<"microsoft-end-of-file">;
1302def MicrosoftInaccessibleBase : DiagGroup<"microsoft-inaccessible-base">;
1303def MicrosoftStaticAssert : DiagGroup<"microsoft-static-assert">;
1304def MicrosoftInitFromPredefined : DiagGroup<"microsoft-init-from-predefined">;
1305def MicrosoftStringLiteralFromPredefined : DiagGroup<
1306    "microsoft-string-literal-from-predefined">;
1307
1308// Aliases.
1309def : DiagGroup<"msvc-include", [MicrosoftInclude]>;
1310                // -Wmsvc-include = -Wmicrosoft-include
1311
1312// Warnings group for warnings about Microsoft extensions.
1313def Microsoft : DiagGroup<"microsoft",
1314    [MicrosoftCharize, MicrosoftDrectveSection, MicrosoftInclude,
1315     MicrosoftCppMacro, MicrosoftFixedEnum, MicrosoftSealed, MicrosoftAbstract,
1316     MicrosoftUnqualifiedFriend, MicrosoftExceptionSpec, MicrosoftUsingDecl,
1317     MicrosoftMutableReference, MicrosoftPureDefinition,
1318     MicrosoftUnionMemberReference, MicrosoftExplicitConstructorCall,
1319     MicrosoftEnumValue, MicrosoftDefaultArgRedefinition, MicrosoftTemplate,
1320     MicrosoftRedeclareStatic, MicrosoftEnumForwardReference, MicrosoftGoto,
1321     MicrosoftFlexibleArray, MicrosoftExtraQualification, MicrosoftCast,
1322     MicrosoftConstInit, MicrosoftVoidPseudoDtor, MicrosoftAnonTag,
1323     MicrosoftCommentPaste, MicrosoftEndOfFile, MicrosoftStaticAssert,
1324     MicrosoftInitFromPredefined, MicrosoftStringLiteralFromPredefined,
1325     MicrosoftInconsistentDllImport]>;
1326
1327def ClangClPch : DiagGroup<"clang-cl-pch">;
1328
1329def ObjCNonUnifiedException : DiagGroup<"objc-nonunified-exceptions">;
1330
1331def ObjCProtocolMethodImpl : DiagGroup<"objc-protocol-method-implementation">;
1332
1333def ObjCNoPropertyAutoSynthesis : DiagGroup<"objc-property-synthesis">;
1334
1335// ObjC API warning groups.
1336def ObjCRedundantLiteralUse : DiagGroup<"objc-redundant-literal-use">;
1337def ObjCRedundantAPIUse : DiagGroup<"objc-redundant-api-use", [
1338    ObjCRedundantLiteralUse
1339  ]>;
1340
1341def ObjCCocoaAPI : DiagGroup<"objc-cocoa-api", [
1342    ObjCRedundantAPIUse
1343  ]>;
1344
1345def ObjCStringComparison : DiagGroup<"objc-string-compare">;
1346def ObjCStringConcatenation : DiagGroup<"objc-string-concatenation">;
1347def ObjCLiteralComparison : DiagGroup<"objc-literal-compare", [
1348    ObjCStringComparison
1349  ]>;
1350
1351def ObjCSignedCharBool : DiagGroup<"objc-signed-char-bool",
1352  [ObjCSignedCharBoolImplicitIntConversion,
1353   ObjCSignedCharBoolImplicitFloatConversion,
1354   ObjCBoolConstantConversion,
1355   TautologicalObjCBoolCompare]>;
1356
1357def ObjCPotentiallyDirectSelector : DiagGroup<"potentially-direct-selector">;
1358def ObjCStrictPotentiallyDirectSelector :
1359  DiagGroup<"strict-potentially-direct-selector",
1360            [ObjCPotentiallyDirectSelector]>;
1361
1362// Inline ASM warnings.
1363def ASMOperandWidths : DiagGroup<"asm-operand-widths">;
1364def ASM : DiagGroup<"asm", [
1365    ASMOperandWidths
1366  ]>;
1367
1368// Linker warnings.
1369def LinkerWarnings : DiagGroup<"linker-warnings">;
1370
1371// OpenMP warnings.
1372def SourceUsesOpenMP : DiagGroup<"source-uses-openmp">;
1373def OpenMPClauses : DiagGroup<"openmp-clauses">;
1374def OpenMPLoopForm : DiagGroup<"openmp-loop-form">;
1375def OpenMPMapping : DiagGroup<"openmp-mapping">;
1376def OpenMPTarget : DiagGroup<"openmp-target", [OpenMPMapping]>;
1377def OpenMPPre51Compat : DiagGroup<"pre-openmp-51-compat">;
1378def OpenMP51Ext : DiagGroup<"openmp-51-extensions">;
1379def OpenMPExtensions : DiagGroup<"openmp-extensions">;
1380def OpenMPTargetException : DiagGroup<"openmp-target-exception">;
1381def OpenMP : DiagGroup<"openmp", [
1382    SourceUsesOpenMP, OpenMPClauses, OpenMPLoopForm, OpenMPTarget,
1383    OpenMPMapping, OpenMP51Ext, OpenMPExtensions, OpenMPTargetException
1384  ]>;
1385
1386// OpenACC warnings.
1387def SourceUsesOpenACC : DiagGroup<"source-uses-openacc">;
1388def OpenACC : DiagGroup<"openacc", [SourceUsesOpenACC]>;
1389
1390// Backend warnings.
1391def BackendInlineAsm : DiagGroup<"inline-asm">;
1392def BackendSourceMgr : DiagGroup<"source-mgr">;
1393def BackendFrameLargerThan : DiagGroup<"frame-larger-than">{
1394 code Documentation = [{
1395More fine grained information about the stack layout is available by adding the
1396`-Rpass-analysis=stack-frame-layout` command-line flag to the compiler
1397invocation.
1398
1399The diagnostic information can be saved to a file in a machine readable format,
1400like YAML by adding the `-foptimization-record-file=<file>` command-line flag.
1401
1402Results can be filtered by function name by passing
1403`-mllvm -filter-print-funcs=foo`, where `foo` is the target function's name.
1404
1405   .. code-block:: console
1406
1407      clang -c a.cpp -Rpass-analysis=stack-frame-layout -mllvm -filter-print-funcs=foo
1408
1409   .. code-block:: console
1410
1411      clang -c a.cpp -Rpass-analysis=stack-frame-layout -foptimization-record-file=<file>
1412}];
1413}
1414// Compatibility flag name from old versions of Clang.
1415def : DiagGroup<"frame-larger-than=", [BackendFrameLargerThan]>;
1416def BackendPlugin : DiagGroup<"backend-plugin">;
1417def RemarkBackendPlugin : DiagGroup<"remark-backend-plugin">;
1418def BackendOptimizationRemark : DiagGroup<"pass">;
1419def BackendOptimizationRemarkMissed : DiagGroup<"pass-missed">;
1420def BackendOptimizationRemarkAnalysis : DiagGroup<"pass-analysis">;
1421def BackendOptimizationFailure : DiagGroup<"pass-failed">;
1422def BackendWarningAttributes : DiagGroup<"attribute-warning">;
1423
1424// Instrumentation based profiling warnings.
1425def ProfileInstrMissing : DiagGroup<"profile-instr-missing">;
1426def ProfileInstrOutOfDate : DiagGroup<"profile-instr-out-of-date">;
1427def ProfileInstrUnprofiled : DiagGroup<"profile-instr-unprofiled">;
1428def MisExpect : DiagGroup<"misexpect">;
1429
1430// AddressSanitizer frontend instrumentation remarks.
1431def SanitizeAddressRemarks : DiagGroup<"sanitize-address">;
1432
1433// Issues with serialized diagnostics.
1434def SerializedDiagnostics : DiagGroup<"serialized-diagnostics">;
1435
1436// A warning group for warnings about code that clang accepts when
1437// compiling CUDA C/C++ but which is not compatible with the CUDA spec.
1438def CudaCompat : DiagGroup<"cuda-compat">;
1439
1440// Warning about unknown CUDA SDK version.
1441def CudaUnknownVersion: DiagGroup<"unknown-cuda-version">;
1442
1443// A warning group for warnings about features supported by HIP but
1444// ignored by CUDA.
1445def HIPOnly : DiagGroup<"hip-only">;
1446
1447// Warning about mixed HIP and OpenMP compilation / target offloading.
1448def HIPOpenMPOffloading: DiagGroup<"hip-omp-target-directives">;
1449
1450// Warning about multiple GPUs are detected.
1451def MultiGPU: DiagGroup<"multi-gpu">;
1452
1453// Warnings which cause linking of the runtime libraries like
1454// libc and the CRT to be skipped.
1455def AVRRtlibLinkingQuirks : DiagGroup<"avr-rtlib-linking-quirks">;
1456
1457// A warning group related to AArch64 SME function attribues.
1458def AArch64SMEAttributes : DiagGroup<"aarch64-sme-attributes">;
1459
1460// A warning group for things that will change semantics in the future.
1461def FutureCompat : DiagGroup<"future-compat">;
1462
1463def InvalidOrNonExistentDirectory : DiagGroup<"invalid-or-nonexistent-directory">;
1464
1465def OptionIgnored : DiagGroup<"option-ignored">;
1466
1467def UnknownArgument : DiagGroup<"unknown-argument">;
1468
1469def UnsupportedABI : DiagGroup<"unsupported-abi">;
1470
1471// A warning group for warnings about code that clang accepts when
1472// compiling OpenCL C/C++ but which is not compatible with the SPIR(-V) spec.
1473def SpirCompat : DiagGroup<"spir-compat">;
1474def : DiagGroup<"spirv-compat", [SpirCompat]>; // Alias.
1475
1476// Warning for the GlobalISel options.
1477def GlobalISel : DiagGroup<"global-isel">;
1478
1479// A warning group for the GNU extension to allow mixed specifier types for
1480// target-clones multiversioning.
1481def TargetClonesMixedSpecifiers : DiagGroup<"target-clones-mixed-specifiers">;
1482
1483// A warning group specifically for warnings related to function
1484// multiversioning.
1485def FunctionMultiVersioning
1486    : DiagGroup<"function-multiversion", [TargetClonesMixedSpecifiers]>;
1487
1488def NoDeref : DiagGroup<"noderef">;
1489
1490// -fbounds-safety and bounds annotation related warnings
1491def BoundsSafetyCountedByEltTyUnknownSize :
1492  DiagGroup<"bounds-safety-counted-by-elt-type-unknown-size">;
1493
1494// A group for cross translation unit static analysis related warnings.
1495def CrossTU : DiagGroup<"ctu">;
1496
1497def CTADMaybeUnsupported : DiagGroup<"ctad-maybe-unsupported">;
1498
1499def FortifySource : DiagGroup<"fortify-source", [FormatOverflow, FormatTruncation]>;
1500
1501def MaxTokens : DiagGroup<"max-tokens"> {
1502  code Documentation = [{
1503The warning is issued if the number of pre-processor tokens exceeds
1504the token limit, which can be set in three ways:
1505
15061. As a limit at a specific point in a file, using the ``clang max_tokens_here``
1507   pragma:
1508
1509   .. code-block:: c++
1510
1511      #pragma clang max_tokens_here 1234
1512
15132. As a per-translation unit limit, using the ``-fmax-tokens=`` command-line
1514   flag:
1515
1516   .. code-block:: console
1517
1518      clang -c a.cpp -fmax-tokens=1234
1519
15203. As a per-translation unit limit using the ``clang max_tokens_total`` pragma,
1521   which works like and overrides the ``-fmax-tokens=`` flag:
1522
1523   .. code-block:: c++
1524
1525      #pragma clang max_tokens_total 1234
1526
1527These limits can be helpful in limiting code growth through included files.
1528
1529Setting a token limit of zero means no limit.
1530
1531Note that the warning is disabled by default, so -Wmax-tokens must be used
1532in addition with the pragmas or -fmax-tokens flag to get any warnings.
1533}];
1534}
1535
1536def WebAssemblyExceptionSpec : DiagGroup<"wasm-exception-spec">;
1537
1538def RTTI : DiagGroup<"rtti">;
1539
1540def OpenCLCoreFeaturesDiagGroup : DiagGroup<"pedantic-core-features">;
1541
1542// Warnings and extensions to make preprocessor macro usage pedantic.
1543def PedanticMacros : DiagGroup<"pedantic-macros",
1544                    [DeprecatedPragma,
1545                     MacroRedefined,
1546                     BuiltinMacroRedefined,
1547                     RestrictExpansionMacro,
1548                     FinalMacro]>;
1549
1550def BranchProtection : DiagGroup<"branch-protection">;
1551
1552// HLSL diagnostic groups
1553def HLSL202y : DiagGroup<"hlsl-202y-extensions">;
1554
1555// Warnings for HLSL Clang extensions
1556def HLSLExtension : DiagGroup<"hlsl-extensions", [HLSL202y]>;
1557
1558// Warning for mix packoffset and non-packoffset.
1559def HLSLMixPackOffset : DiagGroup<"mix-packoffset">;
1560
1561// Warnings for DXIL validation
1562def DXILValidation : DiagGroup<"dxil-validation">;
1563
1564// Warning for HLSL API availability
1565def HLSLAvailability : DiagGroup<"hlsl-availability">;
1566
1567// Warnings specifically for DXC incompatabilities.
1568def HLSLDXCCompat : DiagGroup<"hlsl-dxc-compatability">;
1569
1570// Warnings for legacy binding behavior
1571def LegacyConstantRegisterBinding : DiagGroup<"legacy-constant-register-binding">;
1572
1573// Warning for HLSL Attributes on Statement.
1574def HLSLAttributeStatement : DiagGroup<"attribute-statement">;
1575
1576// Warnings and notes related to const_var_decl_type attribute checks
1577def ReadOnlyPlacementChecks : DiagGroup<"read-only-types">;
1578
1579// Warnings and fixes to support the "safe buffers" programming model.
1580def UnsafeBufferUsageInContainer : DiagGroup<"unsafe-buffer-usage-in-container">;
1581def UnsafeBufferUsageInLibcCall : DiagGroup<"unsafe-buffer-usage-in-libc-call">;
1582def UnsafeBufferUsage : DiagGroup<"unsafe-buffer-usage", [UnsafeBufferUsageInContainer, UnsafeBufferUsageInLibcCall]>;
1583
1584// Warnings and notes InstallAPI verification.
1585def InstallAPIViolation : DiagGroup<"installapi-violation">;
1586
1587// Warnings related to _BitInt extension
1588def BitIntExtension : DiagGroup<"bit-int-extension">;
1589
1590// Warnings about misuse of ExtractAPI options.
1591def ExtractAPIMisuse : DiagGroup<"extractapi-misuse">;
1592
1593// Warnings about using the non-standard extension having an explicit specialization
1594// with a storage class specifier.
1595def ExplicitSpecializationStorageClass : DiagGroup<"explicit-specialization-storage-class">;
1596
1597// A warning for options that enable a feature that is not yet complete
1598def ExperimentalOption : DiagGroup<"experimental-option">;
1599