Ignore the constness of the object pointer when

fetching it.

llvm-svn: 150861
This commit is contained in:
Sean Callanan 2012-02-18 02:01:03 +00:00
parent 991aa50e44
commit 5056ab04ad
4 changed files with 30 additions and 10 deletions

View File

@ -815,7 +815,8 @@ private:
lldb::VariableSP
FindVariableInScope (StackFrame &frame,
const ConstString &name,
TypeFromUser *type = NULL);
TypeFromUser *type = NULL,
bool ignore_const = false);
//------------------------------------------------------------------
/// Given a target, find a data symbol that has the given name.

View File

@ -217,13 +217,15 @@ public:
static bool
AreTypesSame(clang::ASTContext *ast,
lldb::clang_type_t type1,
lldb::clang_type_t type2);
lldb::clang_type_t type2,
bool ignore_qualifiers = false);
bool
AreTypesSame(lldb::clang_type_t type1,
lldb::clang_type_t type2)
lldb::clang_type_t type2,
bool ignore_qualifiers = false)
{
return ClangASTContext::AreTypesSame(getASTContext(), type1, type2);
return ClangASTContext::AreTypesSame(getASTContext(), type1, type2, ignore_qualifiers);
}

View File

@ -1208,9 +1208,12 @@ ClangExpressionDeclMap::GetObjectPointer
return false;
}
const bool ignore_const = true;
VariableSP object_ptr_var = FindVariableInScope (*frame,
object_name,
(suppress_type_check ? NULL : &m_struct_vars->m_object_pointer_type));
(suppress_type_check ? NULL : &m_struct_vars->m_object_pointer_type),
ignore_const);
if (!object_ptr_var)
{
@ -2158,7 +2161,8 @@ ClangExpressionDeclMap::FindVariableInScope
(
StackFrame &frame,
const ConstString &name,
TypeFromUser *type
TypeFromUser *type,
bool ignore_const
)
{
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
@ -2183,7 +2187,10 @@ ClangExpressionDeclMap::FindVariableInScope
{
if (type->GetASTContext() == var_sp->GetType()->GetClangAST())
{
if (!ClangASTContext::AreTypesSame(type->GetASTContext(), type->GetOpaqueQualType(), var_sp->GetType()->GetClangFullType()))
if (!ClangASTContext::AreTypesSame(type->GetASTContext(),
type->GetOpaqueQualType(),
var_sp->GetType()->GetClangFullType(),
ignore_const))
return lldb::VariableSP();
}
else

View File

@ -1031,10 +1031,20 @@ ClangASTContext::CopyDecl (ASTContext *dst_ast,
bool
ClangASTContext::AreTypesSame(ASTContext *ast,
clang_type_t type1,
clang_type_t type2)
clang_type_t type2,
bool ignore_qualifiers)
{
return ast->hasSameType (QualType::getFromOpaquePtr(type1),
QualType::getFromOpaquePtr(type2));
QualType type1_qual = QualType::getFromOpaquePtr(type1);
QualType type2_qual = QualType::getFromOpaquePtr(type2);
if (ignore_qualifiers)
{
type1_qual = type1_qual.getUnqualifiedType();
type2_qual = type2_qual.getUnqualifiedType();
}
return ast->hasSameType (type1_qual,
type2_qual);
}
#pragma mark CVR modifiers