Skip to content

Commit 27b6ed3

Browse files
authored
Merge pull request #1822 from pavgust/fix/multiloc-defs
definitions.qll: Suppress multi-location links.
2 parents c276d0b + b9b0c3b commit 27b6ed3

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cpp/ql/src/definitions.qll

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,5 +208,13 @@ Top definitionOf(Top e, string kind) {
208208
// It's possible we could allow a subset of these dependencies
209209
// in future, if we're careful to ensure the above don't apply.
210210
not e.isFromTemplateInstantiation(_)
211+
) and (
212+
// Some entities have many locations. This can arise for an external
213+
// function that is frequently declared but not defined, or perhaps
214+
// for a struct type that is declared in many places. Rather than
215+
// letting the result set explode, we just exclude results that are
216+
// "too ambiguous" -- we could also arbitrarily pick one location
217+
// later on.
218+
strictcount(result.getLocation()) < 10
211219
)
212220
}

0 commit comments

Comments
 (0)