diff options
Diffstat (limited to 'contrib/llvm-project/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp')
| -rw-r--r-- | contrib/llvm-project/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/contrib/llvm-project/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp b/contrib/llvm-project/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp index 2c9b3c425397..9ab1bf03250b 100644 --- a/contrib/llvm-project/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp +++ b/contrib/llvm-project/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp @@ -11,8 +11,6 @@ #include "Plugins/ExpressionParser/Clang/ClangASTImporter.h" #include "Plugins/ExpressionParser/Clang/ClangPersistentVariables.h" #include "Plugins/TypeSystem/Clang/TypeSystemClang.h" -#include "lldb/Core/ValueObject.h" -#include "lldb/Core/ValueObjectConstResult.h" #include "lldb/DataFormatters/FormattersHelpers.h" #include "lldb/Symbol/CompilerType.h" #include "lldb/Symbol/TypeSystem.h" @@ -20,6 +18,8 @@ #include "lldb/Utility/LLDBAssert.h" #include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Log.h" +#include "lldb/ValueObject/ValueObject.h" +#include "lldb/ValueObject/ValueObjectConstResult.h" using namespace lldb; using namespace lldb_private; @@ -50,8 +50,8 @@ public: return; } - auto ts = block_pointer_type.GetTypeSystem(); - auto clang_ast_context = ts.dyn_cast_or_null<TypeSystemClang>(); + auto clang_ast_context = + block_pointer_type.GetTypeSystem<TypeSystemClang>(); if (!clang_ast_context) return; @@ -114,7 +114,7 @@ public: if (!child_type_or_err) return ValueObjectConstResult::Create( exe_ctx.GetBestExecutionContextScope(), - Status(child_type_or_err.takeError())); + Status::FromError(child_type_or_err.takeError())); CompilerType child_type = *child_type_or_err; ValueObjectSP struct_pointer_sp = @@ -144,12 +144,10 @@ public: return lldb::ChildCacheState::eRefetch; } - // maybe return false if the block pointer is, say, null - bool MightHaveChildren() override { return true; } - - size_t GetIndexOfChildWithName(ConstString name) override { + llvm::Expected<size_t> GetIndexOfChildWithName(ConstString name) override { if (!m_block_struct_type.IsValid()) - return UINT32_MAX; + return llvm::createStringError("Type has no child named '%s'", + name.AsCString()); const bool omit_empty_base_classes = false; return m_block_struct_type.GetIndexOfChildWithName(name.AsCString(), @@ -175,8 +173,17 @@ bool lldb_private::formatters::BlockPointerSummaryProvider( static const ConstString s_FuncPtr_name("__FuncPtr"); - lldb::ValueObjectSP child_sp = synthetic_children->GetChildAtIndex( - synthetic_children->GetIndexOfChildWithName(s_FuncPtr_name)); + auto index_or_err = + synthetic_children->GetIndexOfChildWithName(s_FuncPtr_name); + + if (!index_or_err) { + LLDB_LOG_ERROR(GetLog(LLDBLog::DataFormatters), index_or_err.takeError(), + "{0}"); + return false; + } + + lldb::ValueObjectSP child_sp = + synthetic_children->GetChildAtIndex(*index_or_err); if (!child_sp) { return false; |
