diff options
| author | Jim Ingham <jingham@apple.com> | 2010-09-28 01:25:32 +0000 |
|---|---|---|
| committer | Jim Ingham <jingham@apple.com> | 2010-09-28 01:25:32 +0000 |
| commit | 5a369128f66b30f8ce003c641dc40be0e87c09ca (patch) | |
| tree | 8ad8a725e41d77a94fc92b8ec66cd91dfa056560 /lldb/source/Core/ValueObject.cpp | |
| parent | 7990df1ae259f218e1bcdfce24ecc932697cf061 (diff) | |
| download | bcm5719-llvm-5a369128f66b30f8ce003c641dc40be0e87c09ca.tar.gz bcm5719-llvm-5a369128f66b30f8ce003c641dc40be0e87c09ca.zip | |
Replace the vestigial Value::GetOpaqueCLangQualType with the more correct Value::GetValueOpaqueClangQualType.
But mostly, move the ObjC Trampoline handling code from the MacOSX dyld plugin to the AppleObjCRuntime classes.
llvm-svn: 114935
Diffstat (limited to 'lldb/source/Core/ValueObject.cpp')
| -rw-r--r-- | lldb/source/Core/ValueObject.cpp | 70 |
1 files changed, 42 insertions, 28 deletions
diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp index a030ee5975c..6bb03927168 100644 --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -15,6 +15,7 @@ // C++ Includes // Other libraries and framework includes #include "llvm/Support/raw_ostream.h" +#include "clang/AST/Type.h" // Project includes #include "lldb/Core/DataBufferHeap.h" @@ -27,6 +28,7 @@ #include "lldb/Symbol/Type.h" #include "lldb/Target/ExecutionContext.h" +#include "lldb/Target/LanguageRuntime.h" #include "lldb/Target/Process.h" #include "lldb/Target/RegisterContext.h" #include "lldb/Target/Target.h" @@ -530,44 +532,25 @@ ValueObject::GetSummaryAsCString (ExecutionContextScope *exe_scope) return m_summary_str.c_str(); } - const char * ValueObject::GetObjectDescription (ExecutionContextScope *exe_scope) { if (!m_object_desc_str.empty()) return m_object_desc_str.c_str(); - if (!ClangASTContext::IsPointerType (GetOpaqueClangQualType())) - return NULL; - if (!GetValueIsValid()) return NULL; Process *process = exe_scope->CalculateProcess(); - - if (!process) + if (process == NULL) return NULL; + + StreamString s; - Scalar scalar; - - if (!ClangASTType::GetValueAsScalar (GetClangAST(), - GetOpaqueClangQualType(), - GetDataExtractor(), - 0, - GetByteSize(), - scalar)) - return NULL; - - ExecutionContext exe_ctx; - exe_scope->Calculate(exe_ctx); + lldb::LanguageType language = GetObjectRuntimeLanguage(); + LanguageRuntime *runtime = process->GetLanguageRuntime(language); - Value val(scalar); - val.SetContext(Value::eContextTypeOpaqueClangQualType, - ClangASTContext::GetVoidPtrType(GetClangAST(), false)); - - StreamString s; - // FIXME: Check the runtime this object belongs to and get the appropriate object printer for the object kind. - if (process->GetObjCObjectPrinter().PrintObject(s, val, exe_ctx)) + if (runtime && runtime->GetObjectDescription(s, *this, exe_scope)) { m_object_desc_str.append (s.GetData()); } @@ -770,6 +753,39 @@ ValueObject::Write () } +lldb::LanguageType +ValueObject::GetObjectRuntimeLanguage () +{ + void *opaque_qual_type = GetOpaqueClangQualType(); + if (opaque_qual_type == NULL) + return lldb::eLanguageTypeC; + + // If the type is a reference, then resolve it to what it refers to first: + clang::QualType qual_type (clang::QualType::getFromOpaquePtr(opaque_qual_type).getNonReferenceType()); + if (qual_type->isAnyPointerType()) + { + if (qual_type->isObjCObjectPointerType()) + return lldb::eLanguageTypeObjC; + + clang::QualType pointee_type (qual_type->getPointeeType()); + if (pointee_type->getCXXRecordDeclForPointerType() != NULL) + return lldb::eLanguageTypeC_plus_plus; + if (pointee_type->isObjCObjectOrInterfaceType()) + return lldb::eLanguageTypeObjC; + if (pointee_type->isObjCClassType()) + return lldb::eLanguageTypeObjC; + } + else + { + if (ClangASTContext::IsObjCClassType (opaque_qual_type)) + return lldb::eLanguageTypeObjC; + if (ClangASTContext::IsCXXClassType (opaque_qual_type)); + return lldb::eLanguageTypeC_plus_plus; + } + + return lldb::eLanguageTypeC; +} + void ValueObject::AddSyntheticChild (const ConstString &key, ValueObjectSP& valobj_sp) { @@ -832,8 +848,6 @@ ValueObject::SetDynamicValue () // Check that the runtime class is correct for determining the most specific class. // If it is a C++ class, see if it is dynamic: - //if (!decl->isDynamicClass()) - // return false; - + return true; } |

