@@ -10,7 +10,6 @@ private import TranslatedElement
1010private import TranslatedExpr
1111private import TranslatedFunction
1212private import TranslatedInitialization
13- private import EdgeKind
1413
1514TranslatedStmt getTranslatedStmt ( Stmt stmt ) { result .getAst ( ) = stmt }
1615
@@ -152,7 +151,7 @@ class TranslatedMicrosoftTryExceptHandler extends TranslatedElement,
152151 // TODO: This is not really correct. The semantics of `EXCEPTION_CONTINUE_EXECUTION` is that
153152 // we should continue execution at the point where the exception occurred. But we don't have
154153 // any instruction to model this behavior.
155- result = this .getExceptionSuccessorInstruction ( any ( GotoEdge edge ) , sehExceptionEdge ( ) )
154+ result = this .getExceptionSuccessorInstruction ( any ( GotoEdge edge ) )
156155 or
157156 kind instanceof FalseEdge and
158157 result = this .getInstruction ( TryExceptGenerateZero ( ) )
@@ -172,7 +171,7 @@ class TranslatedMicrosoftTryExceptHandler extends TranslatedElement,
172171 tag = TryExceptCompareZeroBranch ( ) and
173172 (
174173 kind instanceof TrueEdge and
175- result = this .getExceptionSuccessorInstruction ( any ( GotoEdge edge ) , sehExceptionEdge ( ) )
174+ result = this .getExceptionSuccessorInstruction ( any ( GotoEdge edge ) )
176175 or
177176 kind instanceof FalseEdge and
178177 result = this .getInstruction ( TryExceptGenerateOne ( ) )
@@ -227,10 +226,10 @@ class TranslatedMicrosoftTryExceptHandler extends TranslatedElement,
227226
228227 final override Function getFunction ( ) { result = tryExcept .getEnclosingFunction ( ) }
229228
230- override Instruction getExceptionSuccessorInstruction ( EdgeKind kind , ExceptionEdge exception ) {
229+ override Instruction getExceptionSuccessorInstruction ( EdgeKind kind ) {
231230 // A throw from within a `__except` block flows to the handler for the parent of
232231 // the `__try`.
233- result = this .getParent ( ) .getParent ( ) .getExceptionSuccessorInstruction ( kind , exception )
232+ result = this .getParent ( ) .getParent ( ) .getExceptionSuccessorInstruction ( kind )
234233 }
235234}
236235
@@ -283,10 +282,10 @@ class TranslatedMicrosoftTryFinallyHandler extends TranslatedElement,
283282 result = getTranslatedStmt ( tryFinally .getFinally ( ) )
284283 }
285284
286- override Instruction getExceptionSuccessorInstruction ( EdgeKind kind , ExceptionEdge exception ) {
285+ override Instruction getExceptionSuccessorInstruction ( EdgeKind kind ) {
287286 // A throw from within a `__finally` block flows to the handler for the parent of
288287 // the `__try`.
289- result = this .getParent ( ) .getParent ( ) .getExceptionSuccessorInstruction ( kind , exception )
288+ result = this .getParent ( ) .getParent ( ) .getExceptionSuccessorInstruction ( kind )
290289 }
291290}
292291
@@ -735,32 +734,14 @@ class TranslatedTryStmt extends TranslatedStmt {
735734 // of the `try`, because the exception successor of the `try` itself is
736735 // the first catch clause.
737736 handler = this .getHandler ( stmt .getNumberOfCatchClauses ( ) - 1 ) and
738- exists ( ExceptionEdge exception |
739- stmt instanceof MicrosoftTryStmt and exception instanceof SehExceptionEdge
740- or
741- stmt instanceof TryStmt and exception instanceof CppExceptionEdge
742- |
743- result = this .getParent ( ) .getExceptionSuccessorInstruction ( kind , exception )
744- )
737+ result = this .getParent ( ) .getExceptionSuccessorInstruction ( kind )
745738 }
746739
747- final override Instruction getExceptionSuccessorInstruction ( EdgeKind kind , ExceptionEdge exception ) {
748- // Seh exceptions are only handled for Seh try statements and
749- // C++ exceptions for C++ try statements.
750- // I.e., we are assuming there isn't a mix and match between Seh and C++ exceptions.
751- // They are either all Seh or all C++ within a single try block depending on the
752- // try type (TryStmt vs MicrosoftTryStmt).
753- (
754- stmt instanceof TryStmt and exception instanceof CppExceptionEdge
755- or
756- stmt instanceof MicrosoftTryStmt and exception instanceof SehExceptionEdge
757- ) and
758- (
759- result = this .getHandler ( 0 ) .getFirstInstruction ( kind )
760- or
761- not exists ( this .getHandler ( _) ) and
762- result = this .getFinally ( ) .getFirstInstruction ( kind )
763- )
740+ final override Instruction getExceptionSuccessorInstruction ( EdgeKind kind ) {
741+ result = this .getHandler ( 0 ) .getFirstInstruction ( kind )
742+ or
743+ not exists ( this .getHandler ( _) ) and
744+ result = this .getFinally ( ) .getFirstInstruction ( kind )
764745 }
765746
766747 private TranslatedElement getHandler ( int index ) { result = stmt .getTranslatedHandler ( index ) }
@@ -840,10 +821,10 @@ abstract class TranslatedHandler extends TranslatedStmt {
840821 child = this .getBlock ( ) and result = this .getParent ( ) .getChildSuccessor ( this , kind )
841822 }
842823
843- override Instruction getExceptionSuccessorInstruction ( EdgeKind kind , ExceptionEdge exception ) {
824+ override Instruction getExceptionSuccessorInstruction ( EdgeKind kind ) {
844825 // A throw from within a `catch` block flows to the handler for the parent of
845826 // the `try`.
846- result = this .getParent ( ) .getParent ( ) .getExceptionSuccessorInstruction ( kind , exception )
827+ result = this .getParent ( ) .getParent ( ) .getExceptionSuccessorInstruction ( kind )
847828 }
848829
849830 TranslatedStmt getBlock ( ) { result = getTranslatedStmt ( stmt .getBlock ( ) ) }
0 commit comments