Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
source/Expression/Materializer.cpp
Show First 20 Lines • Show All 863 Lines • ▼ Show 20 Lines | void Dematerialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map, | ||||
lldb::TargetSP target_sp = exe_scope->CalculateTarget(); | lldb::TargetSP target_sp = exe_scope->CalculateTarget(); | ||||
if (!target_sp) { | if (!target_sp) { | ||||
err.SetErrorString("Couldn't dematerialize a result variable: no target"); | err.SetErrorString("Couldn't dematerialize a result variable: no target"); | ||||
return; | return; | ||||
} | } | ||||
Status type_system_error; | auto type_system_or_err = | ||||
TypeSystem *type_system = target_sp->GetScratchTypeSystemForLanguage( | target_sp->GetScratchTypeSystemForLanguage(m_type.GetMinimumLanguage()); | ||||
&type_system_error, m_type.GetMinimumLanguage()); | |||||
if (!type_system) { | if (auto error = type_system_or_err.takeError()) { | ||||
err.SetErrorStringWithFormat("Couldn't dematerialize a result variable: " | err.SetErrorStringWithFormat("Couldn't dematerialize a result variable: " | ||||
"couldn't get the corresponding type " | "couldn't get the corresponding type " | ||||
"system: %s", | "system: %s", | ||||
type_system_error.AsCString()); | llvm::toString(std::move(error)).c_str()); | ||||
return; | return; | ||||
} | } | ||||
PersistentExpressionState *persistent_state = | PersistentExpressionState *persistent_state = | ||||
type_system->GetPersistentExpressionState(); | type_system_or_err->GetPersistentExpressionState(); | ||||
JDevlieghere: Another possible alternative would be to join the errors (llvm::joinErrors) and use the… | |||||
I'm not sure either, I'll try it and see what it looks like. xiaobai: I'm not sure either, I'll try it and see what it looks like. | |||||
Not Done ReplyInline ActionsI'm not a fan of joined errors, and this does not sound like the right place to start using them, as these aren't two separate errors that we've encountered, but rather one error that ends up causing another error to happen. So the best way to model this IMO would be to use nested errors the same way that Java has nested exceptions (but I don't think it's worth doing that here). labath: I'm not a fan of joined errors, and this does not sound like the right place to start using… | |||||
if (!persistent_state) { | if (!persistent_state) { | ||||
err.SetErrorString("Couldn't dematerialize a result variable: " | err.SetErrorString("Couldn't dematerialize a result variable: " | ||||
"corresponding type system doesn't handle persistent " | "corresponding type system doesn't handle persistent " | ||||
"variables"); | "variables"); | ||||
return; | return; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 564 Lines • Show Last 20 Lines |
Another possible alternative would be to join the errors (llvm::joinErrors) and use the resulting error to initialize the status. Not sure if that makes things better here though.