Skip to content

Commit 17e0dec

Browse files
committed
C++: Add toString for RelationStrictness
This helps for debugging.
1 parent a0a6f28 commit 17e0dec

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

cpp/ql/lib/semmle/code/cpp/rangeanalysis/RangeAnalysisUtils.qll

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import cpp
22

33
/**
4-
* Describes whether a relation is 'strict' (that is, a `<` or `>`
4+
* The strictness of a relation. Either 'strict' (that is, a `<` or `>`
55
* relation) or 'non-strict' (a `<=` or `>=` relation).
66
*/
7-
newtype RelationStrictness =
7+
newtype TRelationStrictness =
88
/**
99
* Represents that a relation is 'strict' (that is, a `<` or `>` relation).
1010
*/
@@ -14,6 +14,19 @@ newtype RelationStrictness =
1414
*/
1515
Nonstrict()
1616

17+
/**
18+
* The strictness of a relation. Either 'strict' (that is, a `<` or `>`
19+
* relation) or 'non-strict' (a `<=` or `>=` relation).
20+
*/
21+
class RelationStrictness extends TRelationStrictness {
22+
/** Gets the string representation of this relation strictness. */
23+
string toString() {
24+
this = Strict() and result = "strict"
25+
or
26+
this = Nonstrict() and result = "non-strict"
27+
}
28+
}
29+
1730
/**
1831
* Describes whether a relation is 'greater' (that is, a `>` or `>=`
1932
* relation) or 'lesser' (a `<` or `<=` relation).

0 commit comments

Comments
 (0)