summaryrefslogtreecommitdiffstats
path: root/lldb/source/Expression/ClangExpressionDeclMap.cpp
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2012-05-21 21:29:52 +0000
committerSean Callanan <scallanan@apple.com>2012-05-21 21:29:52 +0000
commit0259e51287a03753fbce538ec67b4494e0963b45 (patch)
treefde6bce6f1dd2438afc0737163e795aa68894039 /lldb/source/Expression/ClangExpressionDeclMap.cpp
parent96dcb8d4bb88f723696dccd9aa513cd4d0e7a028 (diff)
downloadbcm5719-llvm-0259e51287a03753fbce538ec67b4494e0963b45.tar.gz
bcm5719-llvm-0259e51287a03753fbce538ec67b4494e0963b45.zip
Fixed a nasty bug where JIT expressions didn't work
when stopped in a const method. Also updated our testsuite to ensure that JIT is forced in this case. llvm-svn: 157208
Diffstat (limited to 'lldb/source/Expression/ClangExpressionDeclMap.cpp')
-rw-r--r--lldb/source/Expression/ClangExpressionDeclMap.cpp44
1 files changed, 33 insertions, 11 deletions
diff --git a/lldb/source/Expression/ClangExpressionDeclMap.cpp b/lldb/source/Expression/ClangExpressionDeclMap.cpp
index 00c5ee9caad..c827592fcea 100644
--- a/lldb/source/Expression/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Expression/ClangExpressionDeclMap.cpp
@@ -1221,12 +1221,12 @@ ClangExpressionDeclMap::GetObjectPointer
return false;
}
- const bool ignore_const = true;
+ const bool object_pointer = true;
VariableSP object_ptr_var = FindVariableInScope (*frame,
object_name,
(suppress_type_check ? NULL : &m_struct_vars->m_object_pointer_type),
- ignore_const);
+ object_pointer);
if (!object_ptr_var)
{
@@ -2175,7 +2175,7 @@ ClangExpressionDeclMap::FindVariableInScope
StackFrame &frame,
const ConstString &name,
TypeFromUser *type,
- bool ignore_const
+ bool object_pointer
)
{
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
@@ -2198,19 +2198,41 @@ ClangExpressionDeclMap::FindVariableInScope
if (var_sp && type)
{
- if (type->GetASTContext() == var_sp->GetType()->GetClangAST())
+ TypeFromUser candidate_type(var_sp->GetType()->GetClangFullType(),
+ var_sp->GetType()->GetClangAST());
+
+ if (candidate_type.GetASTContext() != type->GetASTContext())
{
- if (!ClangASTContext::AreTypesSame(type->GetASTContext(),
- type->GetOpaqueQualType(),
- var_sp->GetType()->GetClangFullType(),
- ignore_const))
+ if (log)
+ log->PutCString("Skipping a candidate variable because of different AST contexts");
+ return lldb::VariableSP();
+ }
+
+ if (object_pointer)
+ {
+ clang::QualType desired_qual_type = clang::QualType::getFromOpaquePtr(type->GetOpaqueQualType());
+ clang::QualType candidate_qual_type = clang::QualType::getFromOpaquePtr(candidate_type.GetOpaqueQualType());
+
+ const clang::PointerType *desired_ptr_type = desired_qual_type->getAs<clang::PointerType>();
+ const clang::PointerType *candidate_ptr_type = candidate_qual_type->getAs<clang::PointerType>();
+
+ if (!desired_ptr_type || !candidate_ptr_type)
+ return lldb::VariableSP();
+
+ clang::QualType desired_target_type = desired_ptr_type->getPointeeType().getUnqualifiedType();
+ clang::QualType candidate_target_type = candidate_ptr_type->getPointeeType().getUnqualifiedType();
+
+ if (!ClangASTContext::AreTypesSame(type->GetASTContext(),
+ desired_target_type.getAsOpaquePtr(),
+ candidate_target_type.getAsOpaquePtr()))
return lldb::VariableSP();
}
else
{
- if (log)
- log->PutCString("Skipping a candidate variable because of different AST contexts");
- return lldb::VariableSP();
+ if (!ClangASTContext::AreTypesSame(type->GetASTContext(),
+ type->GetOpaqueQualType(),
+ var_sp->GetType()->GetClangFullType()))
+ return lldb::VariableSP();
}
}
OpenPOWER on IntegriCloud