| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,156 @@ | ||
| // RUN: %check_clang_tidy -std=c++98-or-later %s bugprone-tagged-union-member-count %t \ | ||
| // RUN: -config='{CheckOptions: { \ | ||
| // RUN: bugprone-tagged-union-member-count.StrictMode: false, \ | ||
| // RUN: bugprone-tagged-union-member-count.EnableCountingEnumHeuristic: true, \ | ||
| // RUN: bugprone-tagged-union-member-count.CountingEnumSuffixes: "count", \ | ||
| // RUN: bugprone-tagged-union-member-count.CountingEnumPrefixes: "last", \ | ||
| // RUN: }}' -- | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:8: warning: tagged union has more data members (3) than tags (2) | ||
| struct IncorrectBecauseHeuristicIsEnabledPrefixCase { | ||
| enum { | ||
| tags1, | ||
| tags2, | ||
| lasttag, | ||
| } Tags; | ||
| union { | ||
| char A; | ||
| short B; | ||
| int C; | ||
| } Data; | ||
| }; | ||
|
|
||
| struct CorrectBecauseHeuristicIsEnabledPrefixCase { // No warnings expected | ||
| enum { | ||
| tags1, | ||
| tags2, | ||
| tags3, | ||
| lasttag, | ||
| } Tags; | ||
| union { | ||
| int A; | ||
| int B; | ||
| int C; | ||
| } Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:8: warning: tagged union has more data members (3) than tags (2) | ||
| struct IncorrectBecauseHeuristicIsEnabledSuffixCase { | ||
| enum { | ||
| tags1, | ||
| tags2, | ||
| tags_count, | ||
| } Tags; | ||
| union { | ||
| char A; | ||
| short B; | ||
| int C; | ||
| } Data; | ||
| }; | ||
|
|
||
| struct CorrectBecauseHeuristicIsEnabledSuffixCase { // No warnings expected | ||
| enum { | ||
| tags1, | ||
| tags2, | ||
| tags3, | ||
| tags_count, | ||
| } Tags; | ||
| union { | ||
| int A; | ||
| int B; | ||
| int C; | ||
| } Data; | ||
| }; | ||
|
|
||
| union Union4 { | ||
| short *Shorts; | ||
| double *Doubles; | ||
| int *Ints; | ||
| float *Floats; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:8: warning: tagged union has more data members (4) than tags (3) | ||
| struct CountingEnumCaseInsensitivityTest1 { | ||
| enum { | ||
| node_type_loop, | ||
| node_type_branch, | ||
| node_type_function, | ||
| node_type_count, | ||
| } Kind; | ||
| union Union4 Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:8: warning: tagged union has more data members (4) than tags (3) | ||
| struct CountingEnumCaseInsensitivityTest2 { | ||
| enum { | ||
| NODE_TYPE_LOOP, | ||
| NODE_TYPE_BRANCH, | ||
| NODE_TYPE_FUNCTION, | ||
| NODE_TYPE_COUNT, | ||
| } Kind; | ||
| union Union4 Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:8: warning: tagged union has more data members (4) than tags (3) | ||
| struct TagWhereCountingEnumIsAliased { | ||
| enum { | ||
| tag_alias_counter1 = 1, | ||
| tag_alias_counter2 = 2, | ||
| tag_alias_counter3 = 3, | ||
| tag_alias_other_count = 3, | ||
| } Kind; | ||
| union { | ||
| char C; | ||
| short S; | ||
| int I; | ||
| long L; | ||
| } Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:8: warning: tagged union has more data members (4) than tags (2) | ||
| struct TagWithCountingEnumButOtherValueIsAliased { | ||
| enum { | ||
| tag_alias_other1 = 1, | ||
| tag_alias_other2 = 1, | ||
| tag_alias_other3 = 3, | ||
| tag_alias_other_count = 2, | ||
| } Kind; | ||
| union { | ||
| char C; | ||
| short S; | ||
| int I; | ||
| long L; | ||
| } Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:8: warning: tagged union has more data members (4) than tags (3) | ||
| struct TagWhereCounterIsTheSmallest { | ||
| enum { | ||
| tag_large1 = 1000, | ||
| tag_large2 = 1001, | ||
| tag_large3 = 1002, | ||
| tag_large_count = 3, | ||
| } Kind; | ||
| union { | ||
| char C; | ||
| short S; | ||
| int I; | ||
| long L; | ||
| } Data; | ||
| }; | ||
|
|
||
| // No warnings expected, only the last enum constant can be a counting enum constant | ||
| struct TagWhereCounterLikeNameIsNotLast { | ||
| enum { | ||
| kind_count, | ||
| kind2, | ||
| last_kind1, | ||
| kind3, | ||
| } Kind; | ||
| union { | ||
| char C; | ||
| short S; | ||
| int I; | ||
| long L; | ||
| } Data; | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| // RUN: %check_clang_tidy -std=c++98-or-later %s bugprone-tagged-union-member-count %t \ | ||
| // RUN: -config='{CheckOptions: { \ | ||
| // RUN: bugprone-tagged-union-member-count.StrictMode: false, \ | ||
| // RUN: bugprone-tagged-union-member-count.EnableCountingEnumHeuristic: true, \ | ||
| // RUN: bugprone-tagged-union-member-count.CountingEnumSuffixes: "count", \ | ||
| // RUN: bugprone-tagged-union-member-count.CountingEnumPrefixes: "last", \ | ||
| // RUN: }}' -- | ||
|
|
||
| union Union3 { | ||
| short *Shorts; | ||
| int *Ints; | ||
| float *Floats; | ||
| }; | ||
|
|
||
| union Union4 { | ||
| short *Shorts; | ||
| double *Doubles; | ||
| int *Ints; | ||
| float *Floats; | ||
| }; | ||
|
|
||
| // The heuristic only considers the last enum constant | ||
| // CHECK-MESSAGES: :[[@LINE+1]]:8: warning: tagged union has more data members (4) than tags (3) | ||
| struct TaggedUnionPrefixAndSuffixMatch { | ||
| enum { | ||
| tags1, | ||
| tags2, | ||
| tagscount, | ||
| lasttags | ||
| } Kind; | ||
| Union4 Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:8: warning: tagged union has more data members (3) than tags (2) | ||
| struct TaggedUnionOnlyPrefixMatch { | ||
| enum { | ||
| prefixtag1, | ||
| prefixtag2, | ||
| lastprefixtag | ||
| } Kind; | ||
| Union3 Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:8: warning: tagged union has more data members (3) than tags (2) | ||
| struct TaggedUnionOnlySuffixMatch { | ||
| enum { | ||
| suffixtag1, | ||
| suffixtag2, | ||
| suffixtagcount | ||
| } Kind; | ||
| Union3 Data; | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| // RUN: %check_clang_tidy -std=c++98-or-later %s bugprone-tagged-union-member-count %t \ | ||
| // RUN: -config='{CheckOptions: { \ | ||
| // RUN: bugprone-tagged-union-member-count.StrictMode: false, \ | ||
| // RUN: bugprone-tagged-union-member-count.EnableCountingEnumHeuristic: true, \ | ||
| // RUN: bugprone-tagged-union-member-count.CountingEnumPrefixes: "maxsize;last", \ | ||
| // RUN: }}' -- | ||
|
|
||
| union Union4 { | ||
| short *Shorts; | ||
| double *Doubles; | ||
| int *Ints; | ||
| float *Floats; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:8: warning: tagged union has more data members (4) than tags (3) | ||
| struct TaggedUnionWithMaxsizeAsCounterPrefix { | ||
| enum { | ||
| twc1, | ||
| twc2, | ||
| twc3, | ||
| maxsizetwc, | ||
| } Kind; | ||
| Union4 Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:8: warning: tagged union has more data members (4) than tags (3) | ||
| struct TaggedUnionWithLastAsCounterPrefix { | ||
| enum { | ||
| twc11, | ||
| twc22, | ||
| twc33, | ||
| lasttwc, | ||
| } Kind; | ||
| Union4 Data; | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| // RUN: %check_clang_tidy -std=c++98-or-later %s bugprone-tagged-union-member-count %t \ | ||
| // RUN: -config='{CheckOptions: { \ | ||
| // RUN: bugprone-tagged-union-member-count.StrictMode: false, \ | ||
| // RUN: bugprone-tagged-union-member-count.EnableCountingEnumHeuristic: true, \ | ||
| // RUN: bugprone-tagged-union-member-count.CountingEnumSuffixes: "count;size", \ | ||
| // RUN: }}' -- | ||
|
|
||
| typedef union Union4 { | ||
| short *Shorts; | ||
| double *Doubles; | ||
| int *Ints; | ||
| float *Floats; | ||
| } union4; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:8: warning: tagged union has more data members (4) than tags (3) | ||
| struct TaggedUnionWithCounterCountSuffix { | ||
| enum { | ||
| twc1, | ||
| twc2, | ||
| twc3, | ||
| twc_count, | ||
| } Kind; | ||
| union Union4 Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:8: warning: tagged union has more data members (4) than tags (3) | ||
| struct TaggedUnionWithCounterSizeSuffix { | ||
| enum { | ||
| twc11, | ||
| twc22, | ||
| twc33, | ||
| twc_size, | ||
| } Kind; | ||
| union Union4 Data; | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| // RUN: %check_clang_tidy -std=c++98-or-later %s bugprone-tagged-union-member-count %t \ | ||
| // RUN: -config='{CheckOptions: { \ | ||
| // RUN: bugprone-tagged-union-member-count.StrictMode: false, \ | ||
| // RUN: }}' -- | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:8: warning: tagged union has more data members (2) than tags (1) | ||
| struct Incorrect { | ||
| enum { | ||
| tags1, | ||
| } Tags; | ||
| union { | ||
| char A; | ||
| short B; | ||
| } Data; | ||
| }; | ||
|
|
||
| struct CorrectBecauseStrictModeIsDisabled { // No warnings expected | ||
| enum { | ||
| tags1, | ||
| tags2, | ||
| tags3, | ||
| } Tags; | ||
| union { | ||
| char A; | ||
| short B; | ||
| } Data; | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| // RUN: %check_clang_tidy -std=c++98-or-later %s bugprone-tagged-union-member-count %t \ | ||
| // RUN: -config='{CheckOptions: { \ | ||
| // RUN: bugprone-tagged-union-member-count.StrictMode: true, \ | ||
| // RUN: }}' -- | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:8: warning: tagged union has fewer data members (2) than tags (3) | ||
| struct IncorrectBecauseStrictmodeIsEnabled { | ||
| enum { | ||
| tags1, | ||
| tags2, | ||
| tags3, | ||
| } Tags; | ||
| union { | ||
| char A; | ||
| short B; | ||
| } Data; | ||
| }; | ||
|
|
||
| struct Correct { // No warnings expected | ||
| enum { | ||
| tags1, | ||
| tags2, | ||
| tags3, | ||
| } Tags; | ||
| union { | ||
| char A; | ||
| short B; | ||
| int C; | ||
| } Data; | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,149 @@ | ||
| // RUN: %check_clang_tidy %s bugprone-tagged-union-member-count %t | ||
|
|
||
| typedef enum Tags3 { | ||
| tags3_1, | ||
| tags3_2, | ||
| tags3_3, | ||
| } Tags3; | ||
|
|
||
| typedef enum Tags4 { | ||
| tags4_1, | ||
| tags4_2, | ||
| tags4_3, | ||
| tags4_4, | ||
| } Tags4; | ||
|
|
||
| typedef union Union3 { | ||
| short *Shorts; | ||
| int *Ints; | ||
| float *Floats; | ||
| } Union3; | ||
|
|
||
| typedef union Union4 { | ||
| short *Shorts; | ||
| double *Doubles; | ||
| int *Ints; | ||
| float *Floats; | ||
| } Union4; | ||
|
|
||
| // It is not obvious which enum is the tag for the union. | ||
| struct maybeTaggedUnion1 { // No warnings expected. | ||
| enum Tags3 TagA; | ||
| enum Tags4 TagB; | ||
| union Union4 Data; | ||
| }; | ||
|
|
||
| // It is not obvious which union does the tag belong to. | ||
| struct maybeTaggedUnion2 { // No warnings expected. | ||
| enum Tags3 Tag; | ||
| union Union3 DataB; | ||
| union Union3 DataA; | ||
| }; | ||
|
|
||
| // It is not obvious which union does the tag belong to. | ||
| struct maybeTaggedUnion3 { // No warnings expected. | ||
| enum Tags3 Tag; | ||
| union { | ||
| int I1; | ||
| int I2; | ||
| int I3; | ||
| }; | ||
| union { | ||
| float F1; | ||
| float F2; | ||
| float F3; | ||
| }; | ||
| }; | ||
|
|
||
| // No warnings expected, because LastATag is just an alias | ||
| struct TaggedUnionWithAliasedEnumConstant { | ||
| enum { | ||
| ATag1, | ||
| ATag2, | ||
| ATag3, | ||
| LastATag = ATag3, | ||
| } Tag; | ||
| union { | ||
| float F; | ||
| int *Ints; | ||
| char Key[8]; | ||
| } Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:8: warning: tagged union has more data members (4) than tags (3) | ||
| struct TaggedUnionStructWithPredefinedTagAndPredefinedUnion { | ||
| enum Tags3 Tag; | ||
| union Union4 Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:8: warning: tagged union has more data members (4) than tags (3) | ||
| struct TaggedUnionStructWithPredefinedTagAndInlineUnion { | ||
| enum Tags3 Tag; | ||
| union { | ||
| int *Ints; | ||
| char Characters[13]; | ||
| struct { | ||
| double Re; | ||
| double Im; | ||
| } Complex; | ||
| long L; | ||
| } Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:8: warning: tagged union has more data members (4) than tags (3) | ||
| struct TaggedUnionStructWithInlineTagAndPredefinedUnion { | ||
| enum { | ||
| TaggedUnion7tag1, | ||
| TaggedUnion7tag2, | ||
| TaggedUnion7tag3, | ||
| } Tag; | ||
| union Union4 Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:8: warning: tagged union has more data members (4) than tags (3) | ||
| struct TaggedUnionStructWithInlineTagAndInlineUnion { | ||
| enum { | ||
| TaggedUnion8tag1, | ||
| TaggedUnion8tag2, | ||
| TaggedUnion8tag3, | ||
| } Tag; | ||
| union { | ||
| int *Ints; | ||
| char Characters[13]; | ||
| struct { | ||
| double Re; | ||
| double Im; | ||
| } Complex; | ||
| long L; | ||
| } Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:8: warning: tagged union has more data members (4) than tags (3) | ||
| struct TaggedUnionStructNesting { | ||
| enum Tags3 Tag; | ||
| union { | ||
| float F; | ||
| int I; | ||
| long L; | ||
| // CHECK-MESSAGES: :[[@LINE+1]]:12: warning: tagged union has more data members (4) than tags (3) | ||
| struct innerdecl { | ||
| enum Tags3 Tag; | ||
| union Union4 Data; | ||
| } Inner; | ||
| } Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:8: warning: tagged union has more data members (4) than tags (3) | ||
| struct TaggedUnionStructWithTypedefedTagAndTypedefedUnion { | ||
| Tags3 Tag; | ||
| Union4 Data; | ||
| }; | ||
|
|
||
| #define DECLARE_TAGGED_UNION_STRUCT(Tag, Union, Name)\ | ||
| struct Name {\ | ||
| Tag Kind;\ | ||
| Union Data;\ | ||
| } | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:44: warning: tagged union has more data members (4) than tags (3) | ||
| DECLARE_TAGGED_UNION_STRUCT(Tags3, Union4, TaggedUnionStructFromMacro); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,310 @@ | ||
| // RUN: %check_clang_tidy -std=c++98-or-later %s bugprone-tagged-union-member-count %t | ||
| // Test check with C++ features | ||
|
|
||
| typedef enum Tags3 { | ||
| tags3_1, | ||
| tags3_2, | ||
| tags3_3, | ||
| } Tags3; | ||
|
|
||
| typedef enum Tags4 { | ||
| tags4_1, | ||
| tags4_2, | ||
| tags4_3, | ||
| tags4_4, | ||
| } Tags4; | ||
|
|
||
| enum class Classtags3 { | ||
| classtags3_1, | ||
| classtags3_2, | ||
| classtags3_3, | ||
| }; | ||
|
|
||
| enum class Typedtags3 : unsigned int { | ||
| typedtags3_1, | ||
| typedtags3_2, | ||
| typedtags3_3, | ||
| }; | ||
|
|
||
| typedef union Union3 { | ||
| short *Shorts; | ||
| int *Ints; | ||
| float *Floats; | ||
| } Union3; | ||
|
|
||
| typedef union Union4 { | ||
| short *Shorts; | ||
| double *Doubles; | ||
| int *Ints; | ||
| float *Floats; | ||
| } Union4; | ||
|
|
||
| // It is not obvious which enum is the tag for the union. | ||
| class MaybeTaggedUnion1 { // No warnings expected. | ||
| enum Tags3 TagA; | ||
| enum Tags4 TagB; | ||
| union Union4 Data; | ||
| }; | ||
|
|
||
| // It is not obvious which union does the tag belong to. | ||
| class MaybeTaggedUnion2 { // No warnings expected. | ||
| enum Tags3 Tag; | ||
| union Union3 DataB; | ||
| union Union3 DataA; | ||
| }; | ||
|
|
||
| // It is not obvious which union does the tag belong to. | ||
| class MaybeTaggedUnion3 { // No warnings expected. | ||
| enum Tags3 Tag; | ||
| union { | ||
| int I1; | ||
| int I2; | ||
| int I3; | ||
| }; | ||
| union { | ||
| float F1; | ||
| float F2; | ||
| float F3; | ||
| }; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:7: warning: tagged union has more data members (4) than tags (3) | ||
| class TaggedUnionClassPredefinedTagAndPredefinedUnion { | ||
| enum Tags3 Tag; | ||
| union Union4 Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:7: warning: tagged union has more data members (4) than tags (3) | ||
| class TaggedUnionClassPredefinedTagAndInlineUnion { | ||
| enum Tags3 Tag; | ||
| union { | ||
| int *Ints; | ||
| char Characters[13]; | ||
| class { | ||
| double Re; | ||
| double Im; | ||
| } Complex; | ||
| long L; | ||
| } Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:7: warning: tagged union has more data members (4) than tags (3) | ||
| class TaggedUnionClassInlineTagAndPredefinedUnion { | ||
| enum { | ||
| tag1, | ||
| tag2, | ||
| tag3, | ||
| } Tag; | ||
| union Union4 Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:7: warning: tagged union has more data members (4) than tags (3) | ||
| class TaggedUnionClassInlineTagAndInlineUnion { | ||
| enum { | ||
| tag1, | ||
| tag2, | ||
| tag3, | ||
| } Tag; | ||
| union { | ||
| int *Ints; | ||
| char Characters[13]; | ||
| class { | ||
| double Re; | ||
| double Im; | ||
| } Complex; | ||
| long L; | ||
| } Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:7: warning: tagged union has more data members (4) than tags (3) | ||
| class TaggedUnionClassWithNestedTaggedUnionClass { | ||
| enum Tags3 Tag; | ||
| union { | ||
| float F; | ||
| int I; | ||
| long L; | ||
| // CHECK-MESSAGES: :[[@LINE+1]]:11: warning: tagged union has more data members (4) than tags (3) | ||
| class Innerdecl { | ||
| enum Tags3 Tag; | ||
| union Union4 Data; | ||
| } Inner; | ||
| } Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:7: warning: tagged union has more data members (4) than tags (3) | ||
| class TaggedUnionClassWithTypedefedTag { | ||
| Tags3 Tag; | ||
| Union4 Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:8: warning: tagged union has more data members (4) than tags (3) | ||
| struct TaggedUnionStructWithEnumClass { | ||
| enum Classtags3 Tag; | ||
| Union4 Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:7: warning: tagged union has more data members (4) than tags (3) | ||
| class TaggedUnionClasswithEnumClass { | ||
| enum Classtags3 Tag; | ||
| Union4 Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:8: warning: tagged union has more data members (4) than tags (3) | ||
| struct TaggedUnionStructWithTypedEnum { | ||
| Typedtags3 Tag; | ||
| Union4 Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:7: warning: tagged union has more data members (4) than tags (3) | ||
| class TaggedUnionClassWithTypedEnum { | ||
| Typedtags3 Tag; | ||
| Union4 Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:8: warning: tagged union has more data members (4) than tags (3) | ||
| struct AnonymousTaggedUnionStruct { | ||
| Tags3 Tag; | ||
| union { | ||
| char A; | ||
| short B; | ||
| int C; | ||
| long D; | ||
| }; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:7: warning: tagged union has more data members (4) than tags (3) | ||
| class TaggedUnionClassWithAnonymousUnion { | ||
| Tags3 Tag; | ||
| union { | ||
| char A; | ||
| short B; | ||
| int C; | ||
| long D; | ||
| }; | ||
| }; | ||
|
|
||
| namespace testnamespace { | ||
|
|
||
| enum Tags3 { | ||
| tags3_1, | ||
| tags3_2, | ||
| tags3_3, | ||
| }; | ||
|
|
||
| union Union4 { | ||
| short *Shorts; | ||
| double *Doubles; | ||
| int *Ints; | ||
| float *Floats; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:8: warning: tagged union has more data members (4) than tags (3) | ||
| struct TaggedUnionStructInNamespace { | ||
| Tags3 Tags; | ||
| Union4 Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:7: warning: tagged union has more data members (4) than tags (3) | ||
| class TaggedUnionClassInNamespace { | ||
| Tags3 Tags; | ||
| Union4 Data; | ||
| }; | ||
|
|
||
| } // namespace testnamespace | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:8: warning: tagged union has more data members (4) than tags (3) | ||
| struct TaggedUnionStructWithNamespacedTagAndUnion { | ||
| testnamespace::Tags3 Tags; | ||
| testnamespace::Union4 Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:7: warning: tagged union has more data members (4) than tags (3) | ||
| class TaggedUnionClassWithNamespacedTagAndUnion { | ||
| testnamespace::Tags3 Tags; | ||
| testnamespace::Union4 Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+2]]:8: warning: tagged union has more data members (4) than tags (3) | ||
| template <typename Tag, typename Union> | ||
| struct TemplatedStructWithNamespacedTagAndUnion { | ||
| Tag Kind; | ||
| Union Data; | ||
| }; | ||
|
|
||
| TemplatedStructWithNamespacedTagAndUnion<testnamespace::Union4, testnamespace::Tags3> TemplatedStruct3; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+2]]:7: warning: tagged union has more data members (4) than tags (3) | ||
| template <typename Tag, typename Union> | ||
| class TemplatedClassWithNamespacedTagAndUnion { | ||
| Tag Kind; | ||
| Union Data; | ||
| }; | ||
|
|
||
| TemplatedClassWithNamespacedTagAndUnion<testnamespace::Union4, testnamespace::Tags3> TemplatedClass3; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+2]]:8: warning: tagged union has more data members (4) than tags (3) | ||
| template <typename Tag, typename Union> | ||
| struct TemplatedStruct { | ||
| Tag Kind; | ||
| Union Data; | ||
| }; | ||
|
|
||
| TemplatedStruct<Tags3, Union3> TemplatedStruct1; // No warning expected | ||
| TemplatedStruct<Tags3, Union4> TemplatedStruct2; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+2]]:7: warning: tagged union has more data members (4) than tags (3) | ||
| template <typename Tag, typename Union> | ||
| class TemplatedClass { | ||
| Tag Kind; | ||
| Union Data; | ||
| }; | ||
|
|
||
| TemplatedClass<Tags3, Union3> TemplatedClass1; // No warning expected | ||
| TemplatedClass<Tags3, Union4> TemplatedClass2; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+2]]:8: warning: tagged union has more data members (4) than tags (3) | ||
| template <typename T> | ||
| struct TemplatedStructButTaggedUnionPartIsNotTemplated { | ||
| Tags3 Kind; | ||
| Union4 Data; | ||
| T SomethingElse; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+2]]:7: warning: tagged union has more data members (4) than tags (3) | ||
| template <typename T> | ||
| class TemplatedClassButTaggedUnionPartIsNotTemplated { | ||
| Tags3 Kind; | ||
| Union4 Data; | ||
| T SomethingElse; | ||
| }; | ||
|
|
||
| #define DECLARE_TAGGED_UNION_STRUCT(Tag, Union, Name)\ | ||
| struct Name {\ | ||
| Tag Kind;\ | ||
| Union Data;\ | ||
| } | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:44: warning: tagged union has more data members (4) than tags (3) | ||
| DECLARE_TAGGED_UNION_STRUCT(Tags3, Union4, TaggedUnionStructFromMacro); | ||
|
|
||
| #define DECLARE_TAGGED_UNION_CLASS(Tag, Union, Name)\ | ||
| class Name {\ | ||
| Tag Kind;\ | ||
| Union Data;\ | ||
| } | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:43: warning: tagged union has more data members (4) than tags (3) | ||
| DECLARE_TAGGED_UNION_CLASS(Tags3, Union4, TaggedUnionClassFromMacro); | ||
|
|
||
| // Lambdas implicitly compile down to an unnamed CXXRecordDecl and if they have captures, | ||
| // then those become unnamed fields. | ||
| void DoNotMatchLambdas() { | ||
| enum { | ||
| A | ||
| } e; | ||
| union { | ||
| long A; | ||
| char B; | ||
| } u; | ||
| auto L = [e, u] () {}; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,149 @@ | ||
| // RUN: %check_clang_tidy %s bugprone-tagged-union-member-count %t | ||
|
|
||
| typedef enum Tags3 { | ||
| tags3_1, | ||
| tags3_2, | ||
| tags3_3, | ||
| } Tags3; | ||
|
|
||
| typedef enum Tags4 { | ||
| tags4_1, | ||
| tags4_2, | ||
| tags4_3, | ||
| tags4_4, | ||
| } Tags4; | ||
|
|
||
| typedef union Union3 { | ||
| short *Shorts; | ||
| int *Ints; | ||
| float *Floats; | ||
| } Union3; | ||
|
|
||
| typedef union Union4 { | ||
| short *Shorts; | ||
| double *Doubles; | ||
| int *Ints; | ||
| float *Floats; | ||
| } Union4; | ||
|
|
||
| // It is not obvious which enum is the tag for the union. | ||
| struct maybeTaggedUnion1 { // No warnings expected. | ||
| enum Tags3 TagA; | ||
| enum Tags4 TagB; | ||
| union Union4 Data; | ||
| }; | ||
|
|
||
| // It is not obvious which union does the tag belong to. | ||
| struct maybeTaggedUnion2 { // No warnings expected. | ||
| enum Tags3 Tag; | ||
| union Union3 DataB; | ||
| union Union3 DataA; | ||
| }; | ||
|
|
||
| // It is not obvious which union does the tag belong to. | ||
| struct maybeTaggedUnion3 { // No warnings expected. | ||
| enum Tags3 Tag; | ||
| union { | ||
| int I1; | ||
| int I2; | ||
| int I3; | ||
| }; | ||
| union { | ||
| float F1; | ||
| float F2; | ||
| float F3; | ||
| }; | ||
| }; | ||
|
|
||
| // No warnings expected, because LastATag is just an alias | ||
| struct TaggedUnionWithAliasedEnumConstant { | ||
| enum { | ||
| ATag1, | ||
| ATag2, | ||
| ATag3, | ||
| LastATag = ATag3, | ||
| } Tag; | ||
| union { | ||
| float F; | ||
| int *Ints; | ||
| char Key[8]; | ||
| } Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:8: warning: tagged union has more data members (4) than tags (3) | ||
| struct TaggedUnionStructWithPredefinedTagAndPredefinedUnion { | ||
| enum Tags3 Tag; | ||
| union Union4 Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:8: warning: tagged union has more data members (4) than tags (3) | ||
| struct TaggedUnionStructWithPredefinedTagAndInlineUnion { | ||
| enum Tags3 Tag; | ||
| union { | ||
| int *Ints; | ||
| char Characters[13]; | ||
| struct { | ||
| double Re; | ||
| double Im; | ||
| } Complex; | ||
| long L; | ||
| } Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:8: warning: tagged union has more data members (4) than tags (3) | ||
| struct TaggedUnionStructWithInlineTagAndPredefinedUnion { | ||
| enum { | ||
| TaggedUnion7tag1, | ||
| TaggedUnion7tag2, | ||
| TaggedUnion7tag3, | ||
| } Tag; | ||
| union Union4 Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:8: warning: tagged union has more data members (4) than tags (3) | ||
| struct TaggedUnionStructWithInlineTagAndInlineUnion { | ||
| enum { | ||
| TaggedUnion8tag1, | ||
| TaggedUnion8tag2, | ||
| TaggedUnion8tag3, | ||
| } Tag; | ||
| union { | ||
| int *Ints; | ||
| char Characters[13]; | ||
| struct { | ||
| double Re; | ||
| double Im; | ||
| } Complex; | ||
| long L; | ||
| } Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:8: warning: tagged union has more data members (4) than tags (3) | ||
| struct TaggedUnionStructNesting { | ||
| enum Tags3 Tag; | ||
| union { | ||
| float F; | ||
| int I; | ||
| long L; | ||
| // CHECK-MESSAGES: :[[@LINE+1]]:12: warning: tagged union has more data members (4) than tags (3) | ||
| struct innerdecl { | ||
| enum Tags3 Tag; | ||
| union Union4 Data; | ||
| } Inner; | ||
| } Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:8: warning: tagged union has more data members (4) than tags (3) | ||
| struct TaggedUnionStructWithTypedefedTagAndTypedefedUnion { | ||
| Tags3 Tag; | ||
| Union4 Data; | ||
| }; | ||
|
|
||
| #define DECLARE_TAGGED_UNION_STRUCT(Tag, Union, Name)\ | ||
| struct Name {\ | ||
| Tag Kind;\ | ||
| Union Data;\ | ||
| } | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:44: warning: tagged union has more data members (4) than tags (3) | ||
| DECLARE_TAGGED_UNION_STRUCT(Tags3, Union4, TaggedUnionStructFromMacro); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,309 @@ | ||
| // RUN: %check_clang_tidy %s bugprone-tagged-union-member-count %t | ||
|
|
||
| typedef enum Tags3 { | ||
| tags3_1, | ||
| tags3_2, | ||
| tags3_3, | ||
| } Tags3; | ||
|
|
||
| typedef enum Tags4 { | ||
| tags4_1, | ||
| tags4_2, | ||
| tags4_3, | ||
| tags4_4, | ||
| } Tags4; | ||
|
|
||
| enum class Classtags3 { | ||
| classtags3_1, | ||
| classtags3_2, | ||
| classtags3_3, | ||
| }; | ||
|
|
||
| enum class Typedtags3 : unsigned int { | ||
| typedtags3_1, | ||
| typedtags3_2, | ||
| typedtags3_3, | ||
| }; | ||
|
|
||
| typedef union Union3 { | ||
| short *Shorts; | ||
| int *Ints; | ||
| float *Floats; | ||
| } Union3; | ||
|
|
||
| typedef union Union4 { | ||
| short *Shorts; | ||
| double *Doubles; | ||
| int *Ints; | ||
| float *Floats; | ||
| } Union4; | ||
|
|
||
| // It is not obvious which enum is the tag for the union. | ||
| class MaybeTaggedUnion1 { // No warnings expected. | ||
| enum Tags3 TagA; | ||
| enum Tags4 TagB; | ||
| union Union4 Data; | ||
| }; | ||
|
|
||
| // It is not obvious which union does the tag belong to. | ||
| class MaybeTaggedUnion2 { // No warnings expected. | ||
| enum Tags3 Tag; | ||
| union Union3 DataB; | ||
| union Union3 DataA; | ||
| }; | ||
|
|
||
| // It is not obvious which union does the tag belong to. | ||
| class MaybeTaggedUnion3 { // No warnings expected. | ||
| enum Tags3 Tag; | ||
| union { | ||
| int I1; | ||
| int I2; | ||
| int I3; | ||
| }; | ||
| union { | ||
| float F1; | ||
| float F2; | ||
| float F3; | ||
| }; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:7: warning: tagged union has more data members (4) than tags (3) | ||
| class TaggedUnionClassPredefinedTagAndPredefinedUnion { | ||
| enum Tags3 Tag; | ||
| union Union4 Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:7: warning: tagged union has more data members (4) than tags (3) | ||
| class TaggedUnionClassPredefinedTagAndInlineUnion { | ||
| enum Tags3 Tag; | ||
| union { | ||
| int *Ints; | ||
| char Characters[13]; | ||
| class { | ||
| double Re; | ||
| double Im; | ||
| } Complex; | ||
| long L; | ||
| } Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:7: warning: tagged union has more data members (4) than tags (3) | ||
| class TaggedUnionClassInlineTagAndPredefinedUnion { | ||
| enum { | ||
| tag1, | ||
| tag2, | ||
| tag3, | ||
| } Tag; | ||
| union Union4 Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:7: warning: tagged union has more data members (4) than tags (3) | ||
| class TaggedUnionClassInlineTagAndInlineUnion { | ||
| enum { | ||
| tag1, | ||
| tag2, | ||
| tag3, | ||
| } Tag; | ||
| union { | ||
| int *Ints; | ||
| char Characters[13]; | ||
| class { | ||
| double Re; | ||
| double Im; | ||
| } Complex; | ||
| long L; | ||
| } Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:7: warning: tagged union has more data members (4) than tags (3) | ||
| class TaggedUnionClassWithNestedTaggedUnionClass { | ||
| enum Tags3 Tag; | ||
| union { | ||
| float F; | ||
| int I; | ||
| long L; | ||
| // CHECK-MESSAGES: :[[@LINE+1]]:11: warning: tagged union has more data members (4) than tags (3) | ||
| class Innerdecl { | ||
| enum Tags3 Tag; | ||
| union Union4 Data; | ||
| } Inner; | ||
| } Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:7: warning: tagged union has more data members (4) than tags (3) | ||
| class TaggedUnionClassWithTypedefedTag { | ||
| Tags3 Tag; | ||
| Union4 Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:8: warning: tagged union has more data members (4) than tags (3) | ||
| struct TaggedUnionStructWithEnumClass { | ||
| enum Classtags3 Tag; | ||
| Union4 Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:7: warning: tagged union has more data members (4) than tags (3) | ||
| class TaggedUnionClasswithEnumClass { | ||
| enum Classtags3 Tag; | ||
| Union4 Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:8: warning: tagged union has more data members (4) than tags (3) | ||
| struct TaggedUnionStructWithTypedEnum { | ||
| Typedtags3 Tag; | ||
| Union4 Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:7: warning: tagged union has more data members (4) than tags (3) | ||
| class TaggedUnionClassWithTypedEnum { | ||
| Typedtags3 Tag; | ||
| Union4 Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:8: warning: tagged union has more data members (4) than tags (3) | ||
| struct AnonymousTaggedUnionStruct { | ||
| Tags3 Tag; | ||
| union { | ||
| char A; | ||
| short B; | ||
| int C; | ||
| long D; | ||
| }; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:7: warning: tagged union has more data members (4) than tags (3) | ||
| class TaggedUnionClassWithAnonymousUnion { | ||
| Tags3 Tag; | ||
| union { | ||
| char A; | ||
| short B; | ||
| int C; | ||
| long D; | ||
| }; | ||
| }; | ||
|
|
||
| namespace testnamespace { | ||
|
|
||
| enum Tags3 { | ||
| tags3_1, | ||
| tags3_2, | ||
| tags3_3, | ||
| }; | ||
|
|
||
| union Union4 { | ||
| short *Shorts; | ||
| double *Doubles; | ||
| int *Ints; | ||
| float *Floats; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:8: warning: tagged union has more data members (4) than tags (3) | ||
| struct TaggedUnionStructInNamespace { | ||
| Tags3 Tags; | ||
| Union4 Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:7: warning: tagged union has more data members (4) than tags (3) | ||
| class TaggedUnionClassInNamespace { | ||
| Tags3 Tags; | ||
| Union4 Data; | ||
| }; | ||
|
|
||
| } // namespace testnamespace | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:8: warning: tagged union has more data members (4) than tags (3) | ||
| struct TaggedUnionStructWithNamespacedTagAndUnion { | ||
| testnamespace::Tags3 Tags; | ||
| testnamespace::Union4 Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:7: warning: tagged union has more data members (4) than tags (3) | ||
| class TaggedUnionClassWithNamespacedTagAndUnion { | ||
| testnamespace::Tags3 Tags; | ||
| testnamespace::Union4 Data; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+2]]:8: warning: tagged union has more data members (4) than tags (3) | ||
| template <typename Tag, typename Union> | ||
| struct TemplatedStructWithNamespacedTagAndUnion { | ||
| Tag Kind; | ||
| Union Data; | ||
| }; | ||
|
|
||
| TemplatedStructWithNamespacedTagAndUnion<testnamespace::Union4, testnamespace::Tags3> TemplatedStruct3; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+2]]:7: warning: tagged union has more data members (4) than tags (3) | ||
| template <typename Tag, typename Union> | ||
| class TemplatedClassWithNamespacedTagAndUnion { | ||
| Tag Kind; | ||
| Union Data; | ||
| }; | ||
|
|
||
| TemplatedClassWithNamespacedTagAndUnion<testnamespace::Union4, testnamespace::Tags3> TemplatedClass3; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+2]]:8: warning: tagged union has more data members (4) than tags (3) | ||
| template <typename Tag, typename Union> | ||
| struct TemplatedStruct { | ||
| Tag Kind; | ||
| Union Data; | ||
| }; | ||
|
|
||
| TemplatedStruct<Tags3, Union3> TemplatedStruct1; // No warning expected | ||
| TemplatedStruct<Tags3, Union4> TemplatedStruct2; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+2]]:7: warning: tagged union has more data members (4) than tags (3) | ||
| template <typename Tag, typename Union> | ||
| class TemplatedClass { | ||
| Tag Kind; | ||
| Union Data; | ||
| }; | ||
|
|
||
| TemplatedClass<Tags3, Union3> TemplatedClass1; // No warning expected | ||
| TemplatedClass<Tags3, Union4> TemplatedClass2; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+2]]:8: warning: tagged union has more data members (4) than tags (3) | ||
| template <typename T> | ||
| struct TemplatedStructButTaggedUnionPartIsNotTemplated { | ||
| Tags3 Kind; | ||
| Union4 Data; | ||
| T SomethingElse; | ||
| }; | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+2]]:7: warning: tagged union has more data members (4) than tags (3) | ||
| template <typename T> | ||
| class TemplatedClassButTaggedUnionPartIsNotTemplated { | ||
| Tags3 Kind; | ||
| Union4 Data; | ||
| T SomethingElse; | ||
| }; | ||
|
|
||
| #define DECLARE_TAGGED_UNION_STRUCT(Tag, Union, Name)\ | ||
| struct Name {\ | ||
| Tag Kind;\ | ||
| Union Data;\ | ||
| } | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:44: warning: tagged union has more data members (4) than tags (3) | ||
| DECLARE_TAGGED_UNION_STRUCT(Tags3, Union4, TaggedUnionStructFromMacro); | ||
|
|
||
| #define DECLARE_TAGGED_UNION_CLASS(Tag, Union, Name)\ | ||
| class Name {\ | ||
| Tag Kind;\ | ||
| Union Data;\ | ||
| } | ||
|
|
||
| // CHECK-MESSAGES: :[[@LINE+1]]:43: warning: tagged union has more data members (4) than tags (3) | ||
| DECLARE_TAGGED_UNION_CLASS(Tags3, Union4, TaggedUnionClassFromMacro); | ||
|
|
||
| // Lambdas implicitly compile down to an unnamed CXXRecordDecl and if they have captures, | ||
| // then those become unnamed fields. | ||
| void DoNotMatchLambdas() { | ||
| enum { | ||
| A | ||
| } e; | ||
| union { | ||
| long A; | ||
| char B; | ||
| } u; | ||
| auto L = [e, u] () {}; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| # This file is for the llvm+clang options that are specific to building | ||
| # a cross-toolchain targeting hexagon linux. | ||
| set(DEFAULT_SYSROOT "../target/hexagon-unknown-linux-musl/" CACHE STRING "") | ||
| set(CLANG_LINKS_TO_CREATE | ||
| hexagon-linux-musl-clang++ | ||
| hexagon-linux-musl-clang | ||
| hexagon-unknown-linux-musl-clang++ | ||
| hexagon-unknown-linux-musl-clang | ||
| hexagon-none-elf-clang++ | ||
| hexagon-none-elf-clang | ||
| hexagon-unknown-none-elf-clang++ | ||
| hexagon-unknown-none-elf-clang | ||
| CACHE STRING "") | ||
|
|
||
| set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "") |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
|
|
||
| set(LLVM_TARGETS_TO_BUILD "Hexagon" CACHE STRING "") | ||
| set(LLVM_DEFAULT_TARGET_TRIPLE "hexagon-unknown-linux-musl" CACHE STRING "") | ||
| set(CLANG_DEFAULT_CXX_STDLIB "libc++" CACHE STRING "") | ||
| set(CLANG_DEFAULT_OBJCOPY "llvm-objcopy" CACHE STRING "") | ||
| set(CLANG_DEFAULT_RTLIB "compiler-rt" CACHE STRING "") | ||
| set(CLANG_DEFAULT_UNWINDLIB "libunwind" CACHE STRING "") | ||
| set(CLANG_DEFAULT_LINKER "lld" CACHE STRING "") | ||
| set(LLVM_ENABLE_PROJECTS "clang;lld" CACHE STRING "") | ||
|
|
||
| set(LLVM_INCLUDE_TESTS OFF CACHE BOOL "") | ||
| set(LLVM_INCLUDE_DOCS OFF CACHE BOOL "") | ||
| # Enabling toolchain-only causes problems when doing some of the | ||
| # subsequent builds, will need to investigate: | ||
| set(LLVM_INSTALL_TOOLCHAIN_ONLY OFF CACHE BOOL "") |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| .. include:: ../Maintainers.rst |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -104,7 +104,7 @@ Design Documents | |
| .. toctree:: | ||
| :maxdepth: 1 | ||
|
|
||
| Maintainers | ||
| InternalsManual | ||
| DriverInternals | ||
| Multilib | ||
|
|
||