Skip to content

Commit 5a4a975

Browse files
committed
C#: Use Gvn comparison instead of StructuralComparisonConfiguration in Constants.
1 parent 5b5ea14 commit 5a4a975

File tree

1 file changed

+1
-20
lines changed

1 file changed

+1
-20
lines changed

csharp/ql/lib/semmle/code/csharp/commons/Constants.qll

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -105,31 +105,12 @@ private module ConstantComparisonOperation {
105105
}
106106
}
107107

108-
private class StructuralComparisonConfig extends StructuralComparison::StructuralComparisonConfiguration {
109-
StructuralComparisonConfig() { this = "CompareIdenticalValues" }
110-
111-
override predicate candidate(ControlFlowElement x, ControlFlowElement y) {
112-
exists(ComparisonTest ct |
113-
x = ct.getFirstArgument() and
114-
y = ct.getSecondArgument()
115-
)
116-
}
117-
118-
ComparisonTest getComparisonTest() {
119-
exists(Element x, Element y |
120-
result.getFirstArgument() = x and
121-
result.getSecondArgument() = y and
122-
same(x, y)
123-
)
124-
}
125-
}
126-
127108
/**
128109
* Holds if comparison test `ct` compares two structurally identical
129110
* expressions.
130111
*/
131112
predicate comparesIdenticalValues(ComparisonTest ct) {
132-
ct = any(StructuralComparisonConfig c).getComparisonTest()
113+
StructuralComparison::sameGvn(ct.getFirstArgument(), ct.getSecondArgument())
133114
}
134115

135116
/**

0 commit comments

Comments
 (0)