Add runtime support

This commit is contained in:
Alejandro Alonso
2024-07-27 18:00:33 -07:00
parent 3e9c4633ca
commit 7c85261a77
27 changed files with 481 additions and 182 deletions

View File

@@ -122,35 +122,12 @@ std::string swift::nameForMetadata(const Metadata *type,
return result;
}
std::string MetadataOrPack::nameForMetadata() const {
if (isNull())
return "<<nullptr>>";
if (isMetadata())
return ::nameForMetadata(getMetadata());
std::string result = "Pack{";
MetadataPackPointer pack = getMetadataPack();
for (size_t i = 0, e = pack.getNumElements(); i < e; ++i) {
if (i != 0)
result += ", ";
result += ::nameForMetadata(pack.getElements()[i]);
}
result += "}";
return result;
}
#else // SWIFT_STDLIB_HAS_TYPE_PRINTING
std::string swift::nameForMetadata(const Metadata *type, bool qualified) {
return "<<< type printer not available >>>";
}
std::string MetadataOrPack::nameForMetadata() const {
return "<<< type printer not available >>>";
}
#endif // SWIFT_STDLIB_HAS_TYPE_PRINTING
/// Used as part of cache key for `TypeNameCache`.