Skip to content

Commit ac27623

Browse files
committed
M14-6-1: Handle overloading
Previously the logic of this query asserted that the function call did not target the selected function in the dependent base type with the same name. In theory this is wrong, as overloading can permit multiple functions declarations with the same name, but different signatures, so we now say that the target is not declared on the same base type. In practice, such results would be excluded because to call an overload of the same function would always have a qualifier in this case, however this logic makes the intention clearer.
1 parent e5b9d15 commit ac27623

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

cpp/autosar/src/rules/M14-6-1/NameInDependentBase.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ TemplateClass getADependentBaseType(TemplateClass t) {
2424
FunctionCall parentMemberFunctionCall(TemplateClass t) {
2525
exists(TemplateClass dependentBaseType, MemberFunction dependentTypeFunction, Function target |
2626
dependentBaseType = getADependentBaseType(t) and
27-
not target = dependentTypeFunction and
27+
not target.getDeclaringType() = dependentBaseType and
2828
dependentBaseType.getAMember() = dependentTypeFunction and
2929
target.getName() = dependentTypeFunction.getName() and
3030
result = target.getACallToThisFunction() and
@@ -39,7 +39,7 @@ FunctionCall parentMemberFunctionCall(TemplateClass t) {
3939
FunctionAccess parentMemberFunctionAccess(TemplateClass t) {
4040
exists(TemplateClass dependentBaseType, MemberFunction dependentTypeFunction, Function target |
4141
dependentBaseType = getADependentBaseType(t) and
42-
not target = dependentTypeFunction and
42+
not target.getDeclaringType() = dependentBaseType and
4343
dependentBaseType.getAMember() = dependentTypeFunction and
4444
target.getName() = dependentTypeFunction.getName() and
4545
result = target.getAnAccess() and
@@ -56,7 +56,7 @@ Access parentMemberAccess(TemplateClass t) {
5656
TemplateClass dependentBaseType, MemberVariable dependentTypeMemberVariable, Variable target
5757
|
5858
dependentBaseType = getADependentBaseType(t) and
59-
not target = dependentTypeMemberVariable and
59+
not target.getDeclaringType() = dependentBaseType and
6060
dependentBaseType.getAMemberVariable() = dependentTypeMemberVariable and
6161
target.getName() = dependentTypeMemberVariable.getName() and
6262
result = target.getAnAccess() and

0 commit comments

Comments
 (0)