Skip to content

Commit c1e5db0

Browse files
C++ More PR feedback
1 parent 28aa7dc commit c1e5db0

File tree

1 file changed

+49
-40
lines changed

1 file changed

+49
-40
lines changed

cpp/ql/src/semmle/code/cpp/models/interfaces/FunctionInputsAndOutputs.qll

Lines changed: 49 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,18 @@ class FunctionInput extends TFunctionInput {
3131

3232
/**
3333
* Holds if this is the input value of the parameter with index `index`.
34+
*
3435
* Example:
3536
* ```
3637
* void func(int n, char* p, float& r);
3738
* ```
38-
* `isParameter(0)` holds for the `FunctionInput` that represents the value of `n` (with type
39+
* - `isParameter(0)` holds for the `FunctionInput` that represents the value of `n` (with type
3940
* `int`) on entry to the function.
40-
* `isParameter(1)` holds for the `FunctionInput` that represents the value of `p` (with type
41+
* - `isParameter(1)` holds for the `FunctionInput` that represents the value of `p` (with type
4142
* `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`.
43+
* - `isParameter(2)` holds for the `FunctionInput` that represents the "value" of the reference
44+
* `r` (with type `float&`) on entry to the function, _not_ the value of the referred-to
45+
* `float`.
4446
*/
4547
predicate isParameter(ParameterIndex index) { none() }
4648

@@ -52,60 +54,63 @@ class FunctionInput extends TFunctionInput {
5254

5355
/**
5456
* 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+
* value referred to by a reference parameter to a function, where the parameter has index
58+
* `index`.
59+
*
5760
* Example:
5861
* ```
5962
* void func(int n, char* p, float& r);
6063
* ```
61-
* `isParameterDeref(1)` holds for the `FunctionInput` that represents the value of `*p` (with
64+
* - `isParameterDeref(1)` holds for the `FunctionInput` that represents the value of `*p` (with
6265
* type `char`) on entry to the function.
63-
* `isParameterDeref(2)` holds for the `FunctionInput` that represents the value of `r` (with type
66+
* - `isParameterDeref(2)` holds for the `FunctionInput` that represents the value of `r` (with type
6467
* `float`) on entry to the function.
65-
* There is no `FunctionInput` for which `isParameterDeref(0)` holds, because `n` is neither a
68+
* - There is no `FunctionInput` for which `isParameterDeref(0)` holds, because `n` is neither a
6669
* pointer nor a reference.
6770
*/
6871
predicate isParameterDeref(ParameterIndex index) { none() }
6972

7073
/**
7174
* 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`.
75+
* value referred to by a reference parameter to a function, where the parameter has index
76+
* `index`.
7477
* DEPRECATED: Use `isParameterDeref(index)` instead.
7578
*/
7679
deprecated final predicate isInParameterPointer(ParameterIndex index) { isParameterDeref(index) }
7780

7881
/**
7982
* Holds if this is the input value pointed to by the `this` pointer of an instance member
80-
* function.
83+
* function.
84+
*
8185
* Example:
8286
* ```
8387
* struct C {
8488
* void mfunc(int n, char* p, float& r) const;
8589
* };
8690
* ```
87-
* `isQualifierObject()` holds for the `FunctionInput` that represents the value of `*this` (with
88-
* type `C const`) on entry to the function.
91+
* - `isQualifierObject()` holds for the `FunctionInput` that represents the value of `*this`
92+
* (with type `C const`) on entry to the function.
8993
*/
9094
predicate isQualifierObject() { none() }
9195

9296
/**
9397
* Holds if this is the input value pointed to by the `this` pointer of an instance member
94-
* function.
98+
* function.
9599
* DEPRECATED: Use `isQualifierObject()` instead.
96100
*/
97101
deprecated final predicate isInQualifier() { isQualifierObject() }
98102

99103
/**
100104
* Holds if this is the input value of the `this` pointer of an instance member function.
105+
*
101106
* Example:
102107
* ```
103108
* struct C {
104109
* void mfunc(int n, char* p, float& r) const;
105110
* };
106111
* ```
107-
* `isQualifierAddress()` holds for the `FunctionInput` that represents the value of `this` (with
108-
* type `C const *`) on entry to the function.
112+
* - `isQualifierAddress()` holds for the `FunctionInput` that represents the value of `this`
113+
* (with type `C const *`) on entry to the function.
109114
*/
110115
predicate isQualifierAddress() { none() }
111116
}
@@ -167,62 +172,66 @@ class FunctionOutput extends TFunctionOutput {
167172

168173
/**
169174
* 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`.
175+
* output value referred to by a reference parameter to a function, where the parameter has
176+
* index `index`.
177+
*
172178
* Example:
173179
* ```
174180
* void func(int n, char* p, float& r);
175181
* ```
176-
* `isParameterDeref(1)` holds for the `FunctionOutput` that represents the value of `*p` (with
182+
* - `isParameterDeref(1)` holds for the `FunctionOutput` that represents the value of `*p` (with
177183
* type `char`) on return from the function.
178-
* `isParameterDeref(2)` holds for the `FunctionOutput` that represents the value of `r` (with
184+
* - `isParameterDeref(2)` holds for the `FunctionOutput` that represents the value of `r` (with
179185
* type `float`) on return from the function.
180-
* There is no `FunctionOutput` for which `isParameterDeref(0)` holds, because `n` is neither a
186+
* - There is no `FunctionOutput` for which `isParameterDeref(0)` holds, because `n` is neither a
181187
* pointer nor a reference.
182188
*/
183189
predicate isParameterDeref(ParameterIndex i) { none() }
184190

185191
/**
186192
* 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`.
193+
* output value referred to by a reference parameter to a function, where the parameter has
194+
* index `index`.
189195
* DEPRECATED: Use `isParameterDeref(index)` instead.
190196
*/
191197
deprecated final predicate isOutParameterPointer(ParameterIndex index) { isParameterDeref(index) }
192198

193199
/**
194200
* Holds if this is the output value pointed to by the `this` pointer of an instance member
195201
* function.
202+
*
203+
* Example:
196204
* ```
197205
* struct C {
198206
* void mfunc(int n, char* p, float& r);
199207
* };
200208
* ```
201-
* `isQualifierObject()` holds for the `FunctionOutput` that represents the value of `*this` (with
202-
* type `C`) on return from the function.
209+
* - `isQualifierObject()` holds for the `FunctionOutput` that represents the value of `*this`
210+
* (with type `C`) on return from the function.
203211
*/
204212
predicate isQualifierObject() { none() }
205213

206214
/**
207215
* Holds if this is the output value pointed to by the `this` pointer of an instance member
208-
* function.
216+
* function.
209217
* DEPRECATED: Use `isQualifierObject()` instead.
210218
*/
211219
deprecated final predicate isOutQualifier() { isQualifierObject() }
212220

213221
/**
214222
* Holds if this is the value returned by a function.
223+
*
215224
* Example:
216225
* ```
217226
* int getInt();
218227
* char* getPointer();
219228
* float& getReference();
220229
* ```
221-
* `isReturnValue()` holds for the `FunctionOutput` that represents the value returned by
230+
* - `isReturnValue()` holds for the `FunctionOutput` that represents the value returned by
222231
* `getInt()` (with type `int`).
223-
* `isReturnValue()` holds for the `FunctionOutput` that represents the value returned by
232+
* - `isReturnValue()` holds for the `FunctionOutput` that represents the value returned by
224233
* `getPointer()` (with type `char*`).
225-
* `isReturnValue()` holds for the `FunctionOutput` that represents the "value" of the reference
234+
* - `isReturnValue()` holds for the `FunctionOutput` that represents the "value" of the reference
226235
* returned by `getReference()` (with type `float&`), _not_ the value of the referred-to
227236
* `float`.
228237
*/
@@ -236,30 +245,30 @@ class FunctionOutput extends TFunctionOutput {
236245

237246
/**
238247
* 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.
248+
* returns a pointer, or the output value referred to by the return value of a function, if the
249+
* function returns a reference.
250+
*
241251
* Example:
242252
* ```
243253
* char* getPointer();
244254
* float& getReference();
245255
* int getInt();
246256
* ```
247-
* `isReturnValueDeref()` holds for the `FunctionOutput` that represents the value of
257+
* - `isReturnValueDeref()` holds for the `FunctionOutput` that represents the value of
248258
* `*getPointer()` (with type `char`).
249-
* `isReturnValueDeref()` holds for the `FunctionOutput` that represents the value of
259+
* - `isReturnValueDeref()` holds for the `FunctionOutput` that represents the value of
250260
* `getReference()` (with type `float`).
251-
* There is no `FunctionOutput` of `getInt()` for which `isReturnValueDeref()` holds because the
261+
* - There is no `FunctionOutput` of `getInt()` for which `isReturnValueDeref()` holds because the
252262
* return type of `getInt()` is neither a pointer nor a reference.
253263
*/
254264
predicate isReturnValueDeref() { none() }
255265

256-
/*
266+
/**
257267
* 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.
268+
* returns a pointer, or the output value referred to by the return value of a function, if the
269+
* function returns a reference.
260270
* DEPRECATED: Use `isReturnValueDeref()` instead.
261271
*/
262-
263272
deprecated final predicate isOutReturnPointer() { isReturnValueDeref() }
264273
}
265274

@@ -276,7 +285,7 @@ class OutParameterDeref extends FunctionOutput, TOutParameterDeref {
276285
}
277286

278287
class OutQualifierObject extends FunctionOutput, TOutQualifierObject {
279-
override string toString() { result = "OutQualifier" }
288+
override string toString() { result = "OutQualifierObject" }
280289

281290
override predicate isQualifierObject() { any() }
282291
}

0 commit comments

Comments
 (0)