[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

@@ -1143,7 +1143,7 @@ public:
bool visitDeclReference(ValueDecl *D, CharSourceRange Range,
TypeDecl *CtorTyRef, ExtensionDecl *ExtTyRef, Type Ty,
ReferenceMetaData Data) override {
if (Data.isImplicit)
if (Data.isImplicit || !Range.isValid())
return true;
unsigned StartOffset = getOffset(Range.getStart());
References.emplace_back(D, StartOffset, Range.getByteLength(), Ty);