Skip to content

Commit d280ae4

Browse files
committed
Sema: Replace a lookupUnqualifiedType() with lookupInModule()
1 parent 3956fc0 commit d280ae4

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

lib/Sema/TypeCheckAttr.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "swift/AST/DiagnosticsParse.h"
2424
#include "swift/AST/GenericEnvironment.h"
2525
#include "swift/AST/GenericSignatureBuilder.h"
26+
#include "swift/AST/ModuleNameLookup.h"
2627
#include "swift/AST/NameLookup.h"
2728
#include "swift/AST/NameLookupRequests.h"
2829
#include "swift/AST/ParameterList.h"
@@ -1612,15 +1613,13 @@ void AttributeChecker::checkApplicationMainAttribute(DeclAttribute *attr,
16121613
auto KitModule = C.getLoadedModule(Id_Kit);
16131614
ProtocolDecl *ApplicationDelegateProto = nullptr;
16141615
if (KitModule) {
1615-
auto lookupOptions = defaultUnqualifiedLookupOptions;
1616-
lookupOptions |= NameLookupFlags::KnownPrivate;
1617-
1618-
auto lookup = TC.lookupUnqualifiedType(KitModule, Id_ApplicationDelegate,
1619-
SourceLoc(),
1620-
lookupOptions);
1621-
if (lookup.size() == 1)
1622-
ApplicationDelegateProto = dyn_cast<ProtocolDecl>(
1623-
lookup[0].getValueDecl());
1616+
SmallVector<ValueDecl *, 1> decls;
1617+
namelookup::lookupInModule(KitModule, Id_ApplicationDelegate,
1618+
decls, NLKind::QualifiedLookup,
1619+
namelookup::ResolutionKind::TypesOnly,
1620+
KitModule);
1621+
if (decls.size() == 1)
1622+
ApplicationDelegateProto = dyn_cast<ProtocolDecl>(decls[0]);
16241623
}
16251624

16261625
if (!ApplicationDelegateProto ||

0 commit comments

Comments
 (0)