1// RUN: %check_clang_tidy -std=c++98-or-later %s bugprone-tagged-union-member-count %t \
2// RUN: -config='{CheckOptions: { \
3// RUN: bugprone-tagged-union-member-count.StrictMode: false, \
4// RUN: bugprone-tagged-union-member-count.EnableCountingEnumHeuristic: true, \
5// RUN: bugprone-tagged-union-member-count.CountingEnumSuffixes: "count;size", \
6// RUN: }}' --
7
8typedef union Union4 {
9 short *Shorts;
10 double *Doubles;
11 int *Ints;
12 float *Floats;
13} union4;
14
15// CHECK-MESSAGES: :[[@LINE+1]]:8: warning: tagged union has more data members (4) than tags (3)
16struct TaggedUnionWithCounterCountSuffix {
17 enum {
18 twc1,
19 twc2,
20 twc3,
21 twc_count,
22 } Kind;
23 union Union4 Data;
24};
25
26// CHECK-MESSAGES: :[[@LINE+1]]:8: warning: tagged union has more data members (4) than tags (3)
27struct TaggedUnionWithCounterSizeSuffix {
28 enum {
29 twc11,
30 twc22,
31 twc33,
32 twc_size,
33 } Kind;
34 union Union4 Data;
35};
36

source code of clang-tools-extra/test/clang-tidy/checkers/bugprone/tagged-union-member-count-counting-enum-suffixes.cpp