mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Serialization] Abort if serializing CustomAttr with no type
Rather than crash when deserializing a CustomAttr with no type, crash when serializing it instead (which is usually easier to diagnose).
This commit is contained in:
@@ -2703,10 +2703,14 @@ class Serializer::DeclSerializer : public DeclVisitor<DeclSerializer> {
|
||||
case DAK_Custom: {
|
||||
auto abbrCode = S.DeclTypeAbbrCodes[CustomDeclAttrLayout::Code];
|
||||
auto theAttr = cast<CustomAttr>(DA);
|
||||
auto typeID = S.addTypeRef(theAttr->getType());
|
||||
if (!typeID && !S.allowCompilerErrors()) {
|
||||
llvm::PrettyStackTraceString message("CustomAttr has no type");
|
||||
abort();
|
||||
}
|
||||
CustomDeclAttrLayout::emitRecord(S.Out, S.ScratchRecord, abbrCode,
|
||||
theAttr->isImplicit(),
|
||||
S.addTypeRef(theAttr->getType()),
|
||||
theAttr->isArgUnsafe());
|
||||
typeID, theAttr->isArgUnsafe());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user