Conversation
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
No unresolved blocking issues were identified.
Review tier: Lite (auto)
Findings: None
Note
Copilot is running an experiment and ran this review at Lite.
What changed in this PR
Fixes invalid IR for chained member access on prvalue temporaries.
Changes:
- Corrects implicit field-load and synthetic-temporary handling.
- Adds regression coverage for
get_wrapper().point.x. - Updates IR and AST expectations.
| File | Description |
|---|---|
cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedElement.qll |
Adjusts load suppression and temporary materialization. |
cpp/ql/test/library-tests/ir/ir/ir.cpp |
Adds the chained-access regression case. |
cpp/ql/test/library-tests/ir/ir/raw_ir.expected |
Updates raw IR expectations. |
cpp/ql/test/library-tests/ir/ir/aliased_ir.expected |
Updates aliased IR expectations. |
cpp/ql/test/library-tests/ir/ir/PrintAST.expected |
Updates AST expectations. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Consider the test added in this PR:
get_wrapper().point.xThis PR fixes a case of invalid IR for chained field accesses where the qualifier is a prvalue.
Prvalue field accesses can require implicit loads without being having a lvalue-to-rvalue conversion from the extractor. On
mainIR construction recognizes these when inserting loads, but not when suppressing loads or deciding whether to materialize a temporary. As a result,get_wrapper().pointgenerated both aTranslatedLoadand aTranslatedSyntheticTemporaryObjectwhich was generating duplicated parents.The fix is to treat implicit field loads like extractor-marked loads in both
ignoreLoadandhasTranslatedSyntheticTemporaryObject.