Skip to content

Commit 091462a

Browse files
committed
[Serialization] Skip serializing invalid destructors if allowing errors
1 parent 0831a93 commit 091462a

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
@@ -3913,6 +3913,9 @@ class Serializer::DeclSerializer : public DeclVisitor<DeclSerializer> {
39133913
using namespace decls_block;
39143914
verifyAttrSerializable(dtor);
39153915

3916+
if (S.allowCompilerErrors() && dtor->isInvalid())
3917+
return;
3918+
39163919
auto contextID = S.addDeclContextRef(dtor->getDeclContext());
39173920

39183921
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)