@@ -21,11 +21,11 @@ void DWARFImporterDelegate::anchor() {}
21
21
// / loading of types is done on demand, this class is effectively empty.
22
22
class DWARFModuleUnit final : public LoadedFile {
23
23
~DWARFModuleUnit () = default ;
24
- ClangImporter::Implementation &owner ;
24
+ ClangImporter::Implementation &Owner ;
25
25
26
26
public:
27
27
DWARFModuleUnit (ModuleDecl &M, ClangImporter::Implementation &owner)
28
- : LoadedFile(FileUnitKind::DWARFModule, M), owner (owner) {}
28
+ : LoadedFile(FileUnitKind::DWARFModule, M), Owner (owner) {}
29
29
30
30
virtual bool isSystemModule () const override { return false ; }
31
31
@@ -35,7 +35,8 @@ class DWARFModuleUnit final : public LoadedFile {
35
35
lookupValue (ModuleDecl::AccessPathTy accessPath, DeclName name,
36
36
NLKind lookupKind,
37
37
SmallVectorImpl<ValueDecl *> &results) const override {
38
- owner.lookupValueDWARF (accessPath, name, lookupKind, results);
38
+ Owner.lookupValueDWARF (accessPath, name, lookupKind,
39
+ getParentModule ()->getName (), results);
39
40
}
40
41
41
42
virtual TypeDecl *
@@ -110,7 +111,7 @@ ModuleDecl *ClangImporter::Implementation::loadModuleDWARF(
110
111
auto *decl = ModuleDecl::create (name, SwiftContext);
111
112
decl->setIsNonSwiftModule ();
112
113
decl->setHasResolvedImports ();
113
- auto wrapperUnit = new (SwiftContext) DWARFModuleUnit (*decl, *this );
114
+ auto * wrapperUnit = new (SwiftContext) DWARFModuleUnit (*decl, *this );
114
115
DWARFModuleUnits.insert ({name, wrapperUnit});
115
116
decl->addFile (*wrapperUnit);
116
117
@@ -127,7 +128,7 @@ ModuleDecl *ClangImporter::Implementation::loadModuleDWARF(
127
128
128
129
void ClangImporter::Implementation::lookupValueDWARF (
129
130
ModuleDecl::AccessPathTy accessPath, DeclName name, NLKind lookupKind,
130
- SmallVectorImpl<ValueDecl *> &results) {
131
+ Identifier inModule, SmallVectorImpl<ValueDecl *> &results) {
131
132
if (!swift::ModuleDecl::matchesAccessPath (accessPath, name))
132
133
return ;
133
134
@@ -138,7 +139,8 @@ void ClangImporter::Implementation::lookupValueDWARF(
138
139
return ;
139
140
140
141
SmallVector<clang::Decl *, 4 > decls;
141
- DWARFImporter->lookupValue (name.getBaseIdentifier ().str (), None, decls);
142
+ DWARFImporter->lookupValue (name.getBaseIdentifier ().str (), None,
143
+ inModule.str (), decls);
142
144
for (auto *clangDecl : decls) {
143
145
auto *namedDecl = dyn_cast<clang::NamedDecl>(clangDecl);
144
146
if (!namedDecl)
@@ -160,8 +162,9 @@ void ClangImporter::Implementation::lookupTypeDeclDWARF(
160
162
if (!DWARFImporter)
161
163
return ;
162
164
165
+ // / This function is invoked by ASTDemangler, which doesn't filter by module.
163
166
SmallVector<clang::Decl *, 1 > decls;
164
- DWARFImporter->lookupValue (rawName, kind, decls);
167
+ DWARFImporter->lookupValue (rawName, kind, {}, decls);
165
168
for (auto *clangDecl : decls) {
166
169
if (!isa<clang::TypeDecl>(clangDecl) &&
167
170
!isa<clang::ObjCContainerDecl>(clangDecl) &&
0 commit comments