Skip to content

M9-3-3: exclude deleted members #499

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

Merged
merged 3 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions change_notes/2024-01-25-exclusion-m9-3-3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
`M9-3-3` - `MemberFunctionConstIfPossible.ql`, `MemberFunctionStaticIfPossible.ql`:
- Fixes #413. Exclude deleted member functions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,6 @@ where
not f.callsNonConstOwnMember() and
not f.callsNonConstFromMemberVariable() and
not f.isOverride() and
not f.isFinal()
not f.isFinal() and
not f.isDeleted()
select f, "Member function can be declared as const."
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@ from NonStaticMemberFunction nonstatic
where
not isExcluded(nonstatic, ConstPackage::memberFunctionStaticIfPossibleQuery()) and
not exists(ThisExpr t | t.getEnclosingFunction() = nonstatic) and
not nonstatic.isVirtual()
not nonstatic.isVirtual() and
not nonstatic.isDeleted()
select nonstatic, "Member function can be declared as static."
4 changes: 4 additions & 0 deletions cpp/autosar/test/rules/M9-3-3/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,7 @@ class Z22 : Z1 {
void f2() final {} // COMPLIANT
void f3() { this->a = 100; } // COMPLIANT
};

class Z3 {
void f(int) = delete; // COMPLIANT
};