Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Analysis / Checkers / WebKit / ref-cntbl-base-virtual-dtor.cpp
blob1fc59c108b0e831b493e2f0e305b88d5546f9345
1 // RUN: %clang_analyze_cc1 -analyzer-checker=webkit.RefCntblBaseVirtualDtor -verify %s
3 struct RefCntblBase {
4 void ref() {}
5 void deref() {}
6 };
8 struct Derived : RefCntblBase { };
9 // expected-warning@-1{{Struct 'RefCntblBase' is used as a base of struct 'Derived' but doesn't have virtual destructor}}
11 struct DerivedWithVirtualDtor : RefCntblBase {
12 // expected-warning@-1{{Struct 'RefCntblBase' is used as a base of struct 'DerivedWithVirtualDtor' but doesn't have virtual destructor}}
13 virtual ~DerivedWithVirtualDtor() {}
18 template<class T>
19 struct DerivedClassTmpl : T { };
20 typedef DerivedClassTmpl<RefCntblBase> Foo;
24 struct RandomBase {};
25 struct RandomDerivedClass : RandomBase { };
29 struct FakeRefCntblBase1 {
30 private:
31 void ref() {}
32 void deref() {}
34 struct Quiet1 : FakeRefCntblBase1 {};
36 struct FakeRefCntblBase2 {
37 protected:
38 void ref() {}
39 void deref() {}
41 struct Quiet2 : FakeRefCntblBase2 {};
43 class FakeRefCntblBase3 {
44 void ref() {}
45 void deref() {}
47 struct Quiet3 : FakeRefCntblBase3 {};
48 struct Quiet4 : private RefCntblBase {};
49 class Quiet5 : RefCntblBase {};
51 void foo () {
52 Derived d;