[Lldb-commits] [lldb] r243716 - Allow ValueObject::Dereference to dereference references.

Chaoren Lin chaorenl at google.com
Thu Jul 30 17:35:40 PDT 2015


Author: chaoren
Date: Thu Jul 30 19:35:40 2015
New Revision: 243716

URL: http://llvm.org/viewvc/llvm-project?rev=243716&view=rev
Log:
Allow ValueObject::Dereference to dereference references.

Reviewers: clayborg

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D11667

Modified:
    lldb/trunk/source/Core/ValueObject.cpp

Modified: lldb/trunk/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=243716&r1=243715&r2=243716&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Thu Jul 30 19:35:40 2015
@@ -3711,9 +3711,9 @@ ValueObject::Dereference (Error &error)
 {
     if (m_deref_valobj)
         return m_deref_valobj->GetSP();
-        
-    const bool is_pointer_type = IsPointerType();
-    if (is_pointer_type)
+
+    const bool is_pointer_or_reference_type = IsPointerOrReferenceType();
+    if (is_pointer_or_reference_type)
     {
         bool omit_empty_base_classes = true;
         bool ignore_array_bounds = false;
@@ -3730,7 +3730,7 @@ ValueObject::Dereference (Error &error)
         ClangASTType child_clang_type;
 
         ExecutionContext exe_ctx (GetExecutionContextRef());
-        
+
         child_clang_type = clang_type.GetChildClangTypeAtIndex (&exe_ctx,
                                                                 0,
                                                                 transparent_pointers,
@@ -3773,10 +3773,10 @@ ValueObject::Dereference (Error &error)
         StreamString strm;
         GetExpressionPath(strm, true);
 
-        if (is_pointer_type)
+        if (is_pointer_or_reference_type)
             error.SetErrorStringWithFormat("dereference failed: (%s) %s", GetTypeName().AsCString("<invalid type>"), strm.GetString().c_str());
         else
-            error.SetErrorStringWithFormat("not a pointer type: (%s) %s", GetTypeName().AsCString("<invalid type>"), strm.GetString().c_str());
+            error.SetErrorStringWithFormat("not a pointer or reference type: (%s) %s", GetTypeName().AsCString("<invalid type>"), strm.GetString().c_str());
         return ValueObjectSP();
     }
 }





More information about the lldb-commits mailing list