C++: Support the spaceship operator in the IR#20069
Merged
jketema merged 2 commits intogithub:mainfrom Jul 16, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This pull request adds support for the C++ spaceship operator (<=>) in the Intermediate Representation (IR) by introducing a new Spaceship opcode and corresponding instruction classes. The changes enable proper handling of three-way comparison operations in the IR generation pipeline.
Key changes:
- Added
Spaceshipopcode to the IR opcode definitions - Created
CompareThreeWayInstructionclasses across IR implementations - Updated expression translation to handle
SpaceshipExproperations
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| cpp/ql/lib/semmle/code/cpp/ir/implementation/Opcode.qll | Adds the Spaceship opcode definition for three-way comparison |
| cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedExpr.qll | Adds translation logic for spaceship expressions |
| cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/Instruction.qll | Defines CompareThreeWayInstruction class for raw IR |
| cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll | Defines CompareThreeWayInstruction class for aliased SSA IR |
| cpp/ql/lib/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll | Defines CompareThreeWayInstruction class for unaliased SSA IR |
| Multiple .expected files | Updated test expectations showing proper spaceship operator handling |
Contributor
Author
|
DCA is uneventful |
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.
No description provided.