aboutsummaryrefslogtreecommitdiff
path: root/clang/test/Analysis/Checkers/WebKit/member-function-pointer-crash.cpp
blob: 16d3b89b3ac4e74562ce81800c8de1eeaa4185f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// RUN: %clang_analyze_cc1 -analyzer-checker=alpha.webkit.UncountedLocalVarsChecker -verify %s

#include "mock-types.h"

class RenderStyle;

class FillLayer {
public:
    void ref() const;
    void deref() const;
};

class FillLayersPropertyWrapper {
public:
    typedef const FillLayer& (RenderStyle::*LayersGetter)() const;

private:
    bool canInterpolate(const RenderStyle& from) const
    {
        auto* fromLayer = &(from.*m_layersGetter)();
        // expected-warning@-1{{Local variable 'fromLayer' is uncounted and unsafe}}
        return true;
    }

    LayersGetter m_layersGetter;
};