File tree Expand file tree Collapse file tree 1 file changed +19
-15
lines changed Expand file tree Collapse file tree 1 file changed +19
-15
lines changed Original file line number Diff line number Diff line change @@ -210,31 +210,35 @@ bool Value::ValueOf(ExecutionContext *exe_ctx) {
210
210
}
211
211
212
212
uint64_t Value::GetValueByteSize (Status *error_ptr, ExecutionContext *exe_ctx) {
213
+ uint64_t byte_size = 0 ;
214
+
213
215
switch (m_context_type) {
214
216
case eContextTypeRegisterInfo: // RegisterInfo *
215
- if (GetRegisterInfo ()) {
216
- if (error_ptr)
217
- error_ptr->Clear ();
218
- return GetRegisterInfo ()->byte_size ;
219
- }
217
+ if (GetRegisterInfo ())
218
+ byte_size = GetRegisterInfo ()->byte_size ;
220
219
break ;
221
220
222
221
case eContextTypeInvalid:
223
222
case eContextTypeLLDBType: // Type *
224
223
case eContextTypeVariable: // Variable *
225
224
{
226
- auto *scope = exe_ctx ? exe_ctx->GetBestExecutionContextScope () : nullptr ;
227
- if (llvm::Optional<uint64_t > size = GetCompilerType ().GetByteSize (scope)) {
228
- if (error_ptr)
229
- error_ptr->Clear ();
230
- return *size;
231
- }
232
- break ;
225
+ const CompilerType &ast_type = GetCompilerType ();
226
+ if (ast_type.IsValid ())
227
+ if (llvm::Optional<uint64_t > size = ast_type.GetByteSize (
228
+ exe_ctx ? exe_ctx->GetBestExecutionContextScope () : nullptr ))
229
+ byte_size = *size;
230
+ } break ;
233
231
}
232
+
233
+ if (error_ptr) {
234
+ if (byte_size == 0 ) {
235
+ if (error_ptr->Success ())
236
+ error_ptr->SetErrorString (" Unable to determine byte size." );
237
+ } else {
238
+ error_ptr->Clear ();
239
+ }
234
240
}
235
- if (error_ptr && error_ptr->Success ())
236
- error_ptr->SetErrorString (" Unable to determine byte size." );
237
- return 0 ;
241
+ return byte_size;
238
242
}
239
243
240
244
const CompilerType &Value::GetCompilerType () {
You can’t perform that action at this time.
0 commit comments