diff --git a/cpp/ql/src/definitions.qll b/cpp/ql/src/definitions.qll index b11b18fe7a0b..d4840350dd8d 100644 --- a/cpp/ql/src/definitions.qll +++ b/cpp/ql/src/definitions.qll @@ -208,5 +208,13 @@ Top definitionOf(Top e, string kind) { // It's possible we could allow a subset of these dependencies // in future, if we're careful to ensure the above don't apply. not e.isFromTemplateInstantiation(_) + ) and ( + // Some entities have many locations. This can arise for an external + // function that is frequently declared but not defined, or perhaps + // for a struct type that is declared in many places. Rather than + // letting the result set explode, we just exclude results that are + // "too ambiguous" -- we could also arbitrarily pick one location + // later on. + strictcount(result.getLocation()) < 10 ) }