Skip to content

Commit 0402be1

Browse files
committed
---
yaml --- r: 349467 b: refs/heads/master-next c: ad686b6 h: refs/heads/master i: 349465: b9739cd 349463: 7376821
1 parent ce91a67 commit 0402be1

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: 3574c513bbc5578dd9346b4ea9ab5995c5927bb5
3-
refs/heads/master-next: 24abf3fea763fe4b621aad4c129110e5e1b9c0b0
3+
refs/heads/master-next: ad686b6a7e684e821aa48b1963550ddc3fa24800
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea
66
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-b: 66d897bfcf64a82cb9a87f5e663d889189d06d07

branches/master-next/include/swift/ClangImporter/ClangImporter.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,9 @@ class DWARFImporterDelegate {
8888
virtual ~DWARFImporterDelegate() = default;
8989
/// Perform a qualified lookup of a Clang type with this name.
9090
/// \param kind Only return results with this type kind.
91+
/// \param inModule only return results from this module.
9192
virtual void lookupValue(StringRef name, llvm::Optional<ClangTypeKind> kind,
93+
StringRef inModule,
9294
SmallVectorImpl<clang::Decl *> &results) {}
9395
/// vtable anchor.
9496
virtual void anchor();

branches/master-next/lib/ClangImporter/DWARFImporter.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ void DWARFImporterDelegate::anchor() {}
2121
/// loading of types is done on demand, this class is effectively empty.
2222
class DWARFModuleUnit final : public LoadedFile {
2323
~DWARFModuleUnit() = default;
24-
ClangImporter::Implementation &owner;
24+
ClangImporter::Implementation &Owner;
2525

2626
public:
2727
DWARFModuleUnit(ModuleDecl &M, ClangImporter::Implementation &owner)
28-
: LoadedFile(FileUnitKind::DWARFModule, M), owner(owner) {}
28+
: LoadedFile(FileUnitKind::DWARFModule, M), Owner(owner) {}
2929

3030
virtual bool isSystemModule() const override { return false; }
3131

@@ -35,7 +35,8 @@ class DWARFModuleUnit final : public LoadedFile {
3535
lookupValue(ModuleDecl::AccessPathTy accessPath, DeclName name,
3636
NLKind lookupKind,
3737
SmallVectorImpl<ValueDecl *> &results) const override {
38-
owner.lookupValueDWARF(accessPath, name, lookupKind, results);
38+
Owner.lookupValueDWARF(accessPath, name, lookupKind,
39+
getParentModule()->getName(), results);
3940
}
4041

4142
virtual TypeDecl *
@@ -110,7 +111,7 @@ ModuleDecl *ClangImporter::Implementation::loadModuleDWARF(
110111
auto *decl = ModuleDecl::create(name, SwiftContext);
111112
decl->setIsNonSwiftModule();
112113
decl->setHasResolvedImports();
113-
auto wrapperUnit = new (SwiftContext) DWARFModuleUnit(*decl, *this);
114+
auto *wrapperUnit = new (SwiftContext) DWARFModuleUnit(*decl, *this);
114115
DWARFModuleUnits.insert({name, wrapperUnit});
115116
decl->addFile(*wrapperUnit);
116117

@@ -127,7 +128,7 @@ ModuleDecl *ClangImporter::Implementation::loadModuleDWARF(
127128

128129
void ClangImporter::Implementation::lookupValueDWARF(
129130
ModuleDecl::AccessPathTy accessPath, DeclName name, NLKind lookupKind,
130-
SmallVectorImpl<ValueDecl *> &results) {
131+
Identifier inModule, SmallVectorImpl<ValueDecl *> &results) {
131132
if (!swift::ModuleDecl::matchesAccessPath(accessPath, name))
132133
return;
133134

@@ -138,7 +139,8 @@ void ClangImporter::Implementation::lookupValueDWARF(
138139
return;
139140

140141
SmallVector<clang::Decl *, 4> decls;
141-
DWARFImporter->lookupValue(name.getBaseIdentifier().str(), None, decls);
142+
DWARFImporter->lookupValue(name.getBaseIdentifier().str(), None,
143+
inModule.str(), decls);
142144
for (auto *clangDecl : decls) {
143145
auto *namedDecl = dyn_cast<clang::NamedDecl>(clangDecl);
144146
if (!namedDecl)
@@ -160,8 +162,9 @@ void ClangImporter::Implementation::lookupTypeDeclDWARF(
160162
if (!DWARFImporter)
161163
return;
162164

165+
/// This function is invoked by ASTDemangler, which doesn't filter by module.
163166
SmallVector<clang::Decl *, 1> decls;
164-
DWARFImporter->lookupValue(rawName, kind, decls);
167+
DWARFImporter->lookupValue(rawName, kind, {}, decls);
165168
for (auto *clangDecl : decls) {
166169
if (!isa<clang::TypeDecl>(clangDecl) &&
167170
!isa<clang::ObjCContainerDecl>(clangDecl) &&

branches/master-next/lib/ClangImporter/ImporterImpl.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1324,8 +1324,9 @@ class LLVM_LIBRARY_VISIBILITY ClangImporter::Implementation
13241324

13251325
/// Look for namespace-scope values with the given name using the
13261326
/// DWARFImporterDelegate.
1327+
/// \param inModule only return results from this module.
13271328
void lookupValueDWARF(ModuleDecl::AccessPathTy accessPath, DeclName name,
1328-
NLKind lookupKind,
1329+
NLKind lookupKind, Identifier inModule,
13291330
SmallVectorImpl<ValueDecl *> &results);
13301331

13311332
/// Look for top-level scope types with a name and kind using the

0 commit comments

Comments
 (0)