From fd4c84ee9ffcea93879d65f7bbcab814c8245788 Mon Sep 17 00:00:00 2001 From: Enrico Granata Date: Mon, 21 May 2012 16:51:35 +0000 Subject: Fixing a bug where we would incorrectly try and determine a dynamic type for a variable of a pointer type that is not a valid generic type for dynamic pointers. llvm-svn: 157190 --- lldb/source/Core/ValueObject.cpp | 46 +++++++--------------------------------- 1 file changed, 8 insertions(+), 38 deletions(-) (limited to 'lldb/source/Core/ValueObject.cpp') diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp index 4d8610fb222..07af307d755 100644 --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -1765,16 +1765,15 @@ ValueObject::IsPointerOrReferenceType () return ClangASTContext::IsPointerOrReferenceType (GetClangType()); } -bool -ValueObject::IsPossibleCPlusPlusDynamicType () -{ - return ClangASTContext::IsPossibleCPlusPlusDynamicType (GetClangAST (), GetClangType()); -} - bool ValueObject::IsPossibleDynamicType () { - return ClangASTContext::IsPossibleDynamicType (GetClangAST (), GetClangType()); + ExecutionContext exe_ctx (GetExecutionContextRef()); + Process *process = exe_ctx.GetProcessPtr(); + if (process) + return process->IsPossibleDynamicValue(*this); + else + return ClangASTContext::IsPossibleDynamicType (GetClangAST (), GetClangType()); } ValueObjectSP @@ -2058,37 +2057,8 @@ ValueObject::CalculateDynamicValue (DynamicValueType use_dynamic) { ExecutionContext exe_ctx (GetExecutionContextRef()); Process *process = exe_ctx.GetProcessPtr(); - if (process) - { - bool worth_having_dynamic_value = false; - - - // FIXME: Process should have some kind of "map over Runtimes" so we don't have to - // hard code this everywhere. - LanguageType known_type = GetObjectRuntimeLanguage(); - if (known_type != eLanguageTypeUnknown && known_type != eLanguageTypeC) - { - LanguageRuntime *runtime = process->GetLanguageRuntime (known_type); - if (runtime) - worth_having_dynamic_value = runtime->CouldHaveDynamicValue(*this); - } - else - { - LanguageRuntime *cpp_runtime = process->GetLanguageRuntime (eLanguageTypeC_plus_plus); - if (cpp_runtime) - worth_having_dynamic_value = cpp_runtime->CouldHaveDynamicValue(*this); - - if (!worth_having_dynamic_value) - { - LanguageRuntime *objc_runtime = process->GetLanguageRuntime (eLanguageTypeObjC); - if (objc_runtime) - worth_having_dynamic_value = objc_runtime->CouldHaveDynamicValue(*this); - } - } - - if (worth_having_dynamic_value) - m_dynamic_value = new ValueObjectDynamicValue (*this, use_dynamic); - } + if (process && process->IsPossibleDynamicValue(*this)) + m_dynamic_value = new ValueObjectDynamicValue (*this, use_dynamic); } } -- cgit v1.2.3