diff options
| author | Adrian Prantl <adrian-prantl@users.noreply.github.com> | 2024-03-08 10:39:34 -0800 |
|---|---|---|
| committer | Adrian Prantl <aprantl@apple.com> | 2024-03-08 16:03:04 -0800 |
| commit | 624ea68cbc3ce422b3ee110c0c0af839eec2e278 (patch) | |
| tree | df0a35edafe329202151377db54753a00e153ca7 /lldb/source/Core/ValueObjectChild.cpp | |
| parent | c22828991e7ca7b99048761c078252e94403ba6e (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.cpp | 6 |
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, |
