summaryrefslogtreecommitdiff
path: root/lldb/source/Core/ValueObjectChild.cpp
diff options
context:
space:
mode:
authorAdrian Prantl <adrian-prantl@users.noreply.github.com>2024-03-08 10:39:34 -0800
committerGitHub <noreply@github.com>2024-03-08 10:39:34 -0800
commit99118c809367d518ffe4de60c16da953744b68b9 (patch)
treef2ddb99f41bea20094075be71533e3d25f3775ff /lldb/source/Core/ValueObjectChild.cpp
parent839a8fecb4c5dfe1b4484d5fc942a9490867c47a (diff)
Change GetNumChildren()/CalculateNumChildren() methods return llvm::Expected (#84219)
Change GetNumChildren()/CalculateNumChildren() methods return llvm::Expected This is an NFC change that does not yet add any error handling or change any code to return any errors. This is the second big change in the patch series started with https://github.com/llvm/llvm-project/pull/83501 A follow-up PR will wire up error handling.
Diffstat (limited to 'lldb/source/Core/ValueObjectChild.cpp')
-rw-r--r--lldb/source/Core/ValueObjectChild.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lldb/source/Core/ValueObjectChild.cpp b/lldb/source/Core/ValueObjectChild.cpp
index 2e55dd7726bd..c6a97dd1a5cd 100644
--- a/lldb/source/Core/ValueObjectChild.cpp
+++ b/lldb/source/Core/ValueObjectChild.cpp
@@ -49,10 +49,12 @@ lldb::ValueType ValueObjectChild::GetValueType() const {
return m_parent->GetValueType();
}
-uint32_t ValueObjectChild::CalculateNumChildren(uint32_t max) {
+llvm::Expected<uint32_t> ValueObjectChild::CalculateNumChildren(uint32_t max) {
ExecutionContext exe_ctx(GetExecutionContextRef());
auto children_count = GetCompilerType().GetNumChildren(true, &exe_ctx);
- return children_count <= max ? children_count : max;
+ if (!children_count)
+ return children_count;
+ return *children_count <= max ? *children_count : max;
}
static void AdjustForBitfieldness(ConstString &name,