Skip to content

Commit 7856f2d

Browse files
committed
[Serialization] Skip serializing invalid destructors if allowing errors
1 parent b2c6673 commit 7856f2d

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

lib/Serialization/Serialization.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3933,6 +3933,9 @@ class Serializer::DeclSerializer : public DeclVisitor<DeclSerializer> {
39333933
using namespace decls_block;
39343934
verifyAttrSerializable(dtor);
39353935

3936+
if (S.allowCompilerErrors() && dtor->isInvalid())
3937+
return;
3938+
39363939
auto contextID = S.addDeclContextRef(dtor->getDeclContext());
39373940

39383941
unsigned abbrCode = S.DeclTypeAbbrCodes[DestructorLayout::Code];
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// RUN: %empty-directory(%t)
2+
3+
// RUN: %target-swift-frontend -module-name errors -emit-module -o %t/errors.swiftmodule -experimental-allow-module-with-compiler-errors %s
4+
5+
// deinit is only valid on a class, make sure we don't crash when allowing
6+
// errors
7+
8+
deinit {}

0 commit comments

Comments
 (0)