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.

llvm-svn: 143592
This commit is contained in:
Sean Callanan 2011-11-02 23:24:30 +00:00
parent d294af104a
commit 9c95fd2ed6
1 changed files with 20 additions and 1 deletions

View File

@ -954,14 +954,33 @@ ClangExpressionDeclMap::LookupDecl (clang::NamedDecl *decl)
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