Introduce SWIFT_STDLIB_HAS_TYPE_PRINTING flag to remove the ability to print types at runtime (to save codesize) (#40649)

This commit is contained in:
Kuba (Brecka) Mracek
2021-12-21 17:47:54 -08:00
committed by GitHub
parent 4405620aa6
commit 663a6fb771
11 changed files with 43 additions and 3 deletions

View File

@@ -76,6 +76,8 @@ extern "C" const void *swift_dynamicCastObjCProtocolConditional(
Protocol * const *protocols);
#endif
#if SWIFT_STDLIB_HAS_TYPE_PRINTING
// Build a user-comprehensible name for a type.
static void _buildNameForMetadata(const Metadata *type,
bool qualified,
@@ -124,6 +126,13 @@ std::string swift::nameForMetadata(const Metadata *type,
return result;
}
#else // SWIFT_STDLIB_HAS_TYPE_PRINTING
std::string swift::nameForMetadata(const Metadata *type, bool qualified) {
return "<<< type printer not available >>>";
}
#endif // SWIFT_STDLIB_HAS_TYPE_PRINTING
/// Used as part of cache key for `TypeNameCache`.
enum class TypeNameKind {