diff options
author | Jim Ingham <jingham@apple.com> | 2011-03-18 00:05:18 +0000 |
---|---|---|
committer | Jim Ingham <jingham@apple.com> | 2011-03-18 00:05:18 +0000 |
commit | b7603bb48d16784a6fff07e817d41aa0af18532b (patch) | |
tree | c1c2dd99aad4f41e63b9ad098137b0ef4b3f165b | |
parent | 38aa83fa24f5aa2ba82377c4ca0c6b69c021af4c (diff) | |
download | bcm5719-llvm-b7603bb48d16784a6fff07e817d41aa0af18532b.tar.gz bcm5719-llvm-b7603bb48d16784a6fff07e817d41aa0af18532b.zip |
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
-rw-r--r-- | lldb/include/lldb/Core/ValueObject.h | 3 | ||||
-rw-r--r-- | lldb/source/Core/ValueObject.cpp | 15 | ||||
-rw-r--r-- | lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp | 8 |
3 files changed, 19 insertions, 7 deletions
diff --git a/lldb/include/lldb/Core/ValueObject.h b/lldb/include/lldb/Core/ValueObject.h index 30e5d5741c7..9a1a281a7a6 100644 --- a/lldb/include/lldb/Core/ValueObject.h +++ b/lldb/include/lldb/Core/ValueObject.h @@ -93,6 +93,9 @@ public: return false; } + bool + IsIntegerType (bool &is_signed); + virtual bool GetBaseClassPath (Stream &s); diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp index 95669255bd5..9346db4280c 100644 --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -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 () diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp index 8966ec0a82a..11880642182 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp @@ -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. |