C++: Add exception edges out of calls inside try statements#19787
Merged
MathiasVP merged 2 commits intogithub:mainfrom Jun 17, 2025
Merged
C++: Add exception edges out of calls inside try statements#19787MathiasVP merged 2 commits intogithub:mainfrom
try statements#19787MathiasVP merged 2 commits intogithub:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces C++ exception edges for calls inside try statements and updates the corresponding test expectations.
- Updated library test
.expectedfiles to remove obsolete SEH entries and reflect new C++ exception edges. - Extended
TranslatedFunctionCallinTranslatedCall.qllto include C++ exception edges for functions that may throw.
Reviewed Changes
Copilot reviewed 8 out of 6 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| cpp/ql/test/library-tests/controlflow/guards/GuardsEnsure.expected | Removed outdated SEH entries for calls inside try |
| cpp/ql/test/library-tests/controlflow/guards/GuardsControl.expected | Cleaned up obsolete expected line for SEH exception edge |
| cpp/ql/test/library-tests/controlflow/guards-ir/tests.expected | Adjusted IR test expectations to add C++ exception edges |
| cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedCall.qll | Imported interface and updated isExceptionalEdge predicate to handle C++ exception edges |
Comments suppressed due to low confidence (2)
cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedCall.qll:371
- The predicate references
NonCppThrowingFunction, but onlyNonThrowingwas imported. Either import the correctNonCppThrowingFunctioninterface or update the code to use the imported interface.
not expr.getTarget() instanceof NonCppThrowingFunction
cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedCall.qll:7
- [nitpick] The imported
NonThrowinginterface is not used elsewhere in this file; consider removing it if it’s not needed after addressing the predicate reference.
private import semmle.code.cpp.models.interfaces.NonThrowing
jketema
approved these changes
Jun 17, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Same as #19746, but for C++ exceptions (whereas #19746 was for SEH exceptions).