@@ -977,7 +977,7 @@ class IndexSwiftASTWalker : public SourceEntityWalker {
977
977
// / \param isImplicit Whether the reference is implicit, such as for a typealias' underlying type.
978
978
// / \param Loc The location of the reference, otherwise the location of the TypeLoc is used.
979
979
bool reportRelatedTypeRef (const TypeLoc &Ty, SymbolRoleSet Relations, Decl *Related,
980
- bool isImplicit=false , Optional< SourceLoc> Loc=Optional<SourceLoc>() );
980
+ bool isImplicit=false , SourceLoc Loc={} );
981
981
bool reportInheritedTypeRefs (
982
982
ArrayRef<InheritedEntry> Inherited, Decl *Inheritee);
983
983
NominalTypeDecl *getTypeLocAsNominalTypeDecl (const TypeLoc &Ty);
@@ -1394,16 +1394,17 @@ bool IndexSwiftASTWalker::reportInheritedTypeRefs(ArrayRef<InheritedEntry> Inher
1394
1394
}
1395
1395
1396
1396
bool IndexSwiftASTWalker::reportRelatedTypeRef (const TypeLoc &Ty, SymbolRoleSet Relations,
1397
- Decl *Related, bool Implicit, Optional< SourceLoc> Loc) {
1397
+ Decl *Related, bool Implicit, SourceLoc Loc) {
1398
1398
if (auto *composite = llvm::dyn_cast_or_null<CompositionTypeRepr>(Ty.getTypeRepr ())) {
1399
- SourceLoc IdLoc = Loc.value_or ( composite->getSourceLoc () );
1400
- for (auto *Type : composite->getTypes ())
1399
+ SourceLoc IdLoc = Loc.isValid () ? Loc : composite->getSourceLoc ();
1400
+ for (auto *Type : composite->getTypes ()) {
1401
1401
if (!reportRelatedTypeRef (Type, Relations, Related, /* isImplicit=*/ Implicit, IdLoc))
1402
1402
return false ;
1403
+ }
1403
1404
1404
1405
return true ;
1405
1406
} else if (auto *declRefTR = dyn_cast_or_null<DeclRefTypeRepr>(Ty.getTypeRepr ())) {
1406
- SourceLoc IdLoc = Loc.value_or ( declRefTR->getLoc () );
1407
+ SourceLoc IdLoc = Loc.isValid () ? Loc : declRefTR->getLoc ();
1407
1408
NominalTypeDecl *NTD = nullptr ;
1408
1409
bool isImplicit = Implicit;
1409
1410
if (auto *VD = declRefTR->getBoundDecl ()) {
0 commit comments