From bdbda93f35167175b82e2a8897fefb841331bd81 Mon Sep 17 00:00:00 2001 From: Enrico Granata Date: Wed, 20 Mar 2013 19:04:28 +0000 Subject: [PATCH] Cleanup to the ObjC runtime to remove the now useless ClassDescriptor_Invalid llvm-svn: 177558 --- lldb/include/lldb/Symbol/ClangASTContext.h | 3 ++ lldb/include/lldb/Target/ObjCLanguageRuntime.h | 35 ---------------------- lldb/source/DataFormatters/Cocoa.cpp | 3 +- .../ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp | 2 +- lldb/source/Symbol/ClangASTContext.cpp | 6 ++++ 5 files changed, 12 insertions(+), 37 deletions(-) diff --git a/lldb/include/lldb/Symbol/ClangASTContext.h b/lldb/include/lldb/Symbol/ClangASTContext.h index 14402df..a1589b5 100644 --- a/lldb/include/lldb/Symbol/ClangASTContext.h +++ b/lldb/include/lldb/Symbol/ClangASTContext.h @@ -201,6 +201,9 @@ public: lldb::clang_type_t GetBuiltInType_objc_id(); + + static lldb::clang_type_t + GetBuiltInType_objc_id(clang::ASTContext *ast); lldb::clang_type_t GetBuiltInType_objc_Class(); diff --git a/lldb/include/lldb/Target/ObjCLanguageRuntime.h b/lldb/include/lldb/Target/ObjCLanguageRuntime.h index 6650115..5938d2b 100644 --- a/lldb/include/lldb/Target/ObjCLanguageRuntime.h +++ b/lldb/include/lldb/Target/ObjCLanguageRuntime.h @@ -249,41 +249,6 @@ public: lldb::TypeWP m_type_wp; }; - // a convenience subclass of ClassDescriptor meant to represent invalid objects - class ClassDescriptor_Invalid : public ClassDescriptor - { - public: - ClassDescriptor_Invalid() {} - - virtual - ~ClassDescriptor_Invalid () - {} - - virtual ConstString - GetClassName () { return ConstString(""); } - - virtual ClassDescriptorSP - GetSuperclass () { return ClassDescriptorSP(new ClassDescriptor_Invalid()); } - - virtual bool - IsValid () { return false; } - - virtual bool - IsTagged () { return false; } - - virtual uint64_t - GetInstanceSize () { return 0; } - - virtual ObjCISA - GetISA () { return 0; } - - virtual bool - CheckPointer (lldb::addr_t value, uint32_t ptr_size) const - { - return false; - } - }; - virtual ClassDescriptorSP GetClassDescriptor (ValueObject& in_value); diff --git a/lldb/source/DataFormatters/Cocoa.cpp b/lldb/source/DataFormatters/Cocoa.cpp index 2ae7ee0..afc7fe2 100644 --- a/lldb/source/DataFormatters/Cocoa.cpp +++ b/lldb/source/DataFormatters/Cocoa.cpp @@ -55,8 +55,9 @@ lldb_private::formatters::NSBundleSummaryProvider (ValueObject& valobj, Stream& if (!strcmp(class_name,"NSBundle")) { uint64_t offset = 5 * ptr_size; - ClangASTType type(valobj.GetClangAST(),valobj.GetClangType()); + ClangASTType type(valobj.GetClangAST(),ClangASTContext::GetBuiltInType_objc_id(valobj.GetClangAST())); ValueObjectSP text(valobj.GetSyntheticChildAtOffset(offset, type, true)); + valobj_addr = text->GetValueAsUnsigned(0); StreamString summary_stream; bool was_nsstring_ok = NSStringSummaryProvider(*text.get(), summary_stream); if (was_nsstring_ok && summary_stream.GetSize() > 0) diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp index f116bc7..752e526 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp @@ -1508,7 +1508,7 @@ public: // tagged pointers can represent a class that has a superclass, but since that information is not // stored in the object itself, we would have to query the runtime to discover the hierarchy // for the time being, we skip this step in the interest of static discovery - return ObjCLanguageRuntime::ClassDescriptorSP(new ObjCLanguageRuntime::ClassDescriptor_Invalid()); + return ObjCLanguageRuntime::ClassDescriptorSP(); } virtual bool diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp index 69e22c3..6eed9fc 100644 --- a/lldb/source/Symbol/ClangASTContext.cpp +++ b/lldb/source/Symbol/ClangASTContext.cpp @@ -944,6 +944,12 @@ ClangASTContext::GetBuiltInType_objc_id() return getASTContext()->getObjCIdType().getAsOpaquePtr(); } +lldb::clang_type_t +ClangASTContext::GetBuiltInType_objc_id(clang::ASTContext *ast) +{ + return ast->getObjCIdType().getAsOpaquePtr(); +} + clang_type_t ClangASTContext::GetBuiltInType_objc_Class() { -- 2.7.4