[Lldb-commits] [lldb] r143592 - /lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp

Sean Callanan scallanan at apple.com
Wed Nov 2 16:24:30 PDT 2011


Author: spyffe
Date: Wed Nov  2 18:24:30 2011
New Revision: 143592

URL: http://llvm.org/viewvc/llvm-project?rev=143592&view=rev
Log:
Fixed the function that gets values for the
IRInterpreter to get the value, not the location,
of references.  The location of a reference has
type T&&, which is meaningless to Clang.

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

Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=143592&r1=143591&r2=143592&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Wed Nov  2 18:24:30 2011
@@ -954,14 +954,33 @@
         
     ClangExpressionVariableSP expr_var_sp (m_found_entities.GetVariable(decl));
     ClangExpressionVariableSP persistent_var_sp (m_parser_vars->m_persistent_vars->GetVariable(decl));
-
+    
     if (expr_var_sp)
     {
         if (!expr_var_sp->m_parser_vars.get() || !expr_var_sp->m_parser_vars->m_lldb_var)
             return Value();
         
+        bool is_reference = expr_var_sp->m_flags & ClangExpressionVariable::EVTypeIsReference;
+        
         std::auto_ptr<Value> value(GetVariableValue(exe_ctx, expr_var_sp->m_parser_vars->m_lldb_var, NULL));
         
+        if (is_reference && value.get() && value->GetValueType() == Value::eValueTypeLoadAddress)
+        {
+            Process *process = m_parser_vars->m_exe_ctx->GetProcessPtr();
+            
+            if (!process)
+                return Value();
+            
+            lldb::addr_t value_addr = value->GetScalar().ULongLong();
+            Error read_error;
+            addr_t ref_value = process->ReadPointerFromMemory (value_addr, read_error);
+            
+            if (!read_error.Success())
+                return Value();
+            
+            value->GetScalar() = (unsigned long long)ref_value;
+        }
+        
         if (value.get())
             return *value;
         else





More information about the lldb-commits mailing list