Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds the Memory4 package for MISRA C++ and refactors shared query implementations for detecting overlapping object operations across multiple coding standards (MISRA C, MISRA C++, and AUTOSAR C++).
Changes:
- Adds new Memory4 package for MISRA C++ RULE-8-18-1
- Refactors ObjectAssignedToAnOverlappingObject and ObjectCopiedToAnOverlappingObject queries into shared implementations
- Updates existing queries in Representation (AUTOSAR C++) and Contracts7 (MISRA C) packages to use the new shared implementations
Reviewed changes
Copilot reviewed 37 out of 40 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| rules.csv | Updates RULE-8-18-1 package assignment |
| rule_packages/cpp/Memory4.json | New package definition for MISRA C++ Memory4 queries |
| rule_packages/cpp/Representation.json | Updates query naming to include suffix and shared implementation reference |
| rule_packages/c/Contracts7.json | Updates query naming to include suffix and shared implementation reference |
| cpp/common/src/codingstandards/cpp/rules/objectassignedtoanoverlappingobject/ObjectAssignedToAnOverlappingObject.qll | New shared implementation for overlapping assignment detection |
| cpp/common/src/codingstandards/cpp/rules/objectcopiedtoanoverlappingobject/ObjectCopiedToAnOverlappingObject.qll | Refactored shared implementation for overlapping copy detection |
| cpp/common/src/codingstandards/cpp/exclusions/cpp/Memory4.qll | New exclusion metadata for Memory4 package |
| cpp/common/src/codingstandards/cpp/exclusions/cpp/Representation.qll | Updated query references for renamed queries |
| cpp/common/src/codingstandards/cpp/exclusions/c/Contracts7.qll | Updated query references for renamed queries |
| cpp/common/src/codingstandards/cpp/exclusions/cpp/RuleMetadata.qll | Added Memory4 package integration |
| cpp/misra/src/rules/RULE-8-18-1/* | New MISRA C++ query implementations |
| cpp/autosar/src/rules/M0-2-1/* | Refactored AUTOSAR C++ query to use shared implementation |
| c/misra/src/rules/RULE-19-1/* | Refactored MISRA C query to use shared implementation |
| /test/ | Updated test infrastructure for all affected queries |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
cpp/misra/src/rules/RULE-8-18-1/ObjectAssignedToAnOverlappingObjectMisraCpp.ql
Outdated
Show resolved
Hide resolved
...ndards/cpp/rules/objectassignedtoanoverlappingobject/ObjectAssignedToAnOverlappingObject.qll
Show resolved
Hide resolved
cpp/misra/src/rules/RULE-8-18-1/ObjectCopiedToAnOverlappingObjectMisraCpp.ql
Outdated
Show resolved
Hide resolved
The module `codingstandards.cpp.SimpleRangeAnalysisCustomizations` is included in `codingstandards.c.misra` which this query doesn't import anymore from being shared. Therefore, manually include it in the import list.
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
Add
Memory4package.High-level overview
DoNotPassAliasedPointerToParamObjectAssignedToAnOverlappingObject(Factored out)ObjectAssignedToAnOverlappingObject(Factored out)ObjectCopiedToAnOverlappingObject(Factored out)ObjectCopiedToAnOverlappingObject(Imports factored-out shared query)ObjectAssignedToAnOverlappingObject(Imports factored-out shared query)Step-by-step process overview
RULE-19-1andM0-2-1to add"shared_implementation_short_name"(existing)"short_name":ObjectAssignedToAnOverlappingObjectRepresentation"shared_implementation_short_name":ObjectAssignedToAnOverlappingObject"short_name":"ObjectAssignedToAnOverlappingObjectAutosarCpp"(existing)"short_name"1:ObjectAssignedToAnOverlappingObject"short_name"2:ObjectCopiedToAnOverlappingObjectContracts7"shared_implementation_short_name"1:ObjectAssignedToAnOverlappingObject"shared_implementation_short_name"2:ObjectCopiedToAnOverlappingObject"short_name"1:"ObjectAssignedToAnOverlappingObjectMisraC""short_name"2:"ObjectCopiedToAnOverlappingObjectMisraC"(new)Memory4"shared_implementation_short_name"1:ObjectAssignedToAnOverlappingObject"shared_implementation_short_name"2:ObjectCopiedToAnOverlappingObject"short_name"1:"ObjectAssignedToAnOverlappingObjectMisraCpp""short_name"2:"ObjectCopiedToAnOverlappingObjectMisraCpp"cpp/common/src/codingstandards/cpp/rules/objectassignedtoanoverlappingobject/ObjectAssignedToAnOverlappingObject.qllcpp/common/src/codingstandards/cpp/rules/objectcopiedtoanoverlappingobject/ObjectCopiedToAnOverlappingObject.qllfrom-where-selectinto aquery predicate problemin the file right above (step 4)cpp/common/src/codingstandards/cpp/rules/objectassignedtoanoverlappingobject/ObjectAssignedToAnOverlappingObject.qllcpp/common/src/codingstandards/cpp/rules/objectcopiedtoanoverlappingobject/ObjectCopiedToAnOverlappingObject.qllcpp/common/test/rules/objectassignedtoanoverlappingobject/test.cppcpp/common/test/rules/objectcopiedtoanoverlappingobject/test.cppChange request type
.ql,.qll,.qlsor unit tests)Rules with added or modified queries
RULE-8-18-1M0-2-1RULE-19-1Release 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.