Skip to content

Commit 71e67e0

Browse files
Copilot feedback
1 parent c06ea92 commit 71e67e0

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

cpp/common/src/codingstandards/cpp/Call.qll

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,27 +37,28 @@ class CallArgumentExpr extends Expr {
3737
}
3838

3939
/**
40-
* Get the `FunctionExpr` or `FunctionCall` that this argument appears in.
40+
* Gets the `FunctionExpr` or `FunctionCall` that this argument appears in.
4141
*/
4242
Call getCall() { result = call }
4343

4444
/**
45-
* Gets the `Type` of the parameter corresponding to this argument, whether its based on the target function or the function pointer type.
45+
* Gets the `Type` of the parameter corresponding to this argument, whether its based on the
46+
* target function or the function pointer type.
4647
*/
4748
Type getParamType() { result = paramType }
4849

4950
/**
50-
* Get the argument index of this argument in the call.
51+
* Gets the argument index of this argument in the call.
5152
*/
5253
int getArgIndex() { result = argIndex }
5354

5455
/**
55-
* Get the target `Function` if this is an argument to a `FunctionCall`.
56+
* Gets the target `Function` if this is an argument to a `FunctionCall`.
5657
*/
5758
Function getKnownFunction() { result = call.getTarget() }
5859

5960
/**
60-
* Get the target `Parameter` if this is an argument to a `FunctionCall`.
61+
* Gets the target `Parameter` if this is an argument to a `FunctionCall`.
6162
*/
6263
Parameter getKnownParameter() { result = call.getTarget().getParameter(argIndex) }
6364
}

cpp/misra/src/rules/RULE-10-1-1/PointerOrRefParamNotConst.ql

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import codingstandards.cpp.misra
2121
import codingstandards.cpp.types.Pointers
2222
import codingstandards.cpp.Call
2323
import codingstandards.cpp.SideEffect
24-
import codingstandards.cpp.alertreporting.HoldsForAllCopies
2524

2625
/**
2726
* Holds if the function is in a template scope and should be excluded.
@@ -35,7 +34,7 @@ predicate isInTemplateScope(Function f) {
3534
/**
3635
* A `Type` that may be a pointer, array, or reference, to a const or a non-const type.
3736
*
38-
* For example, `const int*`, `int* const`, `cont int* const`, `int*`, `int&`, `const int&` are all
37+
* For example, `const int*`, `int* const`, `const int* const`, `int*`, `int&`, `const int&` are all
3938
* `PointerLikeType`s, while `int`, `int&&`, and `const int` are not.
4039
*
4140
* To check if a `PointerLikeType` points/refers to a const-qualified type, use the `pointsToConst()`
@@ -61,12 +60,12 @@ class PointerLikeType extends Type {
6160
}
6261

6362
/**
64-
* Get the pointed to or referred to type, for instance `int` for `int*` or `const int&`.
63+
* Gets the pointed to or referred to type, for instance `int` for `int*` or `const int&`.
6564
*/
6665
Type getInnerType() { result = innerType }
6766

6867
/**
69-
* Get the resolved pointer, array, or reference type itself, for instance `int*` in `int* const`.
68+
* Gets the resolved pointer, array, or reference type itself, for instance `int*` in `int* const`.
7069
*
7170
* Removes cv-qualification and resolves typedefs and decltypes and specifiers via
7271
* `stripTopLevelSpecifiers()`.
@@ -80,7 +79,7 @@ class PointerLikeType extends Type {
8079
predicate pointsToConst() { innerType.isConst() }
8180

8281
/**
83-
* Holds when this type points to non-const -- for example, `int*` and `int&` and `int const*`
82+
* Holds when this type points to non-const -- for example, `int*` and `int&` and `int *const`
8483
* point to non-const, while `const int*`, `const int&` do not.
8584
*/
8685
predicate pointsToNonConst() { not innerType.isConst() }
@@ -100,12 +99,12 @@ class PointerLikeParam extends Parameter {
10099
}
101100

102101
/**
103-
* Get the pointer like type of this parameter.
102+
* Gets the pointer like type of this parameter.
104103
*/
105104
PointerLikeType getPointerLikeType() { result = pointerLikeType }
106105

107106
/**
108-
* Get usages of this parameter that maintain pointer-like semantics -- typically this means
107+
* Gets usages of this parameter that maintain pointer-like semantics -- typically this means
109108
* either a normal access, or switching between pointers and reference semantics.
110109
*
111110
* Examples of accesses with pointer-like semantics include:
@@ -177,7 +176,6 @@ class PointerLikeEffect extends VariableEffect {
177176
class NonConstParam extends PointerLikeParam {
178177
NonConstParam() {
179178
not pointerLikeType.pointsToConst() and
180-
not pointerLikeType.getInnerType() instanceof VoidType and
181179
// Ignore parameters in functions without bodies
182180
exists(this.getFunction().getBlock()) and
183181
// Ignore unnamed parameters

0 commit comments

Comments
 (0)