aboutsummaryrefslogtreecommitdiff
path: root/clang/test/Analysis/Checkers/WebKit/uncounted-members-ref-deref-on-diff-classes.cpp
blob: 4198b2388fed8f5229c2b5d8953bfdc55a2814e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// RUN: %clang_analyze_cc1 -analyzer-checker=webkit.NoUncountedMemberChecker -verify %s

#include "mock-types.h"

class RefCountedBase {
public:
  void ref() const { }
};

template<typename T> class RefCounted : public RefCountedBase {
public:
  virtual ~RefCounted() { }
  void deref() const { }
};

class TreeNode : public RefCounted<TreeNode> {
public:
  void setParent(TreeNode& parent) { m_parent = &parent; }

private:
  TreeNode* m_parent;
// expected-warning@-1{{Member variable 'm_parent' in 'TreeNode' is a raw pointer to ref-countable type 'TreeNode'}}
};