Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the MISRA C++ RULE-7-0-4 CodeQL query to improve evaluation performance by guiding CodeQL’s optimizer for shift-constant range checking.
Changes:
- Added
bindingset[right, leftType]forisValidShiftConstantRange. - Added
pragma[inline_late]to encourage late inlining ofisValidShiftConstantRange.
Show a summary per file
| File | Description |
|---|---|
| cpp/misra/src/rules/RULE-7-0-4/InappropriateBitwiseOrShiftOperands.ql | Adds optimizer hints to the constant-shift-range predicate to improve query performance. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 2
Agent-Logs-Url: https://github.com/github/codeql-coding-standards/sessions/f476011c-d007-4a94-af05-f48e06932289 Co-authored-by: mbaluda <5237080+mbaluda@users.noreply.github.com>
inappropriate-bitwise-or-shift-operandsRULE-6-4-2 RULE-7-0-4
Enhanced performance of the 'isValidShiftConstantRange' predicate by adding annotations for optimization.
Contributor
There was a problem hiding this comment.
Copilot's findings
Comments suppressed due to low confidence (2)
change_notes/2026-04-25-fix-performance-inappropriate-bitwise-or-shift-operands.md:5
- Change notes typically use past tense for bullet items. Please change "Remove false positives..." to "Removed false positives...".
- Remove false positives related to the `insertion operator`.
cpp/common/src/codingstandards/cpp/rules/hiddeninheritedoverridablememberfunction/HiddenInheritedOverridableMemberFunction.qll:31
- The PR description focuses on the RULE-7-0-4 shift-range predicate, but this PR also changes the shared hidden-inherited-member-function library used by RULE-6-4-2 (and A7-3-1). Please update the PR description to mention this additional functional area so reviewers understand the full scope of the change.
query predicate problems(
OverridingDeclaration overridingDecl, string message, HiddenDeclaration hiddenDecl,
string hiddenDecl_string
) {
- Files reviewed: 3/3 changed files
- Comments generated: 3
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.
Description
This pull request introduces a new predicate to help validate constant ranges for shift operations in the
InappropriateBitwiseOrShiftOperands.qlrule. The main change is the addition of theisValidShiftConstantRangepredicate, which checks the range of constant values used in shift expressions.Change request type
.ql,.qll,.qlsor unit tests)Rules with added or modified queries
Release change checklist
A change note (development_handbook.md#change-notes) is required for any pull request which modifies:
If you are only adding new rule queries, a change note is not required.
Author: Is a change note required?
🚨🚨🚨
Reviewer: Confirm that format of shared queries (not the .qll file, the
.ql file that imports it) is valid by running them within VS Code.
Reviewer: Confirm that either a change note is not required or the change note is required and has been added.
Query development review checklist
For PRs that add new queries or modify existing queries, the following checklist should be completed by both the author and reviewer:
Author
As a rule of thumb, predicates specific to the query should take no more than 1 minute, and for simple queries be under 10 seconds. If this is not the case, this should be highlighted and agreed in the code review process.
Reviewer
As a rule of thumb, predicates specific to the query should take no more than 1 minute, and for simple queries be under 10 seconds. If this is not the case, this should be highlighted and agreed in the code review process.