@@ -89,8 +89,8 @@ class CursorInfoResolver : public SourceEntityWalker {
89
89
bool walkToDeclPost (Decl *D) override ;
90
90
bool walkToStmtPre (Stmt *S) override ;
91
91
bool walkToStmtPost (Stmt *S) override ;
92
- bool visitDeclReference (ValueDecl *D, CharSourceRange Range,
93
- TypeDecl *CtorTyRef, ExtensionDecl *ExtTyRef, Type T,
92
+ bool visitDeclReference (ValueDecl *D, SourceRange Range, TypeDecl *CtorTyRef ,
93
+ ExtensionDecl *ExtTyRef, Type T,
94
94
ReferenceMetaData Data) override ;
95
95
bool visitCallArgName (Identifier Name, CharSourceRange Range,
96
96
ValueDecl *D) override ;
@@ -105,7 +105,7 @@ class CursorInfoResolver : public SourceEntityWalker {
105
105
std::optional<ReferenceMetaData> Data = std::nullopt);
106
106
bool tryResolve (ModuleEntity Mod, SourceLoc Loc);
107
107
bool tryResolve (Stmt *St);
108
- bool visitSubscriptReference (ValueDecl *D, CharSourceRange Range,
108
+ bool visitSubscriptReference (ValueDecl *D, SourceRange Range,
109
109
ReferenceMetaData Data,
110
110
bool IsOpenBracket) override ;
111
111
};
@@ -210,7 +210,7 @@ bool CursorInfoResolver::tryResolve(Stmt *St) {
210
210
}
211
211
212
212
bool CursorInfoResolver::visitSubscriptReference (ValueDecl *D,
213
- CharSourceRange Range,
213
+ SourceRange Range,
214
214
ReferenceMetaData Data,
215
215
bool IsOpenBracket) {
216
216
// We should treat both open and close brackets equally
@@ -301,16 +301,16 @@ bool CursorInfoResolver::walkToStmtPost(Stmt *S) {
301
301
return true ;
302
302
}
303
303
304
- bool CursorInfoResolver::visitDeclReference (ValueDecl *D,
305
- CharSourceRange Range,
304
+ bool CursorInfoResolver::visitDeclReference (ValueDecl *D, SourceRange Range,
306
305
TypeDecl *CtorTyRef,
307
306
ExtensionDecl *ExtTyRef, Type T,
308
307
ReferenceMetaData Data) {
309
308
if (isDone ())
310
309
return false ;
311
310
if (Data.isImplicit || !Range.isValid ())
312
311
return true ;
313
- return !tryResolve (D, CtorTyRef, ExtTyRef, Range.getStart (), /* IsRef=*/ true , T, Data);
312
+ return !tryResolve (D, CtorTyRef, ExtTyRef, Range.Start , /* IsRef=*/ true , T,
313
+ Data);
314
314
}
315
315
316
316
static bool isCursorOn (Expr *E, SourceLoc Loc) {
@@ -461,8 +461,8 @@ class RangeResolver : public SourceEntityWalker {
461
461
bool walkToStmtPost (Stmt *S) override ;
462
462
bool walkToDeclPre (Decl *D, CharSourceRange Range) override ;
463
463
bool walkToDeclPost (Decl *D) override ;
464
- bool visitDeclReference (ValueDecl *D, CharSourceRange Range,
465
- TypeDecl *CtorTyRef, ExtensionDecl *ExtTyRef, Type T,
464
+ bool visitDeclReference (ValueDecl *D, SourceRange Range, TypeDecl *CtorTyRef ,
465
+ ExtensionDecl *ExtTyRef, Type T,
466
466
ReferenceMetaData Data) override ;
467
467
ResolvedRangeInfo moveArrayToASTContext (ResolvedRangeInfo Info);
468
468
public:
@@ -799,12 +799,13 @@ struct RangeResolver::Implementation {
799
799
Impl->analyzeDecl (D);
800
800
return true ;
801
801
}
802
- bool visitDeclReference (ValueDecl *D, CharSourceRange Range,
803
- TypeDecl *CtorTyRef, ExtensionDecl *ExtTyRef, Type T,
804
- ReferenceMetaData Data) override {
805
- Impl->analyzeDeclRef (D, Range.getStart () , T, Data);
802
+ bool visitDeclReference (ValueDecl *D, SourceRange Range,
803
+ TypeDecl *CtorTyRef, ExtensionDecl *ExtTyRef,
804
+ Type T, ReferenceMetaData Data) override {
805
+ Impl->analyzeDeclRef (D, Range.Start , T, Data);
806
806
return true ;
807
807
}
808
+
808
809
public:
809
810
CompleteWalker (Implementation *Impl) : Impl(Impl) {}
810
811
};
@@ -813,11 +814,11 @@ struct RangeResolver::Implementation {
813
814
// / decls in the range is referenced after it.
814
815
class FurtherReferenceWalker : public SourceEntityWalker {
815
816
Implementation *Impl;
816
- bool visitDeclReference (ValueDecl *D, CharSourceRange Range,
817
- TypeDecl *CtorTyRef, ExtensionDecl *ExtTyRef, Type T,
818
- ReferenceMetaData Data) override {
817
+ bool visitDeclReference (ValueDecl *D, SourceRange Range,
818
+ TypeDecl *CtorTyRef, ExtensionDecl *ExtTyRef,
819
+ Type T, ReferenceMetaData Data) override {
819
820
// If the reference is after the given range, continue logic.
820
- if (!Impl->SM .isBeforeInBuffer (Impl->End , Range.getStart () ))
821
+ if (!Impl->SM .isBeforeInBuffer (Impl->End , Range.Start ))
821
822
return true ;
822
823
823
824
// If the referenced decl is declared in the range, than the declared decl
@@ -829,6 +830,7 @@ struct RangeResolver::Implementation {
829
830
}
830
831
return true ;
831
832
}
833
+
832
834
public:
833
835
FurtherReferenceWalker (Implementation *Impl) : Impl(Impl) {}
834
836
};
@@ -1140,11 +1142,11 @@ bool RangeResolver::walkToDeclPost(Decl *D) {
1140
1142
return !Impl->hasResult ();
1141
1143
}
1142
1144
1143
-
1144
- bool RangeResolver::
1145
- visitDeclReference (ValueDecl *D, CharSourceRange Range, TypeDecl *CtorTyRef ,
1146
- ExtensionDecl *ExtTyRef, Type T, ReferenceMetaData Data) {
1147
- Impl->analyzeDeclRef (D, Range.getStart () , T, Data);
1145
+ bool RangeResolver::visitDeclReference (ValueDecl *D, SourceRange Range,
1146
+ TypeDecl *CtorTyRef,
1147
+ ExtensionDecl *ExtTyRef, Type T ,
1148
+ ReferenceMetaData Data) {
1149
+ Impl->analyzeDeclRef (D, Range.Start , T, Data);
1148
1150
return true ;
1149
1151
}
1150
1152
0 commit comments