1 // RUN: %clang_analyze_cc1 -analyzer-checker=webkit.NoUncountedMemberChecker -verify %s
2 
3 #include "mock-types.h"
4 
5 namespace members {
6   struct Foo {
7   private:
8     RefCountable* a = nullptr;
9 // expected-warning@-1{{Member variable 'a' in 'members::Foo' is a raw pointer to ref-countable type 'RefCountable'}}
10 
11   protected:
12     RefPtr<RefCountable> b;
13 
14   public:
15     RefCountable silenceWarningAboutInit;
16     RefCountable& c = silenceWarningAboutInit;
17 // expected-warning@-1{{Member variable 'c' in 'members::Foo' is a reference to ref-countable type 'RefCountable'}}
18     Ref<RefCountable> d;
19   };
20 
21   template<class T>
22   struct FooTmpl {
23     T* a;
24 // expected-warning@-1{{Member variable 'a' in 'members::FooTmpl<RefCountable>' is a raw pointer to ref-countable type 'RefCountable'}}
25   };
26 
27   void forceTmplToInstantiate(FooTmpl<RefCountable>) {}
28 }
29 
30 namespace ignore_unions {
31   union Foo {
32     RefCountable* a;
33     RefPtr<RefCountable> b;
34     Ref<RefCountable> c;
35   };
36 
37   template<class T>
38   union RefPtr {
39     T* a;
40   };
41 
42   void forceTmplToInstantiate(RefPtr<RefCountable>) {}
43 }
44