Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d50dd09

Browse files
author
Robert Marsh
committed
C++: rename to Iterator*Operator
1 parent 85af74e commit d50dd09

1 file changed

Lines changed: 20 additions & 44 deletions

File tree

  • cpp/ql/src/semmle/code/cpp/models/implementations

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

Lines changed: 20 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ class LegacyIterator extends Type {
3434
}
3535
}
3636

37-
class IteratorOperatorStar extends Operator, TaintFunction {
38-
IteratorOperatorStar() {
37+
class IteratorPointerDereferenceOperator extends Operator, TaintFunction {
38+
IteratorPointerDereferenceOperator() {
3939
this.hasName("operator*") and
4040
this.getACallToThisFunction().getArgument(0).getFullyConverted().getUnderlyingType() instanceof
4141
LegacyIterator
@@ -47,9 +47,12 @@ class IteratorOperatorStar extends Operator, TaintFunction {
4747
}
4848
}
4949

50-
class IteratorOperatorPlusPlus extends Operator, TaintFunction {
51-
IteratorOperatorPlusPlus() {
52-
this.hasName("operator++") and
50+
class IteratorCrementOperator extends Operator, TaintFunction {
51+
IteratorCrementOperator() {
52+
(
53+
this.hasName("operator++") or
54+
this.hasName("operator--")
55+
) and
5356
this
5457
.getACallToThisFunction()
5558
.getArgument(0)
@@ -65,26 +68,8 @@ class IteratorOperatorPlusPlus extends Operator, TaintFunction {
6568
}
6669
}
6770

68-
69-
class IteratorOperatorMinusMinus extends Operator, TaintFunction {
70-
IteratorOperatorMinusMinus() {
71-
this.hasName("operator++") and
72-
this
73-
.getACallToThisFunction()
74-
.getArgument(0)
75-
.getFullyConverted()
76-
.getUnderlyingType()
77-
.(ReferenceType)
78-
.getBaseType() instanceof LegacyIterator
79-
}
80-
81-
override predicate hasTaintFlow(FunctionInput input, FunctionOutput output) {
82-
input.isParameterDeref(0) and
83-
output.isParameterDeref(0)
84-
}
85-
}
86-
class IteratorOperatorArrow extends Operator, TaintFunction {
87-
IteratorOperatorArrow() {
71+
class IteratorFieldOperator extends Operator, TaintFunction {
72+
IteratorFieldOperator() {
8873
this.hasName("operator->") and
8974
this
9075
.getACallToThisFunction()
@@ -101,8 +86,8 @@ class IteratorOperatorArrow extends Operator, TaintFunction {
10186
}
10287
}
10388

104-
class IteratorMemberOperatorStar extends MemberFunction, TaintFunction {
105-
IteratorMemberOperatorStar() {
89+
class IteratorPointerDereferenceMemberOperator extends MemberFunction, TaintFunction {
90+
IteratorPointerDereferenceMemberOperator() {
10691
this.hasName("operator*") and
10792
this.getDeclaringType() instanceof LegacyIterator
10893
}
@@ -113,9 +98,12 @@ class IteratorMemberOperatorStar extends MemberFunction, TaintFunction {
11398
}
11499
}
115100

116-
class IteratorMemberOperatorPlusPlus extends MemberFunction, TaintFunction {
117-
IteratorMemberOperatorPlusPlus() {
118-
this.hasName("operator++") and
101+
class IteratorCrementMemberOperator extends MemberFunction, TaintFunction {
102+
IteratorCrementMemberOperator() {
103+
(
104+
this.hasName("operator++") or
105+
this.hasName("operator--")
106+
) and
119107
this.getDeclaringType() instanceof LegacyIterator
120108
}
121109

@@ -125,8 +113,8 @@ class IteratorMemberOperatorPlusPlus extends MemberFunction, TaintFunction {
125113
}
126114
}
127115

128-
class IteratorMemberOperatorArrow extends Operator, TaintFunction {
129-
IteratorMemberOperatorArrow() {
116+
class IteratorFieldMemberOperator extends Operator, TaintFunction {
117+
IteratorFieldMemberOperator() {
130118
this.hasName("operator->") and
131119
this.getDeclaringType() instanceof LegacyIterator
132120
}
@@ -136,15 +124,3 @@ class IteratorMemberOperatorArrow extends Operator, TaintFunction {
136124
output.isReturnValue()
137125
}
138126
}
139-
140-
class IteratorMemberOperatorMinusMinus extends MemberFunction, TaintFunction {
141-
IteratorMemberOperatorMinusMinus() {
142-
this.hasName("operator--") and
143-
this.getDeclaringType() instanceof LegacyIterator
144-
}
145-
146-
override predicate hasTaintFlow(FunctionInput input, FunctionOutput output) {
147-
input.isQualifierObject() and
148-
output.isQualifierObject()
149-
}
150-
}

0 commit comments

Comments
 (0)