Skip to content

Commit 20d9dd6

Browse files
committed
IdentifierHidden: move type exclusion to rule not userdecl type, and omit intentional overloads
1 parent fff63e6 commit 20d9dd6

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

cpp/common/src/codingstandards/cpp/Scope.qll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ class UserDeclaration extends Declaration {
7171
not this instanceof ClassTemplateInstantiation and
7272
// compiler inferred parameters have name of p#0
7373
not this.(Parameter).getName() = "p#0"
74-
and not this instanceof Type
7574
}
7675
}
7776

@@ -275,6 +274,8 @@ predicate hides(UserDeclaration v1, UserDeclaration v2) {
275274
hides_candidate(v1, mid) and
276275
hides_candidate(mid, v2)
277276
)
277+
//ignore intentional overloads
278+
and not v1.(Function).getAnOverload() = v2
278279
}
279280

280281
/** Holds if `v2` strictly (`v2` is in an inner scope compared to `v1`) hides `v1`. */

cpp/common/src/codingstandards/cpp/rules/identifierhidden/IdentifierHidden.qll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ query predicate problems(UserDeclaration v2, string message, UserDeclaration v1,
1717
//ignore template variables for this rule
1818
not v1 instanceof TemplateVariable and
1919
not v2 instanceof TemplateVariable and
20+
//ignore types for this rule
21+
not v2 instanceof Type and
22+
not v1 instanceof Type and
2023
hidesStrict(v1, v2) and
2124
not excludedViaNestedNamespaces(v2, v1) and
2225
varName = v1.getName() and

0 commit comments

Comments
 (0)