1 // RUN: %clang_analyze_cc1 -analyzer-checker=core,optin.cplusplus.UninitializedObject \
2 // RUN: -analyzer-config optin.cplusplus.UninitializedObject:Pedantic=true -DPEDANTIC \
3 // RUN: -analyzer-config optin.cplusplus.UninitializedObject:IgnoreRecordsWithField="[Tt]ag|[Kk]ind" \
4 // RUN: -std=c++11 -verify %s
6 // RUN: not %clang_analyze_cc1 -verify %s \
7 // RUN: -analyzer-checker=core \
8 // RUN: -analyzer-checker=optin.cplusplus.UninitializedObject \
9 // RUN: -analyzer-config \
10 // RUN: optin.cplusplus.UninitializedObject:IgnoreRecordsWithField="([)]" \
11 // RUN: 2>&1 | FileCheck %s -check-prefix=CHECK-UNINIT-INVALID-REGEX
13 // CHECK-UNINIT-INVALID-REGEX: (frontend): invalid input for checker option
14 // CHECK-UNINIT-INVALID-REGEX-SAME: 'optin.cplusplus.UninitializedObject:IgnoreRecordsWithField',
15 // CHECK-UNINIT-INVALID-REGEX-SAME: that expects a valid regex, building failed
16 // CHECK-UNINIT-INVALID-REGEX-SAME: with error message "parentheses not
17 // CHECK-UNINIT-INVALID-REGEX-SAME: balanced"
20 // expected-no-diagnostics
22 // Both type and name contains "kind".
23 struct UnionLikeStruct1
{
32 UnionLikeStruct1(Kind kind
, int Val
) : kind(kind
) {
44 void fUnionLikeStruct1() {
45 UnionLikeStruct1
t(UnionLikeStruct1::volume
, 10);
48 // Only name contains "kind".
49 struct UnionLikeStruct2
{
58 UnionLikeStruct2(Type kind
, int Val
) : kind(kind
) {
70 void fUnionLikeStruct2() {
71 UnionLikeStruct2
t(UnionLikeStruct2::volume
, 10);
74 // Only type contains "kind".
75 struct UnionLikeStruct3
{
84 UnionLikeStruct3(Kind type
, int Val
) : type(type
) {
96 void fUnionLikeStruct3() {
97 UnionLikeStruct3
t(UnionLikeStruct3::volume
, 10);
100 // Only type contains "tag".
101 struct UnionLikeStruct4
{
110 UnionLikeStruct4(Tag type
, int Val
) : type(type
) {
122 void fUnionLikeStruct4() {
123 UnionLikeStruct4
t(UnionLikeStruct4::volume
, 10);
126 // Both name and type name contains but does not equal to tag/kind.
127 struct UnionLikeStruct5
{
128 enum WhateverTagBlahBlah
{
136 UnionLikeStruct5(WhateverTagBlahBlah type
, int Val
) : FunnyKindName(type
) {
137 switch (FunnyKindName
) {
148 void fUnionLikeStruct5() {
149 UnionLikeStruct5
t(UnionLikeStruct5::volume
, 10);