@@ -890,34 +890,34 @@ std::vector<ConstString> SwiftLanguage::GetPossibleFormattersMatches(
890
890
const bool check_cpp = false ;
891
891
const bool check_objc = false ;
892
892
bool canBeSwiftDynamic =
893
- compiler_type.IsPossibleDynamicType (nullptr , check_cpp, check_objc) ||
894
- // Foundation (but really any library) may create new
895
- // Objective-C classes at runtime and LLDB's ObjC runtime
896
- // implementation doesn't yet get notified about this. As a
897
- // workaround we try to interpret ObjC id pointers as Swift
898
- // classes to make them available.
899
- (compiler_type.GetCanonicalType ().GetTypeClass () ==
900
- eTypeClassObjCObjectPointer);
901
-
902
- if (canBeSwiftDynamic) {
903
- do {
904
- lldb::ProcessSP process_sp = valobj.GetProcessSP ();
905
- if (!process_sp)
906
- break ;
907
- auto *runtime = SwiftLanguageRuntime::Get (process_sp);
908
- if (runtime == nullptr )
909
- break ;
910
- TypeAndOrName type_and_or_name;
911
- Address address;
912
- Value::ValueType value_type ;
913
- if (!runtime-> GetDynamicTypeAndAddress (
914
- valobj, use_dynamic, type_and_or_name, address, value_type))
915
- break ;
916
- if (ConstString name = type_and_or_name. GetName ())
917
- result. push_back (name);
918
- } while ( false ) ;
919
- }
920
-
893
+ compiler_type.IsPossibleDynamicType (nullptr , check_cpp, check_objc);
894
+ // Foundation (but really any library) may create new
895
+ // Objective-C classes at runtime and LLDB's ObjC runtime
896
+ // implementation doesn't yet get notified about this. As a
897
+ // workaround we try to interpret ObjC id pointers as Swift
898
+ // classes to make them available.
899
+ bool canBeObjCSwiftType = (compiler_type.GetCanonicalType ().GetTypeClass () ==
900
+ eTypeClassObjCObjectPointer);
901
+
902
+ if (! canBeSwiftDynamic && !canBeObjCSwiftType)
903
+ return result;
904
+ lldb::ProcessSP process_sp = valobj.GetProcessSP ();
905
+ if (!process_sp)
906
+ return result ;
907
+ auto *runtime = SwiftLanguageRuntime::Get (process_sp);
908
+ if (! runtime)
909
+ return result ;
910
+ // If this condition fires, we're most likely in pure Objective-C program.
911
+ if (canBeObjCSwiftType && !runtime-> IsSwiftRuntimeInitialized ())
912
+ return result ;
913
+ TypeAndOrName type_and_or_name;
914
+ Address address;
915
+ Value::ValueType value_type ;
916
+ if (!runtime-> GetDynamicTypeAndAddress (valobj, use_dynamic, type_and_or_name,
917
+ address, value_type))
918
+ return result ;
919
+ if (ConstString name = type_and_or_name. GetName ())
920
+ result. push_back (name);
921
921
return result;
922
922
}
923
923
0 commit comments