mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
swift-api-digester: avoid synthesizing nominal types from the same module.
Synthesizing types from the same module may bring back types that are not part the ABI/API, leading to false positives. Resolves: SR-9372
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include <ModuleAnalyzerNodes.h>
|
||||
#include <algorithm>
|
||||
|
||||
@@ -1522,7 +1523,11 @@ void SwiftDeclCollector::lookupVisibleDecls(ArrayRef<ModuleDecl *> Modules) {
|
||||
for (auto *D: KnownDecls) {
|
||||
if (auto *Ext = dyn_cast<ExtensionDecl>(D)) {
|
||||
if (HandledExtensions.find(Ext) == HandledExtensions.end()) {
|
||||
ExtensionMap[Ext->getExtendedNominal()].push_back(Ext);
|
||||
auto *NTD = Ext->getExtendedNominal();
|
||||
// Check if the extension is from other modules.
|
||||
if (!llvm::is_contained(Modules, NTD->getModuleContext())) {
|
||||
ExtensionMap[NTD].push_back(Ext);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user