xref: /llvm-project/clang/test/Analysis/Checkers/WebKit/member-function-pointer-crash.cpp (revision 93a2a8cb7f6ab815849e8320bff54c965edd09e7)
1 // RUN: %clang_analyze_cc1 -analyzer-checker=alpha.webkit.UncountedLocalVarsChecker -verify %s
2 
3 #include "mock-types.h"
4 
5 class RenderStyle;
6 
7 class FillLayer {
8 public:
9     void ref() const;
10     void deref() const;
11 };
12 
13 class FillLayersPropertyWrapper {
14 public:
15     typedef const FillLayer& (RenderStyle::*LayersGetter)() const;
16 
17 private:
canInterpolate(const RenderStyle & from) const18     bool canInterpolate(const RenderStyle& from) const
19     {
20         auto* fromLayer = &(from.*m_layersGetter)();
21         // expected-warning@-1{{Local variable 'fromLayer' is uncounted and unsafe}}
22         return true;
23     }
24 
25     LayersGetter m_layersGetter;
26 };
27