@@ -1014,8 +1014,7 @@ void SourceFile::setSyntaxRoot(syntax::SourceFileSyntax &&Root) {
10141014
10151015template <typename OP_DECL>
10161016static Optional<OP_DECL *>
1017- lookupOperatorDeclForName (ModuleDecl *M, SourceLoc Loc, Identifier Name,
1018- OperatorMap<OP_DECL *> SourceFile::*OP_MAP);
1017+ lookupOperatorDeclForName (ModuleDecl *M, SourceLoc Loc, Identifier Name);
10191018
10201019template <typename OP_DECL>
10211020using ImportedOperatorsMap = llvm::SmallDenseMap<OP_DECL*, bool , 16 >;
@@ -1066,8 +1065,7 @@ checkOperatorConflicts(const SourceFile &SF, SourceLoc loc,
10661065template <typename OP_DECL>
10671066static Optional<OP_DECL *>
10681067lookupOperatorDeclForName (const FileUnit &File, SourceLoc Loc,
1069- Identifier Name, bool includePrivate,
1070- OperatorMap<OP_DECL *> SourceFile::*OP_MAP) {
1068+ Identifier Name, bool includePrivate) {
10711069 switch (File.getKind ()) {
10721070 case FileUnitKind::Builtin:
10731071 // The Builtin module declares no operators.
@@ -1084,6 +1082,7 @@ lookupOperatorDeclForName(const FileUnit &File, SourceLoc Loc,
10841082 assert (SF.ASTStage >= SourceFile::NameBound);
10851083
10861084 // Look for an operator declaration in the current module.
1085+ const auto OP_MAP = OperatorLookup<OP_DECL>::map_ptr;
10871086 auto found = (SF.*OP_MAP).find (Name);
10881087 if (found != (SF.*OP_MAP).end () && (includePrivate || found->second .getInt ()))
10891088 return found->second .getPointer ();
@@ -1105,7 +1104,7 @@ lookupOperatorDeclForName(const FileUnit &File, SourceLoc Loc,
11051104 continue ;
11061105
11071106 Optional<OP_DECL *> maybeOp =
1108- lookupOperatorDeclForName (imported.module .second , Loc, Name, OP_MAP );
1107+ lookupOperatorDeclForName<OP_DECL> (imported.module .second , Loc, Name);
11091108 if (!maybeOp)
11101109 return None;
11111110
@@ -1138,12 +1137,10 @@ lookupOperatorDeclForName(const FileUnit &File, SourceLoc Loc,
11381137
11391138template <typename OP_DECL>
11401139static Optional<OP_DECL *>
1141- lookupOperatorDeclForName (ModuleDecl *M, SourceLoc Loc, Identifier Name,
1142- OperatorMap<OP_DECL *> SourceFile::*OP_MAP)
1143- {
1140+ lookupOperatorDeclForName (ModuleDecl *M, SourceLoc Loc, Identifier Name) {
11441141 OP_DECL *result = nullptr ;
11451142 for (const FileUnit *File : M->getFiles ()) {
1146- auto next = lookupOperatorDeclForName (*File, Loc, Name, false , OP_MAP );
1143+ auto next = lookupOperatorDeclForName<OP_DECL> (*File, Loc, Name, false );
11471144 if (!next.hasValue ())
11481145 return next;
11491146
@@ -1159,9 +1156,9 @@ lookupOperatorDeclForName(ModuleDecl *M, SourceLoc Loc, Identifier Name,
11591156template <typename OperatorType>
11601157llvm::Expected<OperatorType *> LookupOperatorRequest<OperatorType>::evaluate(
11611158 Evaluator &evaluator, OperatorLookupDescriptor desc) const {
1162- auto result = lookupOperatorDeclForName (*desc.SF , desc.diagLoc , desc. name ,
1163- /* includePrivate */ true ,
1164- OperatorLookup<OperatorType>::map_ptr );
1159+ auto result = lookupOperatorDeclForName<OperatorType> (*desc.SF , desc.diagLoc ,
1160+ desc. name ,
1161+ /* includePrivate */ true );
11651162 if (!result.hasValue ())
11661163 return nullptr ;
11671164 if (auto *tracker = desc.SF ->getReferencedNameTracker ()) {
@@ -1172,9 +1169,9 @@ llvm::Expected<OperatorType *> LookupOperatorRequest<OperatorType>::evaluate(
11721169 }
11731170 }
11741171 if (!result.getValue ()) {
1175- result = lookupOperatorDeclForName (desc.SF ->getParentModule (), desc. diagLoc ,
1176- desc.name ,
1177- OperatorLookup<OperatorType>::map_ptr );
1172+ result = lookupOperatorDeclForName<OperatorType> (desc.SF ->getParentModule (),
1173+ desc.diagLoc ,
1174+ desc. name );
11781175 }
11791176 return result.hasValue () ? result.getValue () : nullptr ;
11801177}
@@ -1183,7 +1180,7 @@ llvm::Expected<OperatorType *> LookupOperatorRequest<OperatorType>::evaluate(
11831180#define LOOKUP_OPERATOR (Kind ) \
11841181 Kind##Decl *ModuleDecl::lookup##Kind(Identifier name, SourceLoc loc) { \
11851182 auto result = \
1186- lookupOperatorDeclForName (this , loc, name, &SourceFile::Kind##s); \
1183+ lookupOperatorDeclForName<Kind##Decl> (this , loc, name); \
11871184 return result ? *result : nullptr ; \
11881185 } \
11891186 template llvm::Expected<Kind##Decl *> \
0 commit comments