summaryrefslogtreecommitdiff
path: root/test/test43.cpp
blob: bce27ebe509343ce95ad783ad6f9ff6cb588da11 (plain) (blame)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
struct Data1;
struct Data2;

Data2 *d1 __attribute__((nonnullpointer));

struct Data2
{
    Data2() :
        val(d1->val)
    {
    }
    int val;
    Data1 *ptrval;
    int arr[3];
    Data1 *getData3()
    {
        return ptrval;
    }
};

struct Data1
{
    int val;
    Data1 *ptrval;
    Data2 perm;
    int arr[3];
    virtual ~Data1();

    Data1 *getData2()
    {
        return ptrval;
    }

    virtual Data1 *getData3(int &k)
    {
        val = k;
        return ptrval;
    }
    static Data1 *getData4()
    {
        return 0;
    }
    Data2 *getData5() __attribute__((returns_nonnull))
    {
        return &perm;
    }
    virtual Data1 *getData6()
    {
        return 0;
    }
};

int k;

Data1 *gptr1;
Data1 *gptr2 __attribute__((nonnullpointer));

void paranuckerInternalTest(const char *action, const char *collection, const char *values);

class Object1
{
    Data1 *tmp1;
    Data1 *tmp2;
    Data1 *tmp3 __attribute__((nonnullpointer));
    int x;
    int y;
    static Data1 *garr1[10];

    Data1 *getData1()
    {
        return tmp2;
    }

    Data1 *getData2()
    {
        return tmp2;
    }

    Data1 *func1(Data1 *ptr1) const
    {
        return k ? tmp1 : tmp2;
    }

    Data1 *func2(Data1 *ptr1) const
    {
        return tmp1;
    }

    Data1 *func3(Data1 *ptr1) const
    {
        return &tmp1[1];
    }

    void func4(Data1 *ptr1)
    {
        x = tmp3->val;
        y = tmp3->arr[0];
    }

    void func5()
    {
        int idx = 5;
        Data1 *const ptr1 = garr1[idx];
        if (ptr1)
            ptr1->val = 100;
    }

    void func6(Data1 *ptr1)
    {
        Data1 var1;
        var1.ptrval = ptr1;
    }
};