Relax the constraint on the types of ValueObjects that we'll by default try the

ObjC runtime for print object to Pointer AND Integer (from just pointer.)

llvm-svn: 127841
This commit is contained in:
Jim Ingham 2011-03-18 00:05:18 +00:00
parent 38aa83fa24
commit b7603bb48d
3 changed files with 19 additions and 7 deletions

View File

@ -93,6 +93,9 @@ public:
return false;
}
bool
IsIntegerType (bool &is_signed);
virtual bool
GetBaseClassPath (Stream &s);

View File

@ -588,13 +588,16 @@ ValueObject::GetObjectDescription (ExecutionContextScope *exe_scope)
if (runtime == NULL)
{
// Aw, hell, if the things a pointer, let's try ObjC anyway...
// Aw, hell, if the things a pointer, or even just an integer, let's try ObjC anyway...
clang_type_t opaque_qual_type = GetClangType();
if (opaque_qual_type != NULL)
{
clang::QualType qual_type (clang::QualType::getFromOpaquePtr(opaque_qual_type).getNonReferenceType());
if (qual_type->isAnyPointerType())
bool is_signed;
if (ClangASTContext::IsIntegerType (opaque_qual_type, is_signed)
|| ClangASTContext::IsPointerType (opaque_qual_type))
{
runtime = process->GetLanguageRuntime(lldb::eLanguageTypeObjC);
}
}
}
@ -892,7 +895,11 @@ ValueObject::IsPointerType ()
return ClangASTContext::IsPointerType (GetClangType());
}
bool
ValueObject::IsIntegerType (bool &is_signed)
{
return ClangASTContext::IsIntegerType (GetClangType(), is_signed);
}
bool
ValueObject::IsPointerOrReferenceType ()

View File

@ -41,9 +41,11 @@ using namespace lldb_private;
bool
AppleObjCRuntime::GetObjectDescription (Stream &str, ValueObject &object, ExecutionContextScope *exe_scope)
{
// ObjC objects can only be pointers:
if (!object.IsPointerType())
bool is_signed;
// ObjC objects can only be pointers, but we extend this to integer types because an expression might just
// result in an address, and we should try that to see if the address is an ObjC object.
if (!(object.IsPointerType() || object.IsIntegerType(is_signed)))
return NULL;
// Make the argument list: we pass one arg, the address of our pointer, to the print function.