[Lldb-commits] [lldb] r252529 - Rework the way in which ValueObjectChild decides how to update itself; this is a slight refactoring that I need as part of a larger master plan. As such, should be NFC

Enrico Granata via lldb-commits lldb-commits at lists.llvm.org
Mon Nov 9 15:07:55 PST 2015


Author: enrico
Date: Mon Nov  9 17:07:55 2015
New Revision: 252529

URL: http://llvm.org/viewvc/llvm-project?rev=252529&view=rev
Log:
Rework the way in which ValueObjectChild decides how to update itself; this is a slight refactoring that I need as part of a larger master plan. As such, should be NFC

Modified:
    lldb/trunk/include/lldb/Symbol/CompilerType.h
    lldb/trunk/include/lldb/Symbol/TypeSystem.h
    lldb/trunk/include/lldb/lldb-enumerations.h
    lldb/trunk/source/Core/ValueObjectChild.cpp
    lldb/trunk/source/Symbol/CompilerType.cpp

Modified: lldb/trunk/include/lldb/Symbol/CompilerType.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/CompilerType.h?rev=252529&r1=252528&r2=252529&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/CompilerType.h (original)
+++ lldb/trunk/include/lldb/Symbol/CompilerType.h Mon Nov  9 17:07:55 2015
@@ -179,6 +179,9 @@ public:
     
     bool
     IsReferenceType(CompilerType *pointee_type = nullptr, bool* is_rvalue = nullptr) const;
+
+    bool
+    ShouldTreatScalarValueAsAddress () const;
     
     bool
     IsScalarType () const;

Modified: lldb/trunk/include/lldb/Symbol/TypeSystem.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/TypeSystem.h?rev=252529&r1=252528&r2=252529&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/TypeSystem.h (original)
+++ lldb/trunk/include/lldb/Symbol/TypeSystem.h Mon Nov  9 17:07:55 2015
@@ -496,6 +496,12 @@ public:
     virtual bool
     IsReferenceType (lldb::opaque_compiler_type_t type, CompilerType *pointee_type, bool* is_rvalue) = 0;
     
+    virtual bool
+    ShouldTreatScalarValueAsAddress (lldb::opaque_compiler_type_t type)
+    {
+        return IsPointerOrReferenceType(type, nullptr);
+    }
+    
     virtual UserExpression *
     GetUserExpression (const char *expr,
                        const char *expr_prefix,

Modified: lldb/trunk/include/lldb/lldb-enumerations.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-enumerations.h?rev=252529&r1=252528&r2=252529&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-enumerations.h (original)
+++ lldb/trunk/include/lldb/lldb-enumerations.h Mon Nov  9 17:07:55 2015
@@ -960,7 +960,8 @@ namespace lldb {
         eTypeIsInteger          = (1u << 18),
         eTypeIsFloat            = (1u << 19),
         eTypeIsComplex          = (1u << 20),
-        eTypeIsSigned           = (1u << 21)
+        eTypeIsSigned           = (1u << 21),
+        eTypeInstanceIsPointer  = (1u << 22)
     };
     
     FLAGS_ENUM(CommandFlags)

Modified: lldb/trunk/source/Core/ValueObjectChild.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectChild.cpp?rev=252529&r1=252528&r2=252529&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectChild.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectChild.cpp Mon Nov  9 17:07:55 2015
@@ -146,7 +146,7 @@ ValueObjectChild::UpdateValue ()
             Value::ValueType value_type = parent->GetValue().GetValueType();
             m_value.SetValueType (value_type);
 
-            if (parent->GetCompilerType().IsPointerOrReferenceType ())
+            if (parent->GetCompilerType().ShouldTreatScalarValueAsAddress())
             {
                 lldb::addr_t addr = parent->GetPointerValue ();
                 m_value.GetScalar() = addr;

Modified: lldb/trunk/source/Symbol/CompilerType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/CompilerType.cpp?rev=252529&r1=252528&r2=252529&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/CompilerType.cpp (original)
+++ lldb/trunk/source/Symbol/CompilerType.cpp Mon Nov  9 17:07:55 2015
@@ -227,6 +227,14 @@ CompilerType::IsReferenceType (CompilerT
 }
 
 bool
+CompilerType::ShouldTreatScalarValueAsAddress () const
+{
+    if (IsValid())
+        return m_type_system->ShouldTreatScalarValueAsAddress(m_type);
+    return false;
+}
+
+bool
 CompilerType::IsFloatingPointType (uint32_t &count, bool &is_complex) const
 {
     if (IsValid())




More information about the lldb-commits mailing list