mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[SourceKit][PrintObjcHeader] Avoid printing the same Swift decl twice.
Clang and Swift decls likely have many-to-one mappings; for instance, a RecordDecl and a TypedefDecl in Clang are both imported as the same Swift NominalTypeDecl. This commit reduces duplication when we print Clang decls in Swift. rdar://23275959
This commit is contained in:
@@ -493,8 +493,12 @@ void swift::ide::printHeaderInterface(
|
||||
};
|
||||
|
||||
SmallVector<Decl *, 32> ClangDecls;
|
||||
llvm::SmallPtrSet<Decl *, 32> SeenDecls;
|
||||
auto headerReceiver = [&](Decl *D) {
|
||||
ClangDecls.push_back(D);
|
||||
if (SeenDecls.count(D) == 0) {
|
||||
SeenDecls.insert(D);
|
||||
ClangDecls.push_back(D);
|
||||
}
|
||||
};
|
||||
|
||||
Importer.lookupDeclsFromHeader(Filename, headerFilter, headerReceiver);
|
||||
|
||||
Reference in New Issue
Block a user