[Serialization] Skip verifying attributes when allowing errors

When allowing errors any attribute could be on any decl, so don't verify
whether an attribute can appear on a decl. Note that these attributes
aren't serialized anyway since they'll be set to invalid during
typechecking and hence skipped.
This commit is contained in:
Ben Barham
2021-05-29 12:18:07 +10:00
parent 7856f2d83d
commit 073a5828a2
2 changed files with 11 additions and 0 deletions

View File

@@ -2012,6 +2012,8 @@ getStableSelfAccessKind(swift::SelfAccessKind MM) {
# define DECL(KIND, PARENT)\
LLVM_ATTRIBUTE_UNUSED \
static void verifyAttrSerializable(const KIND ## Decl *D) {\
if (D->Decl::getASTContext().LangOpts.AllowModuleWithCompilerErrors)\
return;\
for (auto Attr : D->getAttrs()) {\
assert(Attr->canAppearOnDecl(D) && "attribute cannot appear on a " #KIND);\
}\