Skip to content

Commit 977d266

Browse files
authored
Merge pull request #26514 from eeckstein/fix-destructor-analysis
SILOptimizer: fix a crash in DestructorAnalysis
2 parents f187fc3 + ab358c7 commit 977d266

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lib/SILOptimizer/Analysis/DestructorAnalysis.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
#include "swift/SIL/SILInstruction.h"
1515
#include "swift/AST/ASTContext.h"
1616
#include "swift/AST/Decl.h"
17+
#include "swift/AST/Module.h"
18+
#include "swift/AST/LazyResolver.h"
1719
#include "swift/SIL/SILModule.h"
1820
#include "llvm/Support/Debug.h"
1921

@@ -71,10 +73,15 @@ bool DestructorAnalysis::isSafeType(CanType Ty) {
7173
return cacheResult(Ty, true);
7274

7375
// Check the stored properties.
74-
for (auto SP : Struct->getStoredProperties())
76+
for (auto SP : Struct->getStoredProperties()) {
77+
// FIXME: Remove this once getInterfaceType() is a request.
78+
if (!SP->hasInterfaceType()) {
79+
ASTContext &Ctx = Mod->getSwiftModule()->getASTContext();
80+
Ctx.getLazyResolver()->resolveDeclSignature(SP);
81+
}
7582
if (!isSafeType(SP->getInterfaceType()->getCanonicalType()))
7683
return cacheResult(Ty, false);
77-
84+
}
7885
return cacheResult(Ty, true);
7986
}
8087

0 commit comments

Comments
 (0)