@@ -1201,7 +1201,7 @@ llvm::Expected<CompilerType> SwiftLanguageRuntime::GetChildCompilerTypeAtIndex(
1201
1201
auto get_from_field_info =
1202
1202
[&](const swift::reflection::FieldInfo &field,
1203
1203
std::optional<TypeSystemSwift::TupleElement> tuple,
1204
- bool hide_existentials, bool is_enum) -> CompilerType {
1204
+ bool hide_existentials, bool is_enum) -> llvm::Expected< CompilerType> {
1205
1205
bool is_indirect_enum =
1206
1206
is_enum && !field.Offset && field.TR &&
1207
1207
llvm::isa<swift::reflection::BuiltinTypeRef>(field.TR ) &&
@@ -1228,20 +1228,18 @@ llvm::Expected<CompilerType> SwiftLanguageRuntime::GetChildCompilerTypeAtIndex(
1228
1228
else if (is_indirect_enum) {
1229
1229
ThreadSafeReflectionContext reflection_ctx = GetReflectionContext ();
1230
1230
if (!reflection_ctx)
1231
- return {} ;
1231
+ return llvm::createStringError ( " no reflection context " ) ;
1232
1232
// The indirect enum field should point to a closure context.
1233
1233
LLDBTypeInfoProvider tip (*this , &exe_ctx);
1234
1234
lldb::addr_t instance = ::MaskMaybeBridgedPointer (GetProcess (), pointer);
1235
1235
auto ti_or_err = reflection_ctx->GetTypeInfoFromInstance (
1236
1236
instance, &tip, ts->GetDescriptorFinder ());
1237
- if (!ti_or_err) {
1238
- LLDB_LOG_ERRORV (GetLog (LLDBLog::Types), ti_or_err.takeError (), " {0}" );
1239
- return {};
1240
- }
1237
+ if (!ti_or_err)
1238
+ return ti_or_err.takeError ();
1241
1239
auto *ti = &*ti_or_err;
1242
1240
auto *rti = llvm::dyn_cast_or_null<swift::reflection::RecordTypeInfo>(ti);
1243
1241
if (rti->getFields ().size () < 1 )
1244
- return {} ;
1242
+ return llvm::createStringError ( " no fields in indirect enum " ) ;
1245
1243
auto &field = rti->getFields ()[0 ];
1246
1244
auto *type_ref = field.TR ;
1247
1245
result = GetTypeFromTypeRef (*ts, type_ref);
0 commit comments