From b9b0c3bc5d0c63d91cf3a732ec82f800247da78d Mon Sep 17 00:00:00 2001 From: Pavel Avgustinov Date: Sun, 25 Aug 2019 15:59:17 +0100 Subject: [PATCH] definitions.qll: Suppress multi-location links. --- cpp/ql/src/definitions.qll | 8 ++++++++ 1 file changed, 8 insertions(+) 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 ) }