Skip to content

Commit 01f8293

Browse files
authored
Merge pull request #499 from knewbury01/knewbury01/M9-3-3-fp
M9-3-3: exclude deleted members
2 parents be2db41 + 55b7338 commit 01f8293

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
`M9-3-3` - `MemberFunctionConstIfPossible.ql`, `MemberFunctionStaticIfPossible.ql`:
2+
- Fixes #413. Exclude deleted member functions.

cpp/autosar/src/rules/M9-3-3/MemberFunctionConstIfPossible.ql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,5 +121,6 @@ where
121121
not f.callsNonConstOwnMember() and
122122
not f.callsNonConstFromMemberVariable() and
123123
not f.isOverride() and
124-
not f.isFinal()
124+
not f.isFinal() and
125+
not f.isDeleted()
125126
select f, "Member function can be declared as const."

cpp/autosar/src/rules/M9-3-3/MemberFunctionStaticIfPossible.ql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,6 @@ from NonStaticMemberFunction nonstatic
3939
where
4040
not isExcluded(nonstatic, ConstPackage::memberFunctionStaticIfPossibleQuery()) and
4141
not exists(ThisExpr t | t.getEnclosingFunction() = nonstatic) and
42-
not nonstatic.isVirtual()
42+
not nonstatic.isVirtual() and
43+
not nonstatic.isDeleted()
4344
select nonstatic, "Member function can be declared as static."

cpp/autosar/test/rules/M9-3-3/test.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,3 +161,7 @@ class Z22 : Z1 {
161161
void f2() final {} // COMPLIANT
162162
void f3() { this->a = 100; } // COMPLIANT
163163
};
164+
165+
class Z3 {
166+
void f(int) = delete; // COMPLIANT
167+
};

0 commit comments

Comments
 (0)