[Lldb-commits] [lldb] r351327 - Revert "Simplify Value::GetValueByteSize()"

Hans Wennborg via lldb-commits lldb-commits at lists.llvm.org
Wed Jan 16 05:35:09 PST 2019


Merged to the 8 branch in r351342.

On Wed, Jan 16, 2019 at 1:23 PM Pavel Labath via lldb-commits
<lldb-commits at lists.llvm.org> wrote:
>
> Author: labath
> Date: Wed Jan 16 04:19:22 2019
> New Revision: 351327
>
> URL: http://llvm.org/viewvc/llvm-project?rev=351327&view=rev
> Log:
> Revert "Simplify Value::GetValueByteSize()"
>
> This reverts commit r351250 because it breaks the
> SymbolFile/NativePDB/function-types-builtins.cpp.
>
> Modified:
>     lldb/trunk/source/Core/Value.cpp
>
> Modified: lldb/trunk/source/Core/Value.cpp
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Value.cpp?rev=351327&r1=351326&r2=351327&view=diff
> ==============================================================================
> --- lldb/trunk/source/Core/Value.cpp (original)
> +++ lldb/trunk/source/Core/Value.cpp Wed Jan 16 04:19:22 2019
> @@ -210,31 +210,35 @@ bool Value::ValueOf(ExecutionContext *ex
>  }
>
>  uint64_t Value::GetValueByteSize(Status *error_ptr, ExecutionContext *exe_ctx) {
> +  uint64_t byte_size = 0;
> +
>    switch (m_context_type) {
>    case eContextTypeRegisterInfo: // RegisterInfo *
> -    if (GetRegisterInfo()) {
> -      if (error_ptr)
> -        error_ptr->Clear();
> -      return GetRegisterInfo()->byte_size;
> -    }
> +    if (GetRegisterInfo())
> +      byte_size = GetRegisterInfo()->byte_size;
>      break;
>
>    case eContextTypeInvalid:
>    case eContextTypeLLDBType: // Type *
>    case eContextTypeVariable: // Variable *
>    {
> -    auto *scope = exe_ctx ? exe_ctx->GetBestExecutionContextScope() : nullptr;
> -    if (llvm::Optional<uint64_t> size = GetCompilerType().GetByteSize(scope)) {
> -      if (error_ptr)
> -        error_ptr->Clear();
> -      return *size;
> -    }
> -    break;
> +    const CompilerType &ast_type = GetCompilerType();
> +    if (ast_type.IsValid())
> +      if (llvm::Optional<uint64_t> size = ast_type.GetByteSize(
> +              exe_ctx ? exe_ctx->GetBestExecutionContextScope() : nullptr))
> +        byte_size = *size;
> +  } break;
>    }
> +
> +  if (error_ptr) {
> +    if (byte_size == 0) {
> +      if (error_ptr->Success())
> +        error_ptr->SetErrorString("Unable to determine byte size.");
> +    } else {
> +      error_ptr->Clear();
> +    }
>    }
> -  if (error_ptr && error_ptr->Success())
> -    error_ptr->SetErrorString("Unable to determine byte size.");
> -  return 0;
> +  return byte_size;
>  }
>
>  const CompilerType &Value::GetCompilerType() {
>
>
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


More information about the lldb-commits mailing list