@@ -1242,14 +1242,15 @@ extractBuilderValueIfExists(const swift::NominalTypeDecl *TypeDecl,
1242
1242
;
1243
1243
}
1244
1244
1245
- void writeAttrInformation (llvm::json::OStream &JSON,
1246
- const DeclAttributes &Attrs) {
1247
- auto availableAttr = Attrs.getAttributes <AvailableAttr>();
1248
- if (availableAttr.empty ())
1245
+ void writeAvailabilityAttributes (llvm::json::OStream &JSON, const Decl &decl) {
1246
+ auto semanticAttrs = decl.getSemanticAvailableAttrs ();
1247
+ if (semanticAttrs.empty ())
1249
1248
return ;
1250
1249
1251
1250
JSON.attributeArray (" availabilityAttributes" , [&] {
1252
- for (const AvailableAttr *attr : availableAttr) {
1251
+ for (auto semanticAttr : semanticAttrs) {
1252
+ auto attr = semanticAttr.getParsedAttr ();
1253
+
1253
1254
JSON.object ([&] {
1254
1255
if (!attr->platformString ().empty ())
1255
1256
JSON.attribute (" platform" , attr->platformString ());
@@ -1370,7 +1371,7 @@ void writeProperties(llvm::json::OStream &JSON,
1370
1371
}
1371
1372
writePropertyWrapperAttributes (JSON, PropertyInfo.PropertyWrappers ,
1372
1373
decl->getASTContext ());
1373
- writeAttrInformation (JSON, decl-> getAttrs () );
1374
+ writeAvailabilityAttributes (JSON, * decl);
1374
1375
});
1375
1376
}
1376
1377
});
@@ -1450,7 +1451,7 @@ bool writeAsJSONToFile(const std::vector<ConstValueTypeInfo> &ConstValueInfos,
1450
1451
writeAssociatedTypeAliases (JSON, *NomTypeDecl);
1451
1452
writeProperties (JSON, TypeInfo, *NomTypeDecl);
1452
1453
writeEnumCases (JSON, TypeInfo.EnumElements );
1453
- writeAttrInformation (JSON, NomTypeDecl-> getAttrs () );
1454
+ writeAvailabilityAttributes (JSON, * NomTypeDecl);
1454
1455
});
1455
1456
}
1456
1457
});
0 commit comments