@@ -11,6 +11,7 @@ private import TranslatedExpr
1111private import TranslatedInitialization
1212private import TranslatedStmt
1313private import VarArgs
14+ private import EdgeKind
1415
1516/**
1617 * Gets the `TranslatedFunction` that represents function `func`.
@@ -209,14 +210,16 @@ class TranslatedFunction extends TranslatedRootElement, TTranslatedFunction {
209210 (
210211 // Only generate the `Unwind` instruction if there is any exception
211212 // handling present in the function.
212- // Do not unwind for MicrosoftTryStmt (SEH), as an optimization (SEH exception
213- // will occur at any store/load, so unwind would appear everywhere as a result)
214- exists ( TryStmt try | try .getEnclosingFunction ( ) = func )
213+ exists ( TryOrMicrosoftTryStmt try | try .getEnclosingFunction ( ) = func )
215214 or
216215 exists ( ThrowExpr throw | throw .getEnclosingFunction ( ) = func )
217216 or
218- exists ( FunctionCall call , CppExceptionEdge exception | call .getEnclosingFunction ( ) = func |
219- getTranslatedExpr ( call ) .( TranslatedCallExpr ) .mayThrowException ( exception )
217+ // or
218+ // exists(FunctionCall call | call.getEnclosingFunction() = func |
219+ // getTranslatedExpr(call).(TranslatedCallExpr).mustThrowException(_)
220+ // )
221+ exists ( FunctionCall call | call .getEnclosingFunction ( ) = func |
222+ getTranslatedExpr ( call ) .( TranslatedCallExpr ) .mayThrowException ( _)
220223 )
221224 )
222225 or
@@ -231,9 +234,7 @@ class TranslatedFunction extends TranslatedRootElement, TTranslatedFunction {
231234 }
232235
233236 final override Instruction getExceptionSuccessorInstruction ( EdgeKind kind , ExceptionEdge exception ) {
234- // only unwind for C++ exceptions since SEH exceptions are too verbose
235- // and would generate unwind for all functions.
236- exception instanceof CppExceptionEdge and
237+ ( exception = cppExceptionEdge ( ) or exception = sehExceptionEdge ( ) ) and
237238 result = this .getInstruction ( UnwindTag ( ) ) and
238239 kind instanceof GotoEdge
239240 }
0 commit comments