Skip to content

Commit 134982c

Browse files
committed
C++: Respond to review comments.
1 parent 454605b commit 134982c

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

cpp/ql/src/semmle/code/cpp/Function.qll

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -391,14 +391,19 @@ class Function extends Declaration, ControlFlowNode, AccessHolder, @function {
391391
/** Holds if this function has a `noexcept` exception specification. */
392392
predicate isNoExcept() { getADeclarationEntry().isNoExcept() }
393393

394-
/** Gets a function that overloads this one. */
394+
/**
395+
* Gets a function that overloads this one.
396+
*
397+
* Note: if _overrides_ are wanted rather than _overloads_ then
398+
* `MemberFunction::getAnOverridingFunction` should be used instead.
399+
*/
395400
Function getAnOverload() {
396401
(
397402
// If this function is declared in a class, only consider other
398403
// functions from the same class.
399-
exists(string name, Namespace namespace, Class declaringType |
400-
candGetAnOverloadMember(name, namespace, declaringType, this) and
401-
candGetAnOverloadMember(name, namespace, declaringType, result)
404+
exists(string name, Class declaringType |
405+
candGetAnOverloadMember(name, declaringType, this) and
406+
candGetAnOverloadMember(name, declaringType, result)
402407
)
403408
or
404409
// Conversely, if this function is not
@@ -468,11 +473,8 @@ class Function extends Declaration, ControlFlowNode, AccessHolder, @function {
468473
}
469474

470475
pragma[noinline]
471-
private predicate candGetAnOverloadMember(
472-
string name, Namespace namespace, Class declaringType, Function f
473-
) {
476+
private predicate candGetAnOverloadMember(string name, Class declaringType, Function f) {
474477
f.getName() = name and
475-
f.getNamespace() = namespace and
476478
f.getDeclaringType() = declaringType
477479
}
478480

0 commit comments

Comments
 (0)