Skip to content

Commit 680bb5b

Browse files
committed
ConstExtract: Adopt SemanticAvailableAttr more thoroughly.
1 parent 188ed0e commit 680bb5b

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

lib/ConstExtract/ConstExtract.cpp

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,38 +1243,37 @@ extractBuilderValueIfExists(const swift::NominalTypeDecl *TypeDecl,
12431243
}
12441244

12451245
void writeAvailabilityAttributes(llvm::json::OStream &JSON, const Decl &decl) {
1246-
auto semanticAttrs = decl.getSemanticAvailableAttrs();
1247-
if (semanticAttrs.empty())
1246+
auto attrs = decl.getSemanticAvailableAttrs();
1247+
if (attrs.empty())
12481248
return;
12491249

12501250
JSON.attributeArray("availabilityAttributes", [&] {
1251-
for (auto semanticAttr : semanticAttrs) {
1252-
auto attr = semanticAttr.getParsedAttr();
1253-
1251+
for (auto attr : attrs) {
12541252
JSON.object([&] {
1255-
if (!attr->platformString().empty())
1256-
JSON.attribute("platform", attr->platformString());
1253+
auto domainName = attr.getDomain().getNameForAttributePrinting();
1254+
if (!domainName.empty())
1255+
JSON.attribute("platform", domainName);
12571256

1258-
if (!attr->Message.empty())
1259-
JSON.attribute("message", attr->Message);
1257+
if (!attr.getMessage().empty())
1258+
JSON.attribute("message", attr.getMessage());
12601259

1261-
if (!attr->Rename.empty())
1262-
JSON.attribute("rename", attr->Rename);
1260+
if (!attr.getRename().empty())
1261+
JSON.attribute("rename", attr.getRename());
12631262

1264-
if (attr->Introduced.has_value())
1263+
if (attr.getIntroduced().has_value())
12651264
JSON.attribute("introducedVersion",
1266-
attr->Introduced.value().getAsString());
1265+
attr.getIntroduced().value().getAsString());
12671266

1268-
if (attr->Deprecated.has_value())
1267+
if (attr.getDeprecated().has_value())
12691268
JSON.attribute("deprecatedVersion",
1270-
attr->Deprecated.value().getAsString());
1269+
attr.getDeprecated().value().getAsString());
12711270

1272-
if (attr->Obsoleted.has_value())
1271+
if (attr.getObsoleted().has_value())
12731272
JSON.attribute("obsoletedVersion",
1274-
attr->Obsoleted.value().getAsString());
1273+
attr.getObsoleted().value().getAsString());
12751274

1276-
JSON.attribute("isUnavailable", attr->isUnconditionallyUnavailable());
1277-
JSON.attribute("isDeprecated", attr->isUnconditionallyDeprecated());
1275+
JSON.attribute("isUnavailable", attr.isUnconditionallyUnavailable());
1276+
JSON.attribute("isDeprecated", attr.isUnconditionallyDeprecated());
12781277
});
12791278
}
12801279
});

0 commit comments

Comments
 (0)