@@ -29,28 +29,87 @@ private newtype TFunctionInput =
29
29
class FunctionInput extends TFunctionInput {
30
30
abstract string toString ( ) ;
31
31
32
+ /**
33
+ * Holds if this is the input value of the parameter with index `index`.
34
+ * Example:
35
+ * ```
36
+ * void func(int n, char* p, float& r);
37
+ * ```
38
+ * `isParameter(0)` holds for the `FunctionInput` that represents the value of `n` (with type
39
+ * `int`) on entry to the function.
40
+ * `isParameter(1)` holds for the `FunctionInput` that represents the value of `p` (with type
41
+ * `char*`) on entry to the function.
42
+ * `isParameter(2)` holds for the `FunctionInput` that represents the "value" of the reference `r`
43
+ * (with type `float&`) on entry to the function, _not_ the value of the referred-to `float`.
44
+ */
32
45
predicate isParameter ( ParameterIndex index ) { none ( ) }
33
46
47
+ /**
48
+ * Holds if this is the input value of the parameter with index `index`.
49
+ * DEPRECATED: Use `isParameter(index)` instead.
50
+ */
51
+ deprecated final predicate isInParameter ( ParameterIndex index ) { isParameter ( index ) }
52
+
53
+ /**
54
+ * Holds if this is the input value pointed to by a pointer parameter to a function, or the input
55
+ * value referred to by a reference parameter to a function, where the parameter has index
56
+ * `index`.
57
+ * Example:
58
+ * ```
59
+ * void func(int n, char* p, float& r);
60
+ * ```
61
+ * `isParameterDeref(1)` holds for the `FunctionInput` that represents the value of `*p` (with
62
+ * type `char`) on entry to the function.
63
+ * `isParameterDeref(2)` holds for the `FunctionInput` that represents the value of `r` (with type
64
+ * `float`) on entry to the function.
65
+ * There is no `FunctionInput` for which `isParameterDeref(0)` holds, because `n` is neither a
66
+ * pointer nor a reference.
67
+ */
34
68
predicate isParameterDeref ( ParameterIndex index ) { none ( ) }
35
69
70
+ /**
71
+ * Holds if this is the input value pointed to by a pointer parameter to a function, or the input
72
+ * value referred to by a reference parameter to a function, where the parameter has index
73
+ * `index`.
74
+ * DEPRECATED: Use `isParameterDeref(index)` instead.
75
+ */
76
+ deprecated final predicate isInParameterPointer ( ParameterIndex index ) { isParameterDeref ( index ) }
77
+
78
+ /**
79
+ * Holds if this is the input value pointed to by the `this` pointer of an instance member
80
+ * function.
81
+ * Example:
82
+ * ```
83
+ * struct C {
84
+ * void mfunc(int n, char* p, float& r) const;
85
+ * };
86
+ * ```
87
+ * `isQualifierObject()` holds for the `FunctionInput` that represents the value of `*this` (with
88
+ * type `C const`) on entry to the function.
89
+ */
36
90
predicate isQualifierObject ( ) { none ( ) }
37
91
92
+ /**
93
+ * Holds if this is the input value pointed to by the `this` pointer of an instance member
94
+ * function.
95
+ * DEPRECATED: Use `isQualifierObject()` instead.
96
+ */
97
+ deprecated final predicate isInQualifier ( ) { isQualifierObject ( ) }
98
+
99
+ /**
100
+ * Holds if this is the input value of the `this` pointer of an instance member function.
101
+ * Example:
102
+ * ```
103
+ * struct C {
104
+ * void mfunc(int n, char* p, float& r) const;
105
+ * };
106
+ * ```
107
+ * `isQualifierAddress()` holds for the `FunctionInput` that represents the value of `this` (with
108
+ * type `C const *`) on entry to the function.
109
+ */
38
110
predicate isQualifierAddress ( ) { none ( ) }
39
111
}
40
112
41
- /**
42
- * The input value of a parameter to a function.
43
- * Example:
44
- * ```cpp
45
- * void func(int n, char* p, float& r);
46
- * ```
47
- * The `InParameter` with `getIndex() = 0` represents the value of `n` (with type `int`) on entry to
48
- * the function.
49
- * The `InParameter` with `getIndex() = 1` represents the value of `p` (with type `char*`) on entry
50
- * to the function.
51
- * The `InParameter` with `getIndex() = 2` represents the "value" of the reference `r` (with type
52
- * `float&`) on entry to the function, _not_ the value of the referred-to `float`.
53
- */
54
113
class InParameter extends FunctionInput , TInParameter {
55
114
ParameterIndex index ;
56
115
@@ -64,20 +123,6 @@ class InParameter extends FunctionInput, TInParameter {
64
123
override predicate isParameter ( ParameterIndex i ) { i = index }
65
124
}
66
125
67
- /**
68
- * The input value pointed to by a pointer parameter to a function, or the input value referred to
69
- * by a reference parameter to a function.
70
- * Example:
71
- * ```cpp
72
- * void func(int n, char* p, float& r);
73
- * ```
74
- * The `InParameterDeref` with `getIndex() = 1` represents the value of `*p` (with type `char`) on
75
- * entry to the function.
76
- * The `InParameterDeref` with `getIndex() = 2` represents the value of `r` (with type `float`) on
77
- * entry to the function.
78
- * There is no `InParameterDeref` with `getIndex() = 0`, because `n` is neither a pointer nor a
79
- * reference.
80
- */
81
126
class InParameterDeref extends FunctionInput , TInParameterDeref {
82
127
ParameterIndex index ;
83
128
@@ -91,34 +136,12 @@ class InParameterDeref extends FunctionInput, TInParameterDeref {
91
136
override predicate isParameterDeref ( ParameterIndex i ) { i = index }
92
137
}
93
138
94
- /**
95
- * The input value pointed to by the `this` pointer of an instance member function.
96
- * Example:
97
- * ```cpp
98
- * struct C {
99
- * void mfunc(int n, char* p, float& r) const;
100
- * };
101
- * ```
102
- * The `InQualifierObject` represents the value of `*this` (with type `C const`) on entry to the
103
- * function.
104
- */
105
139
class InQualifierObject extends FunctionInput , TInQualifierObject {
106
140
override string toString ( ) { result = "InQualifierObject" }
107
141
108
142
override predicate isQualifierObject ( ) { any ( ) }
109
143
}
110
144
111
- /**
112
- * The input value of the `this` pointer of an instance member function.
113
- * Example:
114
- * ```cpp
115
- * struct C {
116
- * void mfunc(int n, char* p, float& r) const;
117
- * };
118
- * ```
119
- * The `InQualifierAddress` represents the value of `this` (with type `C const *`) on entry to the
120
- * function.
121
- */
122
145
class InQualifierAddress extends FunctionInput , TInQualifierAddress {
123
146
override string toString ( ) { result = "InQualifierAddress" }
124
147
@@ -142,29 +165,104 @@ private newtype TFunctionOutput =
142
165
class FunctionOutput extends TFunctionOutput {
143
166
abstract string toString ( ) ;
144
167
168
+ /**
169
+ * Holds if this is the output value pointed to by a pointer parameter to a function, or the
170
+ * output value referred to by a reference parameter to a function, where the parameter has
171
+ * index `index`.
172
+ * Example:
173
+ * ```
174
+ * void func(int n, char* p, float& r);
175
+ * ```
176
+ * `isParameterDeref(1)` holds for the `FunctionOutput` that represents the value of `*p` (with
177
+ * type `char`) on return from the function.
178
+ * `isParameterDeref(2)` holds for the `FunctionOutput` that represents the value of `r` (with
179
+ * type `float`) on return from the function.
180
+ * There is no `FunctionOutput` for which `isParameterDeref(0)` holds, because `n` is neither a
181
+ * pointer nor a reference.
182
+ */
145
183
predicate isParameterDeref ( ParameterIndex i ) { none ( ) }
146
184
185
+ /**
186
+ * Holds if this is the output value pointed to by a pointer parameter to a function, or the
187
+ * output value referred to by a reference parameter to a function, where the parameter has
188
+ * index `index`.
189
+ * DEPRECATED: Use `isParameterDeref(index)` instead.
190
+ */
191
+ deprecated final predicate isOutParameterPointer ( ParameterIndex index ) { isParameterDeref ( index ) }
192
+
193
+ /**
194
+ * Holds if this is the output value pointed to by the `this` pointer of an instance member
195
+ * function.
196
+ * ```
197
+ * struct C {
198
+ * void mfunc(int n, char* p, float& r);
199
+ * };
200
+ * ```
201
+ * `isQualifierObject()` holds for the `FunctionOutput` that represents the value of `*this` (with
202
+ * type `C`) on return from the function.
203
+ */
147
204
predicate isQualifierObject ( ) { none ( ) }
148
205
206
+ /**
207
+ * Holds if this is the output value pointed to by the `this` pointer of an instance member
208
+ * function.
209
+ * DEPRECATED: Use `isQualifierObject()` instead.
210
+ */
211
+ deprecated final predicate isOutQualifier ( ) { isQualifierObject ( ) }
212
+
213
+ /**
214
+ * Holds if this is the value returned by a function.
215
+ * Example:
216
+ * ```
217
+ * int getInt();
218
+ * char* getPointer();
219
+ * float& getReference();
220
+ * ```
221
+ * `isReturnValue()` holds for the `FunctionOutput` that represents the value returned by
222
+ * `getInt()` (with type `int`).
223
+ * `isReturnValue()` holds for the `FunctionOutput` that represents the value returned by
224
+ * `getPointer()` (with type `char*`).
225
+ * `isReturnValue()` holds for the `FunctionOutput` that represents the "value" of the reference
226
+ * returned by `getReference()` (with type `float&`), _not_ the value of the referred-to
227
+ * `float`.
228
+ */
149
229
predicate isReturnValue ( ) { none ( ) }
150
230
231
+ /**
232
+ * Holds if this is the value returned by a function.
233
+ * DEPRECATED: Use `isReturnValue()` instead.
234
+ */
235
+ deprecated final predicate isOutReturnValue ( ) { isReturnValue ( ) }
236
+
237
+ /**
238
+ * Holds if this is the output value pointed to by the return value of a function, if the function
239
+ * returns a pointer, or the output value referred to by the return value of a function, if the
240
+ * function returns a reference.
241
+ * Example:
242
+ * ```
243
+ * char* getPointer();
244
+ * float& getReference();
245
+ * int getInt();
246
+ * ```
247
+ * `isReturnValueDeref()` holds for the `FunctionOutput` that represents the value of
248
+ * `*getPointer()` (with type `char`).
249
+ * `isReturnValueDeref()` holds for the `FunctionOutput` that represents the value of
250
+ * `getReference()` (with type `float`).
251
+ * There is no `FunctionOutput` of `getInt()` for which `isReturnValueDeref()` holds because the
252
+ * return type of `getInt()` is neither a pointer nor a reference.
253
+ */
151
254
predicate isReturnValueDeref ( ) { none ( ) }
255
+
256
+ /*
257
+ * Holds if this is the output value pointed to by the return value of a function, if the function
258
+ * returns a pointer, or the output value referred to by the return value of a function, if the
259
+ * function returns a reference.
260
+ * DEPRECATED: Use `isReturnValueDeref()` instead.
261
+ */
262
+
263
+ deprecated final predicate isOutReturnPointer ( ) { isReturnValueDeref ( ) }
152
264
}
153
265
154
- /**
155
- * The output value pointed to by a pointer parameter to a function, or the output value referred to
156
- * by a reference parameter to a function.
157
- * Example:
158
- * ```cpp
159
- * void func(int n, char* p, float& r);
160
- * ```
161
- * The `OutParameterDeref` with `getIndex() = 1` represents the value of `*p` (with type `char`) on
162
- * return from the function.
163
- * The `OutParameterDeref` with `getIndex() = 2` represents the value of `r` (with type `float`) on
164
- * return from the function.
165
- * There is no `OutParameterDeref` with `getIndex() = 0`, because `n` is neither a pointer nor a
166
- * reference.
167
- */
168
266
class OutParameterDeref extends FunctionOutput , TOutParameterDeref {
169
267
ParameterIndex index ;
170
268
@@ -177,61 +275,18 @@ class OutParameterDeref extends FunctionOutput, TOutParameterDeref {
177
275
override predicate isParameterDeref ( ParameterIndex i ) { i = index }
178
276
}
179
277
180
- /**
181
- * The output value pointed to by the `this` pointer of an instance member function.
182
- * Example:
183
- * ```cpp
184
- * struct C {
185
- * void mfunc(int n, char* p, float& r);
186
- * };
187
- * ```
188
- * The `OutQualifierObject` represents the value of `*this` (with type `C`) on return from the
189
- * function.
190
- */
191
278
class OutQualifierObject extends FunctionOutput , TOutQualifierObject {
192
279
override string toString ( ) { result = "OutQualifier" }
193
280
194
281
override predicate isQualifierObject ( ) { any ( ) }
195
282
}
196
283
197
- /**
198
- * The value returned by a function.
199
- * Example:
200
- * ```cpp
201
- * int getInt();
202
- * char* getPointer();
203
- * float& getReference();
204
- * ```
205
- * The `OutReturnValue` for `getInt()` represents the value returned by `getInt()` (with type
206
- * `int`).
207
- * The `OutReturnValue` for `getPointer()` represents the value returned by `getPointer()` (with
208
- * type `char*`).
209
- * The `OutReturnValue` for `getReference()` represents the "value" of the reference returned by
210
- * `getReference()` (with type `float&`), _not_ the value of the referred-to `float`.
211
- */
212
284
class OutReturnValue extends FunctionOutput , TOutReturnValue {
213
285
override string toString ( ) { result = "OutReturnValue" }
214
286
215
287
override predicate isReturnValue ( ) { any ( ) }
216
288
}
217
289
218
- /**
219
- * The output value pointed to by the return value of a function, if the function returns a pointer,
220
- * or the output value referred to by the return value of a function, if the function returns a
221
- * reference.
222
- * Example:
223
- * ```cpp
224
- * char* getPointer();
225
- * float& getReference();
226
- * int getInt();
227
- * ```
228
- * The `OutReturnValueDeref` for `getPointer()` represents the value of `*getPointer()` (with type
229
- * `char`).
230
- * The `OutReturnValueDeref` for `getReference()` represents the value of `getReference()` (with
231
- * type `float`).
232
- * There is no `OutReturnValueDeref` for `getInt()`, because the return type of `getInt()` is
233
- * neither a pointer nor a reference.
234
- */
235
290
class OutReturnValueDeref extends FunctionOutput , TOutReturnValueDeref {
236
291
override string toString ( ) { result = "OutReturnValueDeref" }
237
292
0 commit comments