Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Analysis / Checkers / WebKit / uncounted-members.cpp
bloba0ea61e0e2a13b19b59415bc2a75212f1c36ce60
1 // RUN: %clang_analyze_cc1 -analyzer-checker=webkit.NoUncountedMemberChecker -verify %s
3 #include "mock-types.h"
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'}}
11 protected:
12 RefPtr<RefCountable> b;
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;
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'}}
27 void forceTmplToInstantiate(FooTmpl<RefCountable>) {}
30 namespace ignore_unions {
31 union Foo {
32 RefCountable* a;
33 RefPtr<RefCountable> b;
34 Ref<RefCountable> c;
37 template<class T>
38 union RefPtr {
39 T* a;
42 void forceTmplToInstantiate(RefPtr<RefCountable>) {}