Skip to content

Commit dce29db

Browse files
authored
Merge pull request github#18218 from MathiasVP/final-alias-edge-kind
C++: Use a final alias for `EdgeKind`
2 parents 7eb3b40 + 667abb1 commit dce29db

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

cpp/ql/lib/semmle/code/cpp/ir/implementation/EdgeKind.qll

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,56 +20,58 @@ private newtype TEdgeKind =
2020
* `Instruction` or `IRBlock` has at most one successor of any single
2121
* `EdgeKind`.
2222
*/
23-
abstract class EdgeKind extends TEdgeKind {
23+
abstract private class EdgeKindImpl extends TEdgeKind {
2424
/** Gets a textual representation of this edge kind. */
2525
abstract string toString();
2626
}
2727

28+
final class EdgeKind = EdgeKindImpl;
29+
2830
/**
2931
* A "goto" edge, representing the unconditional successor of an `Instruction`
3032
* or `IRBlock`.
3133
*/
32-
class GotoEdge extends EdgeKind, TGotoEdge {
34+
class GotoEdge extends EdgeKindImpl, TGotoEdge {
3335
final override string toString() { result = "Goto" }
3436
}
3537

3638
/**
3739
* A "true" edge, representing the successor of a conditional branch when the
3840
* condition is non-zero.
3941
*/
40-
class TrueEdge extends EdgeKind, TTrueEdge {
42+
class TrueEdge extends EdgeKindImpl, TTrueEdge {
4143
final override string toString() { result = "True" }
4244
}
4345

4446
/**
4547
* A "false" edge, representing the successor of a conditional branch when the
4648
* condition is zero.
4749
*/
48-
class FalseEdge extends EdgeKind, TFalseEdge {
50+
class FalseEdge extends EdgeKindImpl, TFalseEdge {
4951
final override string toString() { result = "False" }
5052
}
5153

5254
/**
5355
* An "exception" edge, representing the successor of an instruction when that
5456
* instruction's evaluation throws an exception.
5557
*/
56-
class ExceptionEdge extends EdgeKind, TExceptionEdge {
58+
class ExceptionEdge extends EdgeKindImpl, TExceptionEdge {
5759
final override string toString() { result = "Exception" }
5860
}
5961

6062
/**
6163
* A "default" edge, representing the successor of a `Switch` instruction when
6264
* none of the case values matches the condition value.
6365
*/
64-
class DefaultEdge extends EdgeKind, TDefaultEdge {
66+
class DefaultEdge extends EdgeKindImpl, TDefaultEdge {
6567
final override string toString() { result = "Default" }
6668
}
6769

6870
/**
6971
* A "case" edge, representing the successor of a `Switch` instruction when the
7072
* the condition value matches a corresponding `case` label.
7173
*/
72-
class CaseEdge extends EdgeKind, TCaseEdge {
74+
class CaseEdge extends EdgeKindImpl, TCaseEdge {
7375
string minValue;
7476
string maxValue;
7577

0 commit comments

Comments
 (0)