Skip to content

Commit 32cdb77

Browse files
authored
Merge pull request #41865 from bnbarham/abort-if-custom-attr-has-no-type
[Serialization] Abort if serializing CustomAttr with no type
2 parents 1680ec3 + 41f176b commit 32cdb77

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/Serialization/Serialization.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2703,10 +2703,14 @@ class Serializer::DeclSerializer : public DeclVisitor<DeclSerializer> {
27032703
case DAK_Custom: {
27042704
auto abbrCode = S.DeclTypeAbbrCodes[CustomDeclAttrLayout::Code];
27052705
auto theAttr = cast<CustomAttr>(DA);
2706+
auto typeID = S.addTypeRef(theAttr->getType());
2707+
if (!typeID && !S.allowCompilerErrors()) {
2708+
llvm::PrettyStackTraceString message("CustomAttr has no type");
2709+
abort();
2710+
}
27062711
CustomDeclAttrLayout::emitRecord(S.Out, S.ScratchRecord, abbrCode,
27072712
theAttr->isImplicit(),
2708-
S.addTypeRef(theAttr->getType()),
2709-
theAttr->isArgUnsafe());
2713+
typeID, theAttr->isArgUnsafe());
27102714
return;
27112715
}
27122716

0 commit comments

Comments
 (0)