@@ -886,7 +886,7 @@ llvm::Optional<uint64_t> SwiftLanguageRuntimeImpl::GetMemberVariableOffsetRemote
886
886
auto frame = instance ? instance->GetExecutionContextRef ().GetFrameSP ().get ()
887
887
: nullptr ;
888
888
if (auto *ti = llvm::dyn_cast_or_null<swift::reflection::RecordTypeInfo>(
889
- GetTypeInfo (instance_type, frame))) {
889
+ GetSwiftRuntimeTypeInfo (instance_type, frame))) {
890
890
auto fields = ti->getFields ();
891
891
LLDB_LOGF (GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES),
892
892
" using record type info" );
@@ -1040,10 +1040,11 @@ SwiftLanguageRuntimeImpl::GetNumChildren(CompilerType type,
1040
1040
auto frame =
1041
1041
valobj ? valobj->GetExecutionContextRef ().GetFrameSP ().get () : nullptr ;
1042
1042
const swift::reflection::TypeRef *tr = nullptr ;
1043
- auto *ti = GetTypeInfo (type, frame, &tr);
1043
+ auto *ti = GetSwiftRuntimeTypeInfo (type, frame, &tr);
1044
+ if (!ti)
1045
+ return {};
1044
1046
// Structs and Tuples.
1045
- if (auto *rti =
1046
- llvm::dyn_cast_or_null<swift::reflection::RecordTypeInfo>(ti)) {
1047
+ if (auto *rti = llvm::dyn_cast<swift::reflection::RecordTypeInfo>(ti)) {
1047
1048
switch (rti->getRecordKind ()) {
1048
1049
case swift::reflection::RecordKind::ExistentialMetatype:
1049
1050
case swift::reflection::RecordKind::ThickFunction:
@@ -1060,13 +1061,11 @@ SwiftLanguageRuntimeImpl::GetNumChildren(CompilerType type,
1060
1061
return rti->getNumFields ();
1061
1062
}
1062
1063
}
1063
- if (auto *eti = llvm::dyn_cast_or_null <swift::reflection::EnumTypeInfo>(ti)) {
1064
+ if (auto *eti = llvm::dyn_cast <swift::reflection::EnumTypeInfo>(ti)) {
1064
1065
return eti->getNumPayloadCases ();
1065
1066
}
1066
1067
// Objects.
1067
- if (auto *rti =
1068
- llvm::dyn_cast_or_null<swift::reflection::ReferenceTypeInfo>(ti)) {
1069
-
1068
+ if (auto *rti = llvm::dyn_cast<swift::reflection::ReferenceTypeInfo>(ti)) {
1070
1069
switch (rti->getReferenceKind ()) {
1071
1070
case swift::reflection::ReferenceKind::Weak:
1072
1071
case swift::reflection::ReferenceKind::Unowned:
@@ -1113,7 +1112,9 @@ SwiftLanguageRuntimeImpl::GetNumFields(CompilerType type,
1113
1112
using namespace swift ::reflection;
1114
1113
// Try the static type metadata.
1115
1114
const TypeRef *tr = nullptr ;
1116
- auto *ti = GetTypeInfo (type, exe_ctx->GetFramePtr (), &tr);
1115
+ auto *ti = GetSwiftRuntimeTypeInfo (type, exe_ctx->GetFramePtr (), &tr);
1116
+ if (!ti)
1117
+ return {};
1117
1118
// Structs and Tuples.
1118
1119
switch (ti->getKind ()) {
1119
1120
case TypeInfoKind::Record: {
@@ -1246,7 +1247,9 @@ llvm::Optional<std::string> SwiftLanguageRuntimeImpl::GetEnumCaseName(
1246
1247
CompilerType type, const DataExtractor &data, ExecutionContext *exe_ctx) {
1247
1248
using namespace swift ::reflection;
1248
1249
using namespace swift ::remote;
1249
- auto *ti = GetTypeInfo (type, exe_ctx->GetFramePtr ());
1250
+ auto *ti = GetSwiftRuntimeTypeInfo (type, exe_ctx->GetFramePtr ());
1251
+ if (!ti)
1252
+ return {};
1250
1253
if (ti->getKind () != TypeInfoKind::Enum)
1251
1254
return {};
1252
1255
@@ -1278,7 +1281,9 @@ llvm::Optional<size_t> SwiftLanguageRuntimeImpl::GetIndexOfChildMemberWithName(
1278
1281
using namespace swift ::reflection;
1279
1282
// Try the static type metadata.
1280
1283
const TypeRef *tr = nullptr ;
1281
- auto *ti = GetTypeInfo (type, exe_ctx->GetFramePtr (), &tr);
1284
+ auto *ti = GetSwiftRuntimeTypeInfo (type, exe_ctx->GetFramePtr (), &tr);
1285
+ if (!ti)
1286
+ return {};
1282
1287
switch (ti->getKind ()) {
1283
1288
case TypeInfoKind::Record: {
1284
1289
// Structs and Tuples.
@@ -1391,7 +1396,9 @@ CompilerType SwiftLanguageRuntimeImpl::GetChildCompilerTypeAtIndex(
1391
1396
// Try the static type metadata.
1392
1397
auto frame =
1393
1398
valobj ? valobj->GetExecutionContextRef ().GetFrameSP ().get () : nullptr ;
1394
- auto *ti = GetTypeInfo (type, frame);
1399
+ auto *ti = GetSwiftRuntimeTypeInfo (type, frame);
1400
+ if (!ti)
1401
+ return {};
1395
1402
// Structs and Tuples.
1396
1403
if (auto *rti =
1397
1404
llvm::dyn_cast_or_null<swift::reflection::RecordTypeInfo>(ti)) {
@@ -2772,7 +2779,8 @@ SwiftLanguageRuntimeImpl::GetTypeRef(CompilerType type,
2772
2779
return type_ref;
2773
2780
}
2774
2781
2775
- const swift::reflection::TypeInfo *SwiftLanguageRuntimeImpl::GetTypeInfo (
2782
+ const swift::reflection::TypeInfo *
2783
+ SwiftLanguageRuntimeImpl::GetSwiftRuntimeTypeInfo (
2776
2784
CompilerType type, ExecutionContextScope *exe_scope,
2777
2785
swift::reflection::TypeRef const **out_tr) {
2778
2786
auto *ts = llvm::dyn_cast_or_null<TypeSystemSwift>(type.GetTypeSystem ());
@@ -2814,30 +2822,30 @@ const swift::reflection::TypeInfo *SwiftLanguageRuntimeImpl::GetTypeInfo(
2814
2822
}
2815
2823
2816
2824
bool SwiftLanguageRuntimeImpl::IsStoredInlineInBuffer (CompilerType type) {
2817
- if (auto *type_info = GetTypeInfo (type, nullptr ))
2825
+ if (auto *type_info = GetSwiftRuntimeTypeInfo (type, nullptr ))
2818
2826
return type_info->isBitwiseTakable () && type_info->getSize () <= 24 ;
2819
2827
return true ;
2820
2828
}
2821
2829
2822
2830
llvm::Optional<uint64_t >
2823
2831
SwiftLanguageRuntimeImpl::GetBitSize (CompilerType type,
2824
2832
ExecutionContextScope *exe_scope) {
2825
- if (auto *type_info = GetTypeInfo (type, exe_scope))
2833
+ if (auto *type_info = GetSwiftRuntimeTypeInfo (type, exe_scope))
2826
2834
return type_info->getSize () * 8 ;
2827
2835
return {};
2828
2836
}
2829
2837
2830
2838
llvm::Optional<uint64_t >
2831
2839
SwiftLanguageRuntimeImpl::GetByteStride (CompilerType type) {
2832
- if (auto *type_info = GetTypeInfo (type, nullptr ))
2840
+ if (auto *type_info = GetSwiftRuntimeTypeInfo (type, nullptr ))
2833
2841
return type_info->getStride ();
2834
2842
return {};
2835
2843
}
2836
2844
2837
2845
llvm::Optional<size_t >
2838
2846
SwiftLanguageRuntimeImpl::GetBitAlignment (CompilerType type,
2839
2847
ExecutionContextScope *exe_scope) {
2840
- if (auto *type_info = GetTypeInfo (type, exe_scope))
2848
+ if (auto *type_info = GetSwiftRuntimeTypeInfo (type, exe_scope))
2841
2849
return type_info->getAlignment () * 8 ;
2842
2850
return {};
2843
2851
}
0 commit comments