[SourceKit] Ignore references without a location

A keypath using dynamic member lookup results in various `KeyPathExpr`
that have components with no location. Ignore these and any other
references that have a missing location.

Resolves rdar://85237365
This commit is contained in:
Ben Barham
2021-11-10 14:46:01 +10:00
parent ce77849aff
commit f6db91e3f9
9 changed files with 241 additions and 3 deletions

View File

@@ -959,6 +959,9 @@ public:
}
void annotate(const Decl *D, bool IsRef, CharSourceRange Range) {
if (!Range.isValid())
return;
unsigned ByteOffset = SM.getLocOffsetInBuffer(Range.getStart(), BufferID);
unsigned Length = Range.getByteLength();
auto Kind = CodeCompletionResult::getCodeCompletionDeclKind(D);