Skip to content

Commit 90dbbbb

Browse files
committed
C++: Update Iterator.qll.
1 parent 7705fc4 commit 90dbbbb

File tree

1 file changed

+7
-14
lines changed
  • cpp/ql/src/semmle/code/cpp/models/implementations

1 file changed

+7
-14
lines changed

cpp/ql/src/semmle/code/cpp/models/implementations/Iterator.qll

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,7 @@ private class IteratorAssignArithmeticOperator extends Operator, DataFlowFunctio
177177
class IteratorPointerDereferenceMemberOperator extends MemberFunction, TaintFunction,
178178
IteratorReferenceFunction {
179179
IteratorPointerDereferenceMemberOperator() {
180-
this.hasName("operator*") and
181-
this.getDeclaringType() instanceof Iterator
180+
this.getClassAndName("operator*") instanceof Iterator
182181
}
183182

184183
override predicate hasTaintFlow(FunctionInput input, FunctionOutput output) {
@@ -195,8 +194,7 @@ class IteratorPointerDereferenceMemberOperator extends MemberFunction, TaintFunc
195194
*/
196195
private class IteratorCrementMemberOperator extends MemberFunction, DataFlowFunction, TaintFunction {
197196
IteratorCrementMemberOperator() {
198-
this.hasName(["operator++", "operator--"]) and
199-
this.getDeclaringType() instanceof Iterator
197+
this.getClassAndName(["operator++", "operator--"]) instanceof Iterator
200198
}
201199

202200
override predicate hasDataFlow(FunctionInput input, FunctionOutput output) {
@@ -221,8 +219,7 @@ private class IteratorCrementMemberOperator extends MemberFunction, DataFlowFunc
221219
*/
222220
private class IteratorFieldMemberOperator extends Operator, TaintFunction {
223221
IteratorFieldMemberOperator() {
224-
this.hasName("operator->") and
225-
this.getDeclaringType() instanceof Iterator
222+
this.getClassAndName("operator->") instanceof Iterator
226223
}
227224

228225
override predicate hasTaintFlow(FunctionInput input, FunctionOutput output) {
@@ -236,8 +233,7 @@ private class IteratorFieldMemberOperator extends Operator, TaintFunction {
236233
*/
237234
private class IteratorBinaryArithmeticMemberOperator extends MemberFunction, TaintFunction {
238235
IteratorBinaryArithmeticMemberOperator() {
239-
this.hasName(["operator+", "operator-"]) and
240-
this.getDeclaringType() instanceof Iterator
236+
this.getClassAndName(["operator+", "operator-"]) instanceof Iterator
241237
}
242238

243239
override predicate hasTaintFlow(FunctionInput input, FunctionOutput output) {
@@ -252,8 +248,7 @@ private class IteratorBinaryArithmeticMemberOperator extends MemberFunction, Tai
252248
private class IteratorAssignArithmeticMemberOperator extends MemberFunction, DataFlowFunction,
253249
TaintFunction {
254250
IteratorAssignArithmeticMemberOperator() {
255-
this.hasName(["operator+=", "operator-="]) and
256-
this.getDeclaringType() instanceof Iterator
251+
this.getClassAndName(["operator+=", "operator-="]) instanceof Iterator
257252
}
258253

259254
override predicate hasDataFlow(FunctionInput input, FunctionOutput output) {
@@ -276,8 +271,7 @@ private class IteratorAssignArithmeticMemberOperator extends MemberFunction, Dat
276271
private class IteratorArrayMemberOperator extends MemberFunction, TaintFunction,
277272
IteratorReferenceFunction {
278273
IteratorArrayMemberOperator() {
279-
this.hasName("operator[]") and
280-
this.getDeclaringType() instanceof Iterator
274+
this.getClassAndName("operator[]") instanceof Iterator
281275
}
282276

283277
override predicate hasTaintFlow(FunctionInput input, FunctionOutput output) {
@@ -295,8 +289,7 @@ private class IteratorArrayMemberOperator extends MemberFunction, TaintFunction,
295289
*/
296290
private class IteratorAssignmentMemberOperator extends MemberFunction, TaintFunction {
297291
IteratorAssignmentMemberOperator() {
298-
this.hasName("operator=") and
299-
this.getDeclaringType() instanceof Iterator and
292+
this.getClassAndName("operator=") instanceof Iterator and
300293
not this instanceof CopyAssignmentOperator and
301294
not this instanceof MoveAssignmentOperator
302295
}

0 commit comments

Comments
 (0)