@@ -8,7 +8,8 @@ private newtype TEdgeKind =
88 TGotoEdge ( ) or // Single successor (including fall-through)
99 TTrueEdge ( ) or // 'true' edge of conditional branch
1010 TFalseEdge ( ) or // 'false' edge of conditional branch
11- TExceptionEdge ( ) or // Thrown exception
11+ TCppExceptionEdge ( ) or // Thrown C++ exception
12+ TSehExceptionEdge ( ) or // Thrown C++ exception
1213 TDefaultEdge ( ) or // 'default' label of switch
1314 TCaseEdge ( string minValue , string maxValue ) {
1415 // Case label of switch
@@ -51,12 +52,33 @@ class FalseEdge extends EdgeKindImpl, TFalseEdge {
5152 final override string toString ( ) { result = "False" }
5253}
5354
55+ abstract private class ExceptionEdgeImpl extends EdgeKindImpl { }
56+
5457/**
5558 * An "exception" edge, representing the successor of an instruction when that
5659 * instruction's evaluation throws an exception.
60+ *
61+ * Exception edges are expclitly sublcassed to
62+ * `CppExceptionEdge` and `SehExceptionEdge` only.
63+ * Further sublcasses, if required, should be added privately
64+ * here for IR efficiency.
65+ */
66+ final class ExceptionEdge = ExceptionEdgeImpl ;
67+
68+ /**
69+ * An "exception" edge, representing the successor of an instruction when that
70+ * instruction's evaluation throws an exception for C++ exceptions
5771 */
58- class ExceptionEdge extends EdgeKindImpl , TExceptionEdge {
59- final override string toString ( ) { result = "Exception" }
72+ class CppExceptionEdge extends ExceptionEdgeImpl , TCppExceptionEdge {
73+ final override string toString ( ) { result = "C++ Exception" }
74+ }
75+
76+ /**
77+ * An "exception" edge, representing the successor of an instruction when that
78+ * instruction's evaluation throws an exception for SEH exceptions
79+ */
80+ class SehExceptionEdge extends ExceptionEdgeImpl , TSehExceptionEdge {
81+ final override string toString ( ) { result = "SEH Exception" }
6082}
6183
6284/**
@@ -123,9 +145,22 @@ module EdgeKind {
123145 FalseEdge falseEdge ( ) { result = TFalseEdge ( ) }
124146
125147 /**
126- * Gets the single instance of the `ExceptionEdge` class.
148+ * Gets an instance of the `CppExceptionEdge` class.
149+ */
150+ CppExceptionEdge cppExceptionEdge ( ) { result = TCppExceptionEdge ( ) }
151+
152+ /**
153+ * Gets an instance of the `SehExceptionEdge` class.
127154 */
128- ExceptionEdge exceptionEdge ( ) { result = TExceptionEdge ( ) }
155+ SehExceptionEdge sehExceptionEdge ( ) { result = TSehExceptionEdge ( ) }
156+
157+ /**
158+ * Gets an instance of the `ExceptionEdge` class.
159+ */
160+ ExceptionEdge exceptionEdge ( ) {
161+ result = cppExceptionEdge ( ) or
162+ result = sehExceptionEdge ( )
163+ }
129164
130165 /**
131166 * Gets the single instance of the `DefaultEdge` class.
0 commit comments