Debian Codegraph @

clang/test/Analysis/Checkers/WebKit/uncounted-members-ref-deref-on-diff-classes.cpp

raw
1 // RUN: %clang_analyze_cc1 -analyzer-checker=webkit.NoUncountedMemberChecker -verify %s
2
3 #include "mock-types.h"
4
5 class RefCountedBase {
6 public:
7 void ref() const { }
8 };
9
10 template<typename T> class RefCounted : public RefCountedBase {
11 public:
12 virtual ~RefCounted() { }
13 void deref() const { }
14 };
15
16 class TreeNode : public RefCounted<TreeNode> {
17 public:
18 void setParent(TreeNode& parent) { m_parent = &parent; }
19
20 private:
21 TreeNode* m_parent;
22 // expected-warning@-1{{Member variable 'm_parent' in 'TreeNode' is a raw pointer to ref-countable type 'TreeNode'}}
23 };