Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ class TranslatedFunctionCall extends TranslatedCallExpr, TranslatedDirectCall {
final override predicate mayThrowException(ExceptionEdge e) {
Copy link

Copilot AI Jun 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The override for mayThrowException in TranslatedFunctionCall no longer delegates to ThrowingFunction for C++ exception edges. You should add a branch such as e instanceof CppExceptionEdge and expr.getTarget().(ThrowingFunction).mayThrowException(e) to restore C++ exception support.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's on purpose, Copilot.

this.mustThrowException(e)
or
exists(MicrosoftTryStmt tryStmt | tryStmt.getStmt().getAChild*() = expr) and
exists(MicrosoftTryStmt tryStmt | tryStmt.getStmt() = expr.getEnclosingStmt().getParent*()) and
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! 🚀

e instanceof SehExceptionEdge
}

Expand Down
51 changes: 45 additions & 6 deletions cpp/ql/test/library-tests/ir/ir/aliased_ir.expected
Original file line number Diff line number Diff line change
Expand Up @@ -39210,13 +39210,52 @@ try_except.c:
# 49| r49_3(int) = Call[i] : func:r49_2
# 49| m49_4(unknown) = ^CallSideEffect : ~m46_4
# 49| m49_5(unknown) = Chi : total:m46_4, partial:m49_4
# 49| m49_6(int) = Store[y] : &:r49_1, r49_3
# 54| v54_1(void) = NoOp :
# 46| v46_7(void) = ReturnVoid :
# 46| v46_8(void) = AliasedUse : ~m49_5
# 46| v46_9(void) = ExitFunction :
#-----| Goto -> Block 1
#-----| SEH Exception -> Block 4

# 49| Block 1
# 49| m49_6(int) = Store[y] : &:r49_1, r49_3
#-----| Goto -> Block 6

# 51| Block 2
# 51| r51_1(int) = Constant[0] :
# 51| r51_2(bool) = CompareEQ : r51_7, r51_1
# 51| v51_3(void) = ConditionalBranch : r51_2
#-----| False -> Block 3
#-----| True -> Block 7

# 51| Block 3
# 51| r51_4(int) = Constant[1] :
# 51| r51_5(bool) = CompareEQ : r51_7, r51_4
# 51| v51_6(void) = ConditionalBranch : r51_5
#-----| False -> Block 7
#-----| True -> Block 5

# 51| Block 4
# 51| r51_7(int) = Constant[1] :
# 51| r51_8(int) = Constant[-1] :
# 51| r51_9(bool) = CompareEQ : r51_7, r51_8
# 51| v51_10(void) = ConditionalBranch : r51_9
#-----| False -> Block 2
#-----| True -> Block 7

# 52| Block 5
# 52| r52_1(glval<unknown>) = FunctionAddress[sink] :
# 52| r52_2(glval<int>) = VariableAddress[x] :
# 52| r52_3(int) = Load[x] : &:r52_2, m47_3
# 52| v52_4(void) = Call[sink] : func:r52_1, 0:r52_3
# 52| m52_5(unknown) = ^CallSideEffect : ~m49_5
# 52| m52_6(unknown) = Chi : total:m49_5, partial:m52_5
#-----| Goto -> Block 6

# 54| Block 6
# 54| m54_1(unknown) = Phi : from 1:~m49_5, from 5:~m52_6
# 54| v54_2(void) = NoOp :
# 46| v46_7(void) = ReturnVoid :
# 46| v46_8(void) = AliasedUse : ~m54_1
# 46| v46_9(void) = ExitFunction :

# 46| Block 1
# 46| Block 7
# 46| v46_10(void) = Unreached :

try_except.cpp:
Expand Down
2 changes: 0 additions & 2 deletions cpp/ql/test/library-tests/ir/ir/raw_consistency.expected
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ lostReachability
backEdgeCountMismatch
useNotDominatedByDefinition
| ir.cpp:1535:8:1535:8 | Unary | Operand 'Unary' is not dominated by its definition in function '$@'. | ir.cpp:1535:8:1535:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct() | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct() |
| try_except.c:51:13:51:13 | Left | Operand 'Left' is not dominated by its definition in function '$@'. | try_except.c:46:6:46:6 | void j(int) | void j(int) |
| try_except.c:51:13:51:13 | Left | Operand 'Left' is not dominated by its definition in function '$@'. | try_except.c:46:6:46:6 | void j(int) | void j(int) |
switchInstructionWithoutDefaultEdge
notMarkedAsConflated
wronglyMarkedAsConflated
Expand Down
26 changes: 15 additions & 11 deletions cpp/ql/test/library-tests/ir/ir/raw_ir.expected
Original file line number Diff line number Diff line change
Expand Up @@ -37484,8 +37484,8 @@ try_except.c:
# 49| r49_2(glval<unknown>) = FunctionAddress[i] :
# 49| r49_3(int) = Call[i] : func:r49_2
# 49| mu49_4(unknown) = ^CallSideEffect : ~m?
# 49| mu49_5(int) = Store[y] : &:r49_1, r49_3
#-----| Goto -> Block 7
#-----| Goto -> Block 3
#-----| SEH Exception -> Block 6

# 46| Block 1
# 46| v46_6(void) = AliasedUse : ~m?
Expand All @@ -37495,36 +37495,40 @@ try_except.c:
# 46| v46_8(void) = Unwind :
#-----| Goto -> Block 1

# 51| Block 3
# 49| Block 3
# 49| mu49_5(int) = Store[y] : &:r49_1, r49_3
#-----| Goto -> Block 8

# 51| Block 4
# 51| r51_1(int) = Constant[0] :
# 51| r51_2(bool) = CompareEQ : r51_7, r51_1
# 51| v51_3(void) = ConditionalBranch : r51_2
#-----| False -> Block 4
#-----| False -> Block 5
#-----| True -> Block 2

# 51| Block 4
# 51| Block 5
# 51| r51_4(int) = Constant[1] :
# 51| r51_5(bool) = CompareEQ : r51_7, r51_4
# 51| v51_6(void) = ConditionalBranch : r51_5
#-----| True -> Block 6
#-----| True -> Block 7

# 51| Block 5
# 51| Block 6
# 51| r51_7(int) = Constant[1] :
# 51| r51_8(int) = Constant[-1] :
# 51| r51_9(bool) = CompareEQ : r51_7, r51_8
# 51| v51_10(void) = ConditionalBranch : r51_9
#-----| False -> Block 3
#-----| False -> Block 4
#-----| True -> Block 2

# 52| Block 6
# 52| Block 7
# 52| r52_1(glval<unknown>) = FunctionAddress[sink] :
# 52| r52_2(glval<int>) = VariableAddress[x] :
# 52| r52_3(int) = Load[x] : &:r52_2, ~m?
# 52| v52_4(void) = Call[sink] : func:r52_1, 0:r52_3
# 52| mu52_5(unknown) = ^CallSideEffect : ~m?
#-----| Goto -> Block 7
#-----| Goto -> Block 8

# 54| Block 7
# 54| Block 8
# 54| v54_1(void) = NoOp :
# 46| v46_9(void) = ReturnVoid :
#-----| Goto -> Block 1
Expand Down