Skip to content

Commit 41bc7b3

Browse files
committed
no optional
1 parent 14d50ca commit 41bc7b3

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

lib/Index/Index.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -977,7 +977,7 @@ class IndexSwiftASTWalker : public SourceEntityWalker {
977977
/// \param isImplicit Whether the reference is implicit, such as for a typealias' underlying type.
978978
/// \param Loc The location of the reference, otherwise the location of the TypeLoc is used.
979979
bool reportRelatedTypeRef(const TypeLoc &Ty, SymbolRoleSet Relations, Decl *Related,
980-
bool isImplicit=false, Optional<SourceLoc> Loc=Optional<SourceLoc>());
980+
bool isImplicit=false, SourceLoc Loc={});
981981
bool reportInheritedTypeRefs(
982982
ArrayRef<InheritedEntry> Inherited, Decl *Inheritee);
983983
NominalTypeDecl *getTypeLocAsNominalTypeDecl(const TypeLoc &Ty);
@@ -1394,16 +1394,17 @@ bool IndexSwiftASTWalker::reportInheritedTypeRefs(ArrayRef<InheritedEntry> Inher
13941394
}
13951395

13961396
bool IndexSwiftASTWalker::reportRelatedTypeRef(const TypeLoc &Ty, SymbolRoleSet Relations,
1397-
Decl *Related, bool Implicit, Optional<SourceLoc> Loc) {
1397+
Decl *Related, bool Implicit, SourceLoc Loc) {
13981398
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()) {
14011401
if (!reportRelatedTypeRef(Type, Relations, Related, /*isImplicit=*/Implicit, IdLoc))
14021402
return false;
1403+
}
14031404

14041405
return true;
14051406
} 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();
14071408
NominalTypeDecl *NTD = nullptr;
14081409
bool isImplicit = Implicit;
14091410
if (auto *VD = declRefTR->getBoundDecl()) {

0 commit comments

Comments
 (0)