Skip to content

Commit c06ea92

Browse files
Delete test predicate, clarify multiple param exclusion
1 parent 96977d0 commit c06ea92

File tree

1 file changed

+3
-19
lines changed

1 file changed

+3
-19
lines changed

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

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -135,24 +135,6 @@ class PointerLikeParam extends Parameter {
135135
}
136136
}
137137

138-
predicate test(Assignment a, Field f, Parameter p, string n) {
139-
a.getLValue() = f.getAnAccess() and
140-
a.getRValue() = p.getAnAccess() and
141-
f.getName() = "planes" and
142-
n = p.getFunction().getName() and
143-
a.getFile().getBaseName() = "matrix_iterator.cpp"
144-
}
145-
146-
predicate test2(Parameter p) {
147-
p.getName() = ["planes", "_planes"] and
148-
p.getFunction().getName() = "init"
149-
}
150-
151-
predicate test3(Function f, int num) {
152-
f.getName() = "init" and
153-
num = strictcount(Parameter p | p.getFunction() = f and p.getName() = ["planes", "_planes"])
154-
}
155-
156138
/**
157139
* A `VariableEffect` whose target variable is a `PointerLikeParam`.
158140
*
@@ -261,7 +243,9 @@ where
261243
not isExcluded(param, Declarations6Package::pointerOrRefParamNotConstQuery()) and
262244
innerType = param.getPointerLikeType().getInnerType() and
263245
not param.isAffectedByMacro() and
264-
// Exclude functions with copied parameters which leads to wrong results.
246+
// There are some odd database patterns where a function has multiple parameters with the same
247+
// index and different names, due to strange extraction+linker scenarios. These give wrong
248+
// results, and should be excluded.
265249
count(Parameter p |
266250
p.getFunction() = param.getFunction() and
267251
p.getIndex() = param.getIndex()

0 commit comments

Comments
 (0)