[llvm-branch-commits] [lldb] r351342 - Merging r351327:

Hans Wennborg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Jan 16 05:31:20 PST 2019


Author: hans
Date: Wed Jan 16 05:31:20 2019
New Revision: 351342

URL: http://llvm.org/viewvc/llvm-project?rev=351342&view=rev
Log:
Merging r351327:
------------------------------------------------------------------------
r351327 | labath | 2019-01-16 13:19:22 +0100 (Wed, 16 Jan 2019) | 4 lines

Revert "Simplify Value::GetValueByteSize()"

This reverts commit r351250 because it breaks the
SymbolFile/NativePDB/function-types-builtins.cpp.
------------------------------------------------------------------------

Modified:
    lldb/branches/release_80/   (props changed)
    lldb/branches/release_80/source/Core/Value.cpp

Propchange: lldb/branches/release_80/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jan 16 05:31:20 2019
@@ -1,2 +1,3 @@
 /lldb/branches/apple/python-GIL:156467-162159
 /lldb/branches/iohandler:198360-200250
+/lldb/trunk:351327

Modified: lldb/branches/release_80/source/Core/Value.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/release_80/source/Core/Value.cpp?rev=351342&r1=351341&r2=351342&view=diff
==============================================================================
--- lldb/branches/release_80/source/Core/Value.cpp (original)
+++ lldb/branches/release_80/source/Core/Value.cpp Wed Jan 16 05:31:20 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() {




More information about the llvm-branch-commits mailing list