Skip to content

Commit 86937ad

Browse files
committed
[lldb] Thread llvm::Expected through closure
1 parent 1f42bfb commit 86937ad

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntimeDynamicTypeResolution.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,7 +1201,7 @@ llvm::Expected<CompilerType> SwiftLanguageRuntime::GetChildCompilerTypeAtIndex(
12011201
auto get_from_field_info =
12021202
[&](const swift::reflection::FieldInfo &field,
12031203
std::optional<TypeSystemSwift::TupleElement> tuple,
1204-
bool hide_existentials, bool is_enum) -> CompilerType {
1204+
bool hide_existentials, bool is_enum) -> llvm::Expected<CompilerType> {
12051205
bool is_indirect_enum =
12061206
is_enum && !field.Offset && field.TR &&
12071207
llvm::isa<swift::reflection::BuiltinTypeRef>(field.TR) &&
@@ -1228,20 +1228,18 @@ llvm::Expected<CompilerType> SwiftLanguageRuntime::GetChildCompilerTypeAtIndex(
12281228
else if (is_indirect_enum) {
12291229
ThreadSafeReflectionContext reflection_ctx = GetReflectionContext();
12301230
if (!reflection_ctx)
1231-
return {};
1231+
return llvm::createStringError("no reflection context");
12321232
// The indirect enum field should point to a closure context.
12331233
LLDBTypeInfoProvider tip(*this, &exe_ctx);
12341234
lldb::addr_t instance = ::MaskMaybeBridgedPointer(GetProcess(), pointer);
12351235
auto ti_or_err = reflection_ctx->GetTypeInfoFromInstance(
12361236
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();
12411239
auto *ti = &*ti_or_err;
12421240
auto *rti = llvm::dyn_cast_or_null<swift::reflection::RecordTypeInfo>(ti);
12431241
if (rti->getFields().size() < 1)
1244-
return {};
1242+
return llvm::createStringError("no fields in indirect enum");
12451243
auto &field = rti->getFields()[0];
12461244
auto *type_ref = field.TR;
12471245
result = GetTypeFromTypeRef(*ts, type_ref);

0 commit comments

Comments
 (0)