• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_analyze_cc1 -analyzer-checker=webkit.RefCntblBaseVirtualDtor -verify %s
2 
3 struct RefCntblBase {
refRefCntblBase4   void ref() {}
derefRefCntblBase5   void deref() {}
6 };
7 
8 template<class T>
9 struct DerivedClassTmpl1 : T { };
10 // expected-warning@-1{{Struct 'RefCntblBase' is used as a base of struct 'DerivedClassTmpl1<RefCntblBase>' but doesn't have virtual destructor}}
11 
12 DerivedClassTmpl1<RefCntblBase> a;
13 
14 
15 
16 template<class T>
17 struct DerivedClassTmpl2 : T { };
18 // expected-warning@-1{{Struct 'RefCntblBase' is used as a base of struct 'DerivedClassTmpl2<RefCntblBase>' but doesn't have virtual destructor}}
19 
foo(T)20 template<class T> int foo(T) { DerivedClassTmpl2<T> f; return 42; }
21 int b = foo(RefCntblBase{});
22 
23 
24 
25 template<class T>
26 struct DerivedClassTmpl3 : T { };
27 // expected-warning@-1{{Struct 'RefCntblBase' is used as a base of struct 'DerivedClassTmpl3<RefCntblBase>' but doesn't have virtual destructor}}
28 
29 typedef DerivedClassTmpl3<RefCntblBase> Foo;
30 Foo c;
31