From d4ac04d25e8edb54c3ef12ec7d97d2f5bbfa1712 Mon Sep 17 00:00:00 2001 From: Jordan Rose Date: Tue, 10 Sep 2019 09:13:20 -0700 Subject: [PATCH] Move access-path filtering into ModuleNameLookup (out of lookupValue) (#27097) Removes duplicated logic from the implementations of FileUnit::lookupValue, and simplifies the interface to ModuleDecl::lookupValue, where everyone was passing an empty (non-filtering) access path anyway /except/ during actual lookup from source code. No functionality change. --- include/swift/AST/Module.h | 11 +++---- include/swift/ClangImporter/ClangModule.h | 3 +- .../Serialization/SerializedModuleLoader.h | 3 +- lib/AST/ASTContext.cpp | 8 ++--- lib/AST/ASTDemangler.cpp | 4 +-- lib/AST/Module.cpp | 29 +++++++------------ lib/AST/ModuleNameLookup.cpp | 6 +++- lib/ClangImporter/ClangImporter.cpp | 6 +--- lib/ClangImporter/DWARFImporter.cpp | 12 +++----- lib/ClangImporter/ImportDecl.cpp | 2 +- lib/ClangImporter/ImportType.cpp | 8 ++--- lib/ClangImporter/ImporterImpl.h | 3 +- lib/IRGen/GenClangType.cpp | 2 +- lib/ParseSIL/ParseSIL.cpp | 7 ++--- lib/SILGen/SILGen.cpp | 2 +- lib/SILGen/SILGenGlobalVariable.cpp | 5 ++-- lib/Sema/InstrumenterSupport.cpp | 4 +-- lib/Sema/TypeCheckDecl.cpp | 2 +- lib/Sema/TypeCheckDeclObjC.cpp | 9 +++--- lib/Serialization/Serialization.cpp | 3 +- lib/Serialization/SerializedModuleLoader.cpp | 6 +--- 21 files changed, 52 insertions(+), 83 deletions(-) diff --git a/include/swift/AST/Module.h b/include/swift/AST/Module.h index dca007bd42f..f1b2298fbe9 100644 --- a/include/swift/AST/Module.h +++ b/include/swift/AST/Module.h @@ -361,7 +361,7 @@ public: /// within the current module. /// /// This does a simple local lookup, not recursively looking through imports. - void lookupValue(AccessPathTy AccessPath, DeclName Name, NLKind LookupKind, + void lookupValue(DeclName Name, NLKind LookupKind, SmallVectorImpl &Result) const; /// Look up a local type declaration by its mangled name. @@ -629,8 +629,7 @@ public: /// within this file. /// /// This does a simple local lookup, not recursively looking through imports. - virtual void lookupValue(ModuleDecl::AccessPathTy accessPath, DeclName name, - NLKind lookupKind, + virtual void lookupValue(DeclName name, NLKind lookupKind, SmallVectorImpl &result) const = 0; /// Look up a local type declaration by its mangled name. @@ -1056,8 +1055,7 @@ public: void cacheVisibleDecls(SmallVectorImpl &&globals) const; const SmallVectorImpl &getCachedVisibleDecls() const; - virtual void lookupValue(ModuleDecl::AccessPathTy accessPath, DeclName name, - NLKind lookupKind, + virtual void lookupValue(DeclName name, NLKind lookupKind, SmallVectorImpl &result) const override; virtual void lookupVisibleDecls(ModuleDecl::AccessPathTy accessPath, @@ -1281,8 +1279,7 @@ private: public: explicit BuiltinUnit(ModuleDecl &M); - virtual void lookupValue(ModuleDecl::AccessPathTy accessPath, DeclName name, - NLKind lookupKind, + virtual void lookupValue(DeclName name, NLKind lookupKind, SmallVectorImpl &result) const override; /// Find all Objective-C methods with the given selector. diff --git a/include/swift/ClangImporter/ClangModule.h b/include/swift/ClangImporter/ClangModule.h index 60ee6579d50..0e25a2afe1c 100644 --- a/include/swift/ClangImporter/ClangModule.h +++ b/include/swift/ClangImporter/ClangModule.h @@ -64,8 +64,7 @@ public: virtual bool isSystemModule() const override; - virtual void lookupValue(ModuleDecl::AccessPathTy accessPath, - DeclName name, NLKind lookupKind, + virtual void lookupValue(DeclName name, NLKind lookupKind, SmallVectorImpl &results) const override; virtual TypeDecl * diff --git a/include/swift/Serialization/SerializedModuleLoader.h b/include/swift/Serialization/SerializedModuleLoader.h index b419cda8db6..634483c323d 100644 --- a/include/swift/Serialization/SerializedModuleLoader.h +++ b/include/swift/Serialization/SerializedModuleLoader.h @@ -268,8 +268,7 @@ public: virtual bool isSystemModule() const override; - virtual void lookupValue(ModuleDecl::AccessPathTy accessPath, - DeclName name, NLKind lookupKind, + virtual void lookupValue(DeclName name, NLKind lookupKind, SmallVectorImpl &results) const override; virtual StringRef diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 96c917c0e6d..de53663bbc6 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -654,7 +654,7 @@ void ASTContext::lookupInSwiftModule( // Find all of the declarations with this name in the Swift module. auto identifier = getIdentifier(name); - M->lookupValue({ }, identifier, NLKind::UnqualifiedLookup, results); + M->lookupValue(identifier, NLKind::UnqualifiedLookup, results); } FuncDecl *ASTContext::getPlusFunctionOnRangeReplaceableCollection() const { @@ -832,7 +832,7 @@ StructDecl *ASTContext::getObjCBoolDecl() const { SmallVector results; auto *Context = const_cast(this); if (ModuleDecl *M = Context->getModuleByName(Id_ObjectiveC.str())) { - M->lookupValue({ }, getIdentifier("ObjCBool"), NLKind::UnqualifiedLookup, + M->lookupValue(getIdentifier("ObjCBool"), NLKind::UnqualifiedLookup, results); for (auto result : results) { if (auto structDecl = dyn_cast(result)) { @@ -899,7 +899,7 @@ ProtocolDecl *ASTContext::getProtocol(KnownProtocolKind kind) const { if (!M) return nullptr; - M->lookupValue({ }, getIdentifier(getProtocolName(kind)), + M->lookupValue(getIdentifier(getProtocolName(kind)), NLKind::UnqualifiedLookup, results); for (auto result : results) { @@ -3959,7 +3959,7 @@ static NominalTypeDecl *findUnderlyingTypeInModule(ASTContext &ctx, ModuleDecl *module) { // Find all of the declarations with this name in the Swift module. SmallVector results; - module->lookupValue({ }, name, NLKind::UnqualifiedLookup, results); + module->lookupValue(name, NLKind::UnqualifiedLookup, results); for (auto result : results) { if (auto nominal = dyn_cast(result)) return nominal; diff --git a/lib/AST/ASTDemangler.cpp b/lib/AST/ASTDemangler.cpp index 3d9f79ce1f6..fe0aaf70e22 100644 --- a/lib/AST/ASTDemangler.cpp +++ b/lib/AST/ASTDemangler.cpp @@ -97,11 +97,9 @@ ASTBuilder::createBuiltinType(StringRef builtinName, if (builtinName.startswith(BUILTIN_TYPE_NAME_PREFIX)) { SmallVector decls; - ModuleDecl::AccessPathTy accessPath; StringRef strippedName = builtinName.drop_front(BUILTIN_TYPE_NAME_PREFIX.size()); - Ctx.TheBuiltinModule->lookupValue(accessPath, - Ctx.getIdentifier(strippedName), + Ctx.TheBuiltinModule->lookupValue(Ctx.getIdentifier(strippedName), NLKind::QualifiedLookup, decls); diff --git a/lib/AST/Module.cpp b/lib/AST/Module.cpp index 801f3712a6a..bd33fc9c245 100644 --- a/lib/AST/Module.cpp +++ b/lib/AST/Module.cpp @@ -168,8 +168,8 @@ public: /// Throw away as much memory as possible. void invalidate(); - void lookupValue(AccessPathTy AccessPath, DeclName Name, - NLKind LookupKind, SmallVectorImpl &Result); + void lookupValue(DeclName Name, NLKind LookupKind, + SmallVectorImpl &Result); void lookupVisibleDecls(AccessPathTy AccessPath, VisibleDeclConsumer &Consumer, @@ -284,14 +284,8 @@ SourceLookupCache::SourceLookupCache(const ModuleDecl &M) { } } -void SourceLookupCache::lookupValue(AccessPathTy AccessPath, DeclName Name, - NLKind LookupKind, +void SourceLookupCache::lookupValue(DeclName Name, NLKind LookupKind, SmallVectorImpl &Result) { - // If this import is specific to some named type or decl ("import Swift.int") - // then filter out any lookups that don't match. - if (!ModuleDecl::matchesAccessPath(AccessPath, Name)) - return; - auto I = TopLevelValues.find(Name); if (I == TopLevelValues.end()) return; @@ -457,19 +451,18 @@ static bool isParsedModule(const ModuleDecl *mod) { cast(files[0])->Kind != SourceFileKind::SIL); } -void ModuleDecl::lookupValue(AccessPathTy AccessPath, DeclName Name, - NLKind LookupKind, +void ModuleDecl::lookupValue(DeclName Name, NLKind LookupKind, SmallVectorImpl &Result) const { auto *stats = getASTContext().Stats; if (stats) stats->getFrontendCounters().NumModuleLookupValue++; if (isParsedModule(this)) { - getSourceLookupCache().lookupValue(AccessPath, Name, LookupKind, Result); + getSourceLookupCache().lookupValue(Name, LookupKind, Result); return; } - FORWARD(lookupValue, (AccessPath, Name, LookupKind, Result)); + FORWARD(lookupValue, (Name, LookupKind, Result)); } TypeDecl * ModuleDecl::lookupLocalType(StringRef MangledName) const { @@ -517,7 +510,7 @@ void ModuleDecl::lookupMember(SmallVectorImpl &results, alreadyInPrivateContext = true; } else if (isa(containerDecl)) { assert(container == this); - this->lookupValue({}, name, NLKind::QualifiedLookup, results); + this->lookupValue(name, NLKind::QualifiedLookup, results); } else if (!isa(containerDecl)) { // If ExtensionDecl, then use ExtensionDecl::lookupDirect instead. llvm_unreachable("This context does not support lookup."); @@ -557,8 +550,7 @@ void ModuleDecl::lookupObjCMethods( FORWARD(lookupObjCMethods, (selector, results)); } -void BuiltinUnit::lookupValue(ModuleDecl::AccessPathTy accessPath, DeclName name, - NLKind lookupKind, +void BuiltinUnit::lookupValue(DeclName name, NLKind lookupKind, SmallVectorImpl &result) const { getCache().lookupValue(name.getBaseIdentifier(), lookupKind, *this, result); } @@ -569,10 +561,9 @@ void BuiltinUnit::lookupObjCMethods( // No @objc methods in the Builtin module. } -void SourceFile::lookupValue(ModuleDecl::AccessPathTy accessPath, DeclName name, - NLKind lookupKind, +void SourceFile::lookupValue(DeclName name, NLKind lookupKind, SmallVectorImpl &result) const { - getCache().lookupValue(accessPath, name, lookupKind, result); + getCache().lookupValue(name, lookupKind, result); } void ModuleDecl::lookupVisibleDecls(AccessPathTy AccessPath, diff --git a/lib/AST/ModuleNameLookup.cpp b/lib/AST/ModuleNameLookup.cpp index 263ba0edb25..500e8f84c52 100644 --- a/lib/AST/ModuleNameLookup.cpp +++ b/lib/AST/ModuleNameLookup.cpp @@ -80,7 +80,11 @@ private: void doLocalLookup(ModuleDecl *module, ModuleDecl::AccessPathTy path, SmallVectorImpl &localDecls) { - module->lookupValue(path, name, lookupKind, localDecls); + // If this import is specific to some named decl ("import Swift.Int") + // then filter out any lookups that don't match. + if (!ModuleDecl::matchesAccessPath(path, name)) + return; + module->lookupValue(name, lookupKind, localDecls); } }; diff --git a/lib/ClangImporter/ClangImporter.cpp b/lib/ClangImporter/ClangImporter.cpp index 83225b9f87d..1fd2199ee48 100644 --- a/lib/ClangImporter/ClangImporter.cpp +++ b/lib/ClangImporter/ClangImporter.cpp @@ -2728,12 +2728,8 @@ void ClangModuleUnit::getDisplayDecls(SmallVectorImpl &results) const { getTopLevelDecls(results); } -void ClangModuleUnit::lookupValue(ModuleDecl::AccessPathTy accessPath, - DeclName name, NLKind lookupKind, +void ClangModuleUnit::lookupValue(DeclName name, NLKind lookupKind, SmallVectorImpl &results) const { - if (!ModuleDecl::matchesAccessPath(accessPath, name)) - return; - // FIXME: Ignore submodules, which are empty for now. if (clangModule && clangModule->isSubModule()) return; diff --git a/lib/ClangImporter/DWARFImporter.cpp b/lib/ClangImporter/DWARFImporter.cpp index 66778848998..654fd287d9c 100644 --- a/lib/ClangImporter/DWARFImporter.cpp +++ b/lib/ClangImporter/DWARFImporter.cpp @@ -32,10 +32,9 @@ public: /// Forwards the request to the ClangImporter, which forwards it to the /// DWARFimporterDelegate. virtual void - lookupValue(ModuleDecl::AccessPathTy accessPath, DeclName name, - NLKind lookupKind, + lookupValue(DeclName name, NLKind lookupKind, SmallVectorImpl &results) const override { - Owner.lookupValueDWARF(accessPath, name, lookupKind, + Owner.lookupValueDWARF(name, lookupKind, getParentModule()->getName(), results); } @@ -130,11 +129,8 @@ ModuleDecl *ClangImporter::Implementation::loadModuleDWARF( } void ClangImporter::Implementation::lookupValueDWARF( - ModuleDecl::AccessPathTy accessPath, DeclName name, NLKind lookupKind, - Identifier inModule, SmallVectorImpl &results) { - if (!swift::ModuleDecl::matchesAccessPath(accessPath, name)) - return; - + DeclName name, NLKind lookupKind, Identifier inModule, + SmallVectorImpl &results) { if (lookupKind != NLKind::QualifiedLookup) return; diff --git a/lib/ClangImporter/ImportDecl.cpp b/lib/ClangImporter/ImportDecl.cpp index f83cff3d9b6..46d4f796a6a 100644 --- a/lib/ClangImporter/ImportDecl.cpp +++ b/lib/ClangImporter/ImportDecl.cpp @@ -4576,7 +4576,7 @@ namespace { Impl.SwiftContext.LangOpts.EffectiveLanguageVersion; SmallVector results; - overlay->lookupValue({}, name, NLKind::QualifiedLookup, results); + overlay->lookupValue(name, NLKind::QualifiedLookup, results); T *found = nullptr; for (auto result : results) { if (auto singleResult = dyn_cast(result)) { diff --git a/lib/ClangImporter/ImportType.cpp b/lib/ClangImporter/ImportType.cpp index 025133a6a0d..e0ab429b35f 100644 --- a/lib/ClangImporter/ImportType.cpp +++ b/lib/ClangImporter/ImportType.cpp @@ -2331,11 +2331,9 @@ Type ClangImporter::Implementation::getNamedSwiftType(ModuleDecl *module, // If we have an overlay, look in the overlay. Otherwise, skip // the lookup to avoid infinite recursion. if (auto module = clangUnit->getOverlayModule()) - module->lookupValue({ }, identifier, - NLKind::UnqualifiedLookup, results); + module->lookupValue(identifier, NLKind::UnqualifiedLookup, results); } else { - file->lookupValue({ }, identifier, - NLKind::UnqualifiedLookup, results); + file->lookupValue(identifier, NLKind::UnqualifiedLookup, results); } } @@ -2376,7 +2374,7 @@ getNamedSwiftTypeSpecialization(ModuleDecl *module, StringRef name, // Look for the type. SmallVector results; - module->lookupValue({ }, SwiftContext.getIdentifier(name), + module->lookupValue(SwiftContext.getIdentifier(name), NLKind::UnqualifiedLookup, results); if (results.size() == 1) { if (auto nominalDecl = dyn_cast(results.front())) { diff --git a/lib/ClangImporter/ImporterImpl.h b/lib/ClangImporter/ImporterImpl.h index 797d8e33556..bac23850f54 100644 --- a/lib/ClangImporter/ImporterImpl.h +++ b/lib/ClangImporter/ImporterImpl.h @@ -1285,8 +1285,7 @@ public: /// Look for namespace-scope values with the given name using the /// DWARFImporterDelegate. /// \param inModule only return results from this module. - void lookupValueDWARF(ModuleDecl::AccessPathTy accessPath, DeclName name, - NLKind lookupKind, Identifier inModule, + void lookupValueDWARF(DeclName name, NLKind lookupKind, Identifier inModule, SmallVectorImpl &results); /// Look for top-level scope types with a name and kind using the diff --git a/lib/IRGen/GenClangType.cpp b/lib/IRGen/GenClangType.cpp index f45642a15c4..3e0f19e90d9 100644 --- a/lib/IRGen/GenClangType.cpp +++ b/lib/IRGen/GenClangType.cpp @@ -53,7 +53,7 @@ public: static CanType getNamedSwiftType(ModuleDecl *stdlib, StringRef name) { auto &ctx = stdlib->getASTContext(); SmallVector results; - stdlib->lookupValue({}, ctx.getIdentifier(name), NLKind::QualifiedLookup, + stdlib->lookupValue(ctx.getIdentifier(name), NLKind::QualifiedLookup, results); // If we have one single type decl, and that decl has been diff --git a/lib/ParseSIL/ParseSIL.cpp b/lib/ParseSIL/ParseSIL.cpp index 2a502a0762e..b752f1433a2 100644 --- a/lib/ParseSIL/ParseSIL.cpp +++ b/lib/ParseSIL/ParseSIL.cpp @@ -1219,8 +1219,7 @@ static ValueDecl *lookupMember(Parser &P, Type Ty, DeclBaseName Name, Lookup.append(found.begin(), found.end()); } } else if (auto moduleTy = CheckTy->getAs()) { - moduleTy->getModule()->lookupValue({ }, Name, NLKind::QualifiedLookup, - Lookup); + moduleTy->getModule()->lookupValue(Name, NLKind::QualifiedLookup, Lookup); } else { P.diagnose(Loc, diag::sil_member_lookup_bad_type, Name, Ty); return nullptr; @@ -4525,7 +4524,7 @@ bool SILParser::parseSILInstruction(SILBuilder &B) { SmallVector CurModuleResults; // Perform a module level lookup on the first component of the // fully-qualified name. - P.SF.getParentModule()->lookupValue(ModuleDecl::AccessPathTy(), ProtocolName, + P.SF.getParentModule()->lookupValue(ProtocolName, NLKind::UnqualifiedLookup, CurModuleResults); assert(CurModuleResults.size() == 1); @@ -5617,7 +5616,7 @@ static Optional lookupGlobalDecl(Identifier GlobalName, SmallVector CurModuleResults; P.SF.getParentModule()->lookupValue( - {}, P.Context.getIdentifier(GlobalDeclName), NLKind::UnqualifiedLookup, + P.Context.getIdentifier(GlobalDeclName), NLKind::UnqualifiedLookup, CurModuleResults); // Bail-out on clang-imported globals. if (CurModuleResults.empty()) diff --git a/lib/SILGen/SILGen.cpp b/lib/SILGen/SILGen.cpp index c384666ac90..b0fd513ad1f 100644 --- a/lib/SILGen/SILGen.cpp +++ b/lib/SILGen/SILGen.cpp @@ -86,7 +86,7 @@ getBridgingFn(Optional &cacheSlot, } SmallVector decls; - mod->lookupValue(/*AccessPath=*/{}, ctx.getIdentifier(functionName), + mod->lookupValue(ctx.getIdentifier(functionName), NLKind::QualifiedLookup, decls); if (decls.empty()) { SGM.diagnose(SourceLoc(), diag::bridging_function_missing, diff --git a/lib/SILGen/SILGenGlobalVariable.cpp b/lib/SILGen/SILGenGlobalVariable.cpp index 3eb8c5e703f..ed9b3c500cb 100644 --- a/lib/SILGen/SILGenGlobalVariable.cpp +++ b/lib/SILGen/SILGenGlobalVariable.cpp @@ -126,9 +126,8 @@ struct GenGlobalAccessors : public PatternVisitor // Find Builtin.once. auto &C = SGM.M.getASTContext(); SmallVector found; - C.TheBuiltinModule - ->lookupValue({}, C.getIdentifier("once"), - NLKind::QualifiedLookup, found); + C.TheBuiltinModule->lookupValue(C.getIdentifier("once"), + NLKind::QualifiedLookup, found); assert(found.size() == 1 && "didn't find Builtin.once?!"); diff --git a/lib/Sema/InstrumenterSupport.cpp b/lib/Sema/InstrumenterSupport.cpp index bee27c65185..79dabab5810 100644 --- a/lib/Sema/InstrumenterSupport.cpp +++ b/lib/Sema/InstrumenterSupport.cpp @@ -91,7 +91,7 @@ InstrumenterBase::InstrumenterBase(ASTContext &C, DeclContext *DC) SmallVector results; TypeCheckDC->getParentModule()->lookupValue( - {}, moduleIdentifier, NLKind::UnqualifiedLookup, results); + moduleIdentifier, NLKind::UnqualifiedLookup, results); ModuleIdentifier = (results.size() == 1) ? moduleIdentifier : Identifier(); @@ -107,7 +107,7 @@ InstrumenterBase::InstrumenterBase(ASTContext &C, DeclContext *DC) results.clear(); TypeCheckDC->getParentModule()->lookupValue( - {}, fileIdentifier, NLKind::UnqualifiedLookup, results); + fileIdentifier, NLKind::UnqualifiedLookup, results); FileIdentifier = (results.size() == 1) ? fileIdentifier : Identifier(); } diff --git a/lib/Sema/TypeCheckDecl.cpp b/lib/Sema/TypeCheckDecl.cpp index ab2818d6e84..cb764503b8b 100644 --- a/lib/Sema/TypeCheckDecl.cpp +++ b/lib/Sema/TypeCheckDecl.cpp @@ -662,7 +662,7 @@ static void checkRedeclaration(TypeChecker &tc, ValueDecl *current) { } } else { // Look within a module context. - currentFile->getParentModule()->lookupValue({ }, current->getBaseName(), + currentFile->getParentModule()->lookupValue(current->getBaseName(), NLKind::QualifiedLookup, otherDefinitions); if (tracker) diff --git a/lib/Sema/TypeCheckDeclObjC.cpp b/lib/Sema/TypeCheckDeclObjC.cpp index 1535d68553b..66cc11d8ea4 100644 --- a/lib/Sema/TypeCheckDeclObjC.cpp +++ b/lib/Sema/TypeCheckDeclObjC.cpp @@ -1015,15 +1015,14 @@ static void checkObjCBridgingFunctions(ModuleDecl *mod, StringRef forwardConversion, StringRef reverseConversion) { assert(mod); - ModuleDecl::AccessPathTy unscopedAccess = {}; SmallVector results; auto &ctx = mod->getASTContext(); - mod->lookupValue(unscopedAccess, ctx.getIdentifier(bridgedTypeName), + mod->lookupValue(ctx.getIdentifier(bridgedTypeName), NLKind::QualifiedLookup, results); - mod->lookupValue(unscopedAccess, ctx.getIdentifier(forwardConversion), + mod->lookupValue(ctx.getIdentifier(forwardConversion), NLKind::QualifiedLookup, results); - mod->lookupValue(unscopedAccess, ctx.getIdentifier(reverseConversion), + mod->lookupValue(ctx.getIdentifier(reverseConversion), NLKind::QualifiedLookup, results); for (auto D : results) { @@ -1340,7 +1339,7 @@ static bool isCIntegerType(Type type) { auto matchesStdlibTypeNamed = [&](StringRef name) { auto identifier = ctx.getIdentifier(name); SmallVector foundDecls; - stdlibModule->lookupValue({ }, identifier, NLKind::UnqualifiedLookup, + stdlibModule->lookupValue(identifier, NLKind::UnqualifiedLookup, foundDecls); for (auto found : foundDecls) { auto foundType = dyn_cast(found); diff --git a/lib/Serialization/Serialization.cpp b/lib/Serialization/Serialization.cpp index 329402feb22..deaf296f321 100644 --- a/lib/Serialization/Serialization.cpp +++ b/lib/Serialization/Serialization.cpp @@ -3653,8 +3653,7 @@ static TypeAliasDecl *findTypeAliasForBuiltin(ASTContext &Ctx, Type T) { StringRef TypeName = FullName.substr(8); SmallVector CurModuleResults; - Ctx.TheBuiltinModule->lookupValue(ModuleDecl::AccessPathTy(), - Ctx.getIdentifier(TypeName), + Ctx.TheBuiltinModule->lookupValue(Ctx.getIdentifier(TypeName), NLKind::QualifiedLookup, CurModuleResults); assert(CurModuleResults.size() == 1); diff --git a/lib/Serialization/SerializedModuleLoader.cpp b/lib/Serialization/SerializedModuleLoader.cpp index 2354ce91db5..34cf9818ec1 100644 --- a/lib/Serialization/SerializedModuleLoader.cpp +++ b/lib/Serialization/SerializedModuleLoader.cpp @@ -946,12 +946,8 @@ bool SerializedASTFile::isSystemModule() const { return false; } -void SerializedASTFile::lookupValue(ModuleDecl::AccessPathTy accessPath, - DeclName name, NLKind lookupKind, +void SerializedASTFile::lookupValue(DeclName name, NLKind lookupKind, SmallVectorImpl &results) const{ - if (!ModuleDecl::matchesAccessPath(accessPath, name)) - return; - File.lookupValue(name, results); }