Skip to content

Commit 14a0431

Browse files
authored
Merge pull request #472 from github/lcartey/remove-old-is-excluded
Fix deviations through use of deprecated `isExcluded` predicates
2 parents 033dc61 + 93f6cdc commit 14a0431

15 files changed

+19
-24
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- The following queries have been updated to address issues with applying deviations:
2+
- `A18-5-11`, `A23-0-1`, `A9-3-1`, `M0-1-2`, `M3-1-2`, `M3-2-1`, `M3-2-3`, `M3-9-1`, `M4-5-3`, `M5-0-2`, `M5-2-10`, `A23-0-2`, `CTR51-CPP`, `STR52-CPP`

cpp/autosar/src/rules/A18-5-11/OperatorNewAndOperatorDeleteNotDefinedLocally.ql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ import codingstandards.cpp.autosar
1919

2020
from MemberFunction operator_new, Class c
2121
where
22-
not isExcluded(operator_new) and
22+
not isExcluded(operator_new,
23+
DeclarationsPackage::operatorNewAndOperatorDeleteNotDefinedLocallyQuery()) and
2324
not isExcluded(c, DeclarationsPackage::operatorNewAndOperatorDeleteNotDefinedLocallyQuery()) and
2425
operator_new.hasName("operator new") and
2526
operator_new.getDeclaringType() = c and

cpp/autosar/src/rules/A23-0-1/IteratorImplicitlyConvertedToConstIterator.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ import codingstandards.cpp.Iterators
4040

4141
from ConstIteratorVariable v, STLContainer c, Expr e
4242
where
43-
not isExcluded(v) and
44-
not isExcluded(e) and
43+
not isExcluded(v, IteratorsPackage::iteratorImplicitlyConvertedToConstIteratorQuery()) and
44+
not isExcluded(e, IteratorsPackage::iteratorImplicitlyConvertedToConstIteratorQuery()) and
4545
e = v.getAnAssignedValue() and
4646
e.getAChild*() = /* see note at top of query */ c.getANonConstIteratorFunctionCall()
4747
select e, "Non-const version of container call immediately converted to a `const_iterator`."

cpp/autosar/src/rules/A9-3-1/ReturnsNonConstRawPointersOrReferencesToPrivateOrProtectedData.ql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ class AccessAwareMemberFunction extends MemberFunction {
5757

5858
from Class c, AccessAwareMemberFunction mf, FieldAccess a, ReturnStmt rs
5959
where
60-
not isExcluded(c) and
60+
not isExcluded(c,
61+
ClassesPackage::returnsNonConstRawPointersOrReferencesToPrivateOrProtectedDataQuery()) and
6162
not isExcluded(mf,
6263
ClassesPackage::returnsNonConstRawPointersOrReferencesToPrivateOrProtectedDataQuery()) and
6364
// Find all of the methods within this class

cpp/autosar/src/rules/M0-1-2/InfeasiblePath.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,6 @@ predicate hasInfeasiblePath(
158158

159159
from ConditionalControlFlowNode cond, boolean infeasiblePath, string explanation
160160
where
161-
not isExcluded(cond) and
161+
not isExcluded(cond, DeadCodePackage::infeasiblePathQuery()) and
162162
hasInfeasiblePath(cond, infeasiblePath, explanation)
163163
select cond, "The " + infeasiblePath + " path is infeasible because " + explanation + "."

cpp/autosar/src/rules/M3-1-2/FunctionsDeclaredAtBlockScope.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import codingstandards.cpp.autosar
2020

2121
from DeclStmt decl, Function f
2222
where
23-
not isExcluded(decl) and
23+
not isExcluded(decl, DeclarationsPackage::functionsDeclaredAtBlockScopeQuery()) and
2424
not isExcluded(f, DeclarationsPackage::functionsDeclaredAtBlockScopeQuery()) and
2525
decl.getADeclaration() = f
2626
select f, "Function " + f.getName() + " is declared at block scope."

cpp/autosar/src/rules/M3-2-1/DeclarationsOfAFunctionShallHaveCompatibleTypes.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import codingstandards.cpp.Typehelpers
2222

2323
from FunctionDeclarationEntry f1, FunctionDeclarationEntry f2
2424
where
25-
not isExcluded(f1) and
25+
not isExcluded(f1, DeclarationsPackage::declarationsOfAFunctionShallHaveCompatibleTypesQuery()) and
2626
not isExcluded(f2, DeclarationsPackage::declarationsOfAFunctionShallHaveCompatibleTypesQuery()) and
2727
not f1 = f2 and
2828
f1.getDeclaration() = f2.getDeclaration() and

cpp/autosar/src/rules/M3-2-3/MultipleDeclarationViolation.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import codingstandards.cpp.Scope
2020

2121
from DeclarationEntry de, DeclarationEntry otherDeclaration, string kind
2222
where
23-
not isExcluded(de) and
23+
not isExcluded(de, ScopePackage::multipleDeclarationViolationQuery()) and
2424
exists(Declaration d |
2525
de.getDeclaration() = d and
2626
otherDeclaration.getDeclaration() = d and

cpp/autosar/src/rules/M3-9-1/TypesNotIdenticalInObjectDeclarations.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import codingstandards.cpp.autosar
1818

1919
from VariableDeclarationEntry decl1, VariableDeclarationEntry decl2
2020
where
21-
not isExcluded(decl1) and
21+
not isExcluded(decl1, DeclarationsPackage::typesNotIdenticalInObjectDeclarationsQuery()) and
2222
not isExcluded(decl2, DeclarationsPackage::typesNotIdenticalInObjectDeclarationsQuery()) and
2323
decl1.getDeclaration() = decl2.getDeclaration() and
2424
not decl1.getType() = decl2.getType()

cpp/autosar/src/rules/M3-9-1/TypesNotIdenticalInReturnDeclarations.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import codingstandards.cpp.autosar
1818

1919
from FunctionDeclarationEntry f1, FunctionDeclarationEntry f2
2020
where
21-
not isExcluded(f1) and
21+
not isExcluded(f1, DeclarationsPackage::typesNotIdenticalInReturnDeclarationsQuery()) and
2222
not isExcluded(f2, DeclarationsPackage::typesNotIdenticalInReturnDeclarationsQuery()) and
2323
f1.getDeclaration() = f2.getDeclaration() and
2424
not f1.getType() = f2.getType()

0 commit comments

Comments
 (0)