@@ -3157,6 +3157,18 @@ bool TypeSystemSwiftTypeRef::IsTypedefType(opaque_compiler_type_t type) {
3157
3157
return node && node->getKind () == Node::Kind::TypeAlias;
3158
3158
};
3159
3159
3160
+ #ifndef NDEBUG
3161
+ // We skip validation when dealing with a builtin type since builtins are
3162
+ // considered type aliases by Swift, which we're deviating from since
3163
+ // SwiftASTContext reconstructs Builtin types as TypeAliases pointing to the
3164
+ // actual Builtin types, but mangled names always describe the underlying
3165
+ // builtins directly.
3166
+ using namespace swift ::Demangle;
3167
+ Demangler dem;
3168
+ NodePointer node = GetDemangledType (dem, AsMangledName (type));
3169
+ if (node && node->getKind () == Node::Kind::BuiltinTypeName)
3170
+ return impl ();
3171
+ #endif
3160
3172
VALIDATE_AND_RETURN (impl, IsTypedefType, type, (ReconstructType (type)),
3161
3173
(ReconstructType (type)));
3162
3174
}
@@ -3177,7 +3189,18 @@ TypeSystemSwiftTypeRef::GetTypedefedType(opaque_compiler_type_t type) {
3177
3189
}
3178
3190
return std::get<CompilerType>(pair);
3179
3191
};
3180
-
3192
+ #ifndef NDEBUG
3193
+ // We skip validation when dealing with a builtin type since builtins are
3194
+ // considered type aliases by Swift, which we're deviating from since
3195
+ // SwiftASTContext reconstructs Builtin types as TypeAliases pointing to the
3196
+ // actual Builtin types, but mangled names always describe the underlying
3197
+ // builtins directly.
3198
+ using namespace swift ::Demangle;
3199
+ Demangler dem;
3200
+ NodePointer node = GetDemangledType (dem, AsMangledName (type));
3201
+ if (node && node->getKind () == Node::Kind::BuiltinTypeName)
3202
+ return impl ();
3203
+ #endif
3181
3204
VALIDATE_AND_RETURN (impl, GetTypedefedType, type, (ReconstructType (type)),
3182
3205
(ReconstructType (type)));
3183
3206
}
0 commit comments