@@ -84,11 +84,10 @@ abstract class TranslatedCall extends TranslatedExpr {
8484 this .getEnclosingFunction ( ) .getFunction ( ) = instr .getEnclosingFunction ( )
8585 )
8686 else (
87- not this .mustThrowException ( ) and
87+ not this .mustThrowException ( _ ) and
8888 result = this .getParent ( ) .getChildSuccessor ( this , kind )
8989 or
90- this .mayThrowException ( ) and
91- kind instanceof CppExceptionEdge and
90+ this .mayThrowException ( kind ) and
9291 result = this .getParent ( ) .getExceptionSuccessorInstruction ( any ( GotoEdge edge ) )
9392 )
9493 }
@@ -117,14 +116,14 @@ abstract class TranslatedCall extends TranslatedExpr {
117116 final override Instruction getResult ( ) { result = this .getInstruction ( CallTag ( ) ) }
118117
119118 /**
120- * Holds if the evaluation of this call may throw an exception.
119+ * Holds if the evaluation of this call may throw an exception of the kind represented by the `ExceptionEdge` .
121120 */
122- abstract predicate mayThrowException ( ) ;
121+ abstract predicate mayThrowException ( ExceptionEdge e ) ;
123122
124123 /**
125- * Holds if the evaluation of this call always throws an exception.
124+ * Holds if the evaluation of this call always throws an exception of the kind represented by the `ExceptionEdge` .
126125 */
127- abstract predicate mustThrowException ( ) ;
126+ abstract predicate mustThrowException ( ExceptionEdge e ) ;
128127
129128 /**
130129 * Gets the result type of the call.
@@ -332,14 +331,14 @@ class TranslatedExprCall extends TranslatedCallExpr {
332331 result = getTranslatedExpr ( expr .getExpr ( ) .getFullyConverted ( ) )
333332 }
334333
335- final override predicate mayThrowException ( ) {
334+ final override predicate mayThrowException ( ExceptionEdge e ) {
336335 // We assume that a call to a function pointer will not throw an exception.
337336 // This is not sound in general, but this will greatly reduce the number of
338337 // exceptional edges.
339338 none ( )
340339 }
341340
342- final override predicate mustThrowException ( ) { none ( ) }
341+ final override predicate mustThrowException ( ExceptionEdge e ) { none ( ) }
343342}
344343
345344/**
@@ -362,16 +361,16 @@ class TranslatedFunctionCall extends TranslatedCallExpr, TranslatedDirectCall {
362361 not exists ( MemberFunction func | expr .getTarget ( ) = func and func .isStatic ( ) )
363362 }
364363
365- final override predicate mayThrowException ( ) {
366- expr . getTarget ( ) . ( ThrowingFunction ) . mayThrowException ( _ )
364+ final override predicate mayThrowException ( ExceptionEdge e ) {
365+ this . mustThrowException ( e )
367366 or
368- expr .getTarget ( ) instanceof AlwaysSehThrowingFunction
367+ exists ( MicrosoftTryStmt tryStmt | tryStmt .getStmt ( ) = expr .getEnclosingStmt ( ) .getParent * ( ) ) and
368+ e instanceof SehExceptionEdge
369369 }
370370
371- final override predicate mustThrowException ( ) {
372- expr .getTarget ( ) .( ThrowingFunction ) .mayThrowException ( true )
373- or
374- expr .getTarget ( ) instanceof AlwaysSehThrowingFunction
371+ final override predicate mustThrowException ( ExceptionEdge e ) {
372+ expr .getTarget ( ) instanceof AlwaysSehThrowingFunction and
373+ e instanceof SehExceptionEdge
375374 }
376375}
377376
0 commit comments