Skip to content

Commit 701f782

Browse files
committed
SILOptimizer: Stop calling getAllConformances() on protocols
1 parent e8dc19a commit 701f782

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/SILOptimizer/Analysis/ProtocolConformanceAnalysis.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,12 @@ class NominalTypeWalker : public ASTWalker {
3737
bool walkToDeclPre(Decl *D) override {
3838
/// (1) Walk over all NominalTypeDecls to determine conformances.
3939
if (auto *NTD = dyn_cast<NominalTypeDecl>(D)) {
40-
auto Protocols = NTD->getAllProtocols();
41-
for (auto &Protocol : Protocols) {
42-
if (Protocol->getEffectiveAccess() <= AccessLevel::Internal) {
43-
ProtocolConformanceCache[Protocol].push_back(NTD);
40+
if (!isa<ProtocolDecl>(NTD)) {
41+
auto Protocols = NTD->getAllProtocols();
42+
for (auto &Protocol : Protocols) {
43+
if (Protocol->getEffectiveAccess() <= AccessLevel::Internal) {
44+
ProtocolConformanceCache[Protocol].push_back(NTD);
45+
}
4446
}
4547
}
4648
}

0 commit comments

Comments
 (0)