Skip to content

Commit 37d9bd9

Browse files
committed
Merge branch 'knewbury01/fix-118' of https://github.com/knewbury01/codeql-coding-standards into knewbury01/fix-118
2 parents 5606a6c + 3d2e413 commit 37d9bd9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class UserDeclaration extends Declaration {
6767
not this.(Variable).isCompilerGenerated() and
6868
not this.(Function).isCompilerGenerated() and
6969
not this.(Parameter).getFunction().isCompilerGenerated() and
70-
// will falsely conflict
70+
// Class template instantiations are compiler generated instances that share the same parent scope. This will result in a cross-product on class template instantiations because they have the same name and same parent scope. We therefore exclude these from consideration like we do with other compiler generated identifiers of interest.
7171
not this instanceof ClassTemplateInstantiation and
7272
// compiler inferred parameters have name of p#0
7373
not this.(Parameter).getName() = "p#0"
@@ -274,7 +274,7 @@ predicate hides(UserDeclaration v1, UserDeclaration v2) {
274274
hides_candidate(v1, mid) and
275275
hides_candidate(mid, v2)
276276
) and
277-
//ignore intentional overloads
277+
// Unlike `hidesStrict`, that requires a different scope, `hides` considers declarations in the same scope. This will include function overloads based on their name. To remove overloads from consideration, we exclude them.
278278
not v1.(Function).getAnOverload() = v2
279279
}
280280

0 commit comments

Comments
 (0)