[Lldb-commits] [lldb] r175318 - Fixes in the IRInterpreter:

Sean Callanan scallanan at apple.com
Fri Feb 15 15:07:53 PST 2013


Author: spyffe
Date: Fri Feb 15 17:07:52 2013
New Revision: 175318

URL: http://llvm.org/viewvc/llvm-project?rev=175318&view=rev
Log:
Fixes in the IRInterpreter:

- removed an unnecessary variable
- fixed an issue where we sometimes
  wrote too much data into a buffer
- made the recognition of variables
  as "this" a little more conservative

<rdar://problem/13216268>

Modified:
    lldb/trunk/source/Expression/IRInterpreter.cpp

Modified: lldb/trunk/source/Expression/IRInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRInterpreter.cpp?rev=175318&r1=175317&r2=175318&view=diff
==============================================================================
--- lldb/trunk/source/Expression/IRInterpreter.cpp (original)
+++ lldb/trunk/source/Expression/IRInterpreter.cpp Fri Feb 15 17:07:52 2013
@@ -524,7 +524,7 @@ public:
         if (!AssignToMatchType(cast_scalar, scalar.GetRawBits64(0), value->getType()))
             return false;
         
-        lldb_private::DataBufferHeap buf(cast_scalar.GetByteSize(), 0);
+        lldb_private::DataBufferHeap buf(region.m_extent, 0);
         
         lldb_private::Error err;
         
@@ -534,8 +534,8 @@ public:
         DataEncoderSP region_encoder = m_memory.GetEncoder(region);
         
         if (buf.GetByteSize() > region_encoder->GetByteSize())
-            return false; // TODO figure out why this happens; try "expr int i = 12; i"
-            
+            return false; // This should not happen
+        
         memcpy(region_encoder->GetDataStart(), buf.GetBytes(), buf.GetByteSize());
         
         return true;
@@ -665,9 +665,10 @@ public:
                 if (name_str == "this" ||
                     name_str == "self" ||
                     name_str == "_cmd")
+                {
                     resolved_value = m_decl_map.GetSpecialValue(lldb_private::ConstString(name_str.c_str()));
-                
-                variable_is_this = true;
+                    variable_is_this = true;
+                }
             }
             
             if (resolved_value.GetScalar().GetType() != lldb_private::Scalar::e_void)
@@ -835,9 +836,7 @@ public:
         // Fall back and allocate space [allocation type Alloca]
         
         Type *type = value->getType();
-        
-        lldb::ValueSP backing_value(new lldb_private::Value);
-                
+                        
         Memory::Region data_region = m_memory.Malloc(type);
         data_region.m_allocation->m_origin.GetScalar() = (unsigned long long)data_region.m_allocation->m_data->GetBytes();
         data_region.m_allocation->m_origin.SetContext(lldb_private::Value::eContextTypeInvalid, NULL);





More information about the lldb-commits mailing list