-
Notifications
You must be signed in to change notification settings - Fork 1.7k
C++: Fix typeid IR translation #20060
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes the IR translation for C++ typeid
expressions by implementing proper IR instructions for both typeid
with expressions and typeid
with types. The changes address consistency issues in the IR generation where typeid
operations were previously not properly handled.
Key changes:
- Adds new IR instruction types
TypeidExpr
andTypeidType
with corresponding opcodes - Implements
TranslatedTypeidExpr
class to handle the translation oftypeid
operations - Updates test expectations to reflect the corrected IR generation
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
File | Description |
---|---|
cpp/ql/lib/semmle/code/cpp/ir/implementation/Opcode.qll | Adds TTypeidExpr and TTypeidType opcodes with their corresponding classes |
cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/Instruction.qll | Defines TypeidExprInstruction and TypeidTypeInstruction classes |
cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedExpr.qll | Implements TranslatedTypeidExpr class for handling typeid expression translation |
Multiple .expected files | Updates test expectations to reflect the fixed IR translation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One comment, but otherwise this LGTM if DCA comes back happy!
cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Final rounds of comments and then I think we're there 🥳
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (once DCA comes back happy)!
It looks likes this gives a slowdown on zeek/spicy. It looks like that project uses The other projects in DCA look fine. |
Makes sense. I think that's fine. I'm quite happy with the large reduction in Did you see that there's a large increase in |
Yes, drogon also has some uses of |
Yeah, I don't think this needs to be looked at in this PR since I highly doubt that this PR does anything incorrectly. |
Ok, merging. |
No description provided.