@@ -387,37 +387,36 @@ class TargetReflectionContext
387387} // namespace
388388
389389std::unique_ptr<SwiftLanguageRuntimeImpl::ReflectionContextInterface>
390- SwiftLanguageRuntimeImpl::ReflectionContextInterface::CreateReflectionContext32 (
391- std::shared_ptr<swift::remote::MemoryReader> reader, bool ObjCInterop ,
392- SwiftMetadataCache *swift_metadata_cache) {
390+ SwiftLanguageRuntimeImpl::ReflectionContextInterface::CreateReflectionContext (
391+ uint8_t ptr_size, std::shared_ptr<swift::remote::MemoryReader> reader,
392+ bool ObjCInterop, SwiftMetadataCache *swift_metadata_cache) {
393393 using ReflectionContext32ObjCInterop =
394394 TargetReflectionContext<swift::reflection::ReflectionContext<
395395 swift::External<swift::WithObjCInterop<swift::RuntimeTarget<4 >>>>>;
396396 using ReflectionContext32NoObjCInterop =
397397 TargetReflectionContext<swift::reflection::ReflectionContext<
398398 swift::External<swift::NoObjCInterop<swift::RuntimeTarget<4 >>>>>;
399- if (ObjCInterop)
400- return std::make_unique<ReflectionContext32ObjCInterop>(
401- reader, swift_metadata_cache);
402- return std::make_unique<ReflectionContext32NoObjCInterop>(
403- reader, swift_metadata_cache);
404- }
405-
406- std::unique_ptr<SwiftLanguageRuntimeImpl::ReflectionContextInterface>
407- SwiftLanguageRuntimeImpl::ReflectionContextInterface::CreateReflectionContext64 (
408- std::shared_ptr<swift::remote::MemoryReader> reader, bool ObjCInterop,
409- SwiftMetadataCache *swift_metadata_cache) {
410399 using ReflectionContext64ObjCInterop =
411400 TargetReflectionContext<swift::reflection::ReflectionContext<
412401 swift::External<swift::WithObjCInterop<swift::RuntimeTarget<8 >>>>>;
413402 using ReflectionContext64NoObjCInterop =
414403 TargetReflectionContext<swift::reflection::ReflectionContext<
415404 swift::External<swift::NoObjCInterop<swift::RuntimeTarget<8 >>>>>;
416- if (ObjCInterop)
417- return std::make_unique<ReflectionContext64ObjCInterop>(
405+ if (ptr_size == 4 ) {
406+ if (ObjCInterop)
407+ return std::make_unique<ReflectionContext32ObjCInterop>(
408+ reader, swift_metadata_cache);
409+ return std::make_unique<ReflectionContext32NoObjCInterop>(
418410 reader, swift_metadata_cache);
419- return std::make_unique<ReflectionContext64NoObjCInterop>(
420- reader, swift_metadata_cache);
411+ }
412+ if (ptr_size == 8 ) {
413+ if (ObjCInterop)
414+ return std::make_unique<ReflectionContext64ObjCInterop>(
415+ reader, swift_metadata_cache);
416+ return std::make_unique<ReflectionContext64NoObjCInterop>(
417+ reader, swift_metadata_cache);
418+ }
419+ return {};
421420}
422421
423422SwiftLanguageRuntimeImpl::ReflectionContextInterface::
0 commit comments