aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectWatchpoint.cpp
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2025-03-05 10:21:19 -0800
committerGitHub <noreply@github.com>2025-03-05 10:21:19 -0800
commit878a64f94a264ea4b564d6063614ddb0b5da3f6c (patch)
tree5aaa6c770d5764fd3f9822882376c85c7ed427ef /lldb/source/Commands/CommandObjectWatchpoint.cpp
parent03da079968845e1f1312d09ff4e2ecee1933552e (diff)
downloadllvm-878a64f94a264ea4b564d6063614ddb0b5da3f6c.zip
llvm-878a64f94a264ea4b564d6063614ddb0b5da3f6c.tar.gz
llvm-878a64f94a264ea4b564d6063614ddb0b5da3f6c.tar.bz2
[lldb] Upgrade CompilerType::GetBitSize to return llvm::Expected (#129601)
This patch pushes the error handling boundary for the GetBitSize() methods from Runtime into the Type and CompilerType APIs. This makes it easier to diagnose problems thanks to more meaningful error messages being available. GetBitSize() is often the first thing LLDB asks about a type, so this method is particularly important for a better user experience. rdar://145667239
Diffstat (limited to 'lldb/source/Commands/CommandObjectWatchpoint.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectWatchpoint.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/lldb/source/Commands/CommandObjectWatchpoint.cpp b/lldb/source/Commands/CommandObjectWatchpoint.cpp
index 766d650..20f4b91 100644
--- a/lldb/source/Commands/CommandObjectWatchpoint.cpp
+++ b/lldb/source/Commands/CommandObjectWatchpoint.cpp
@@ -867,9 +867,10 @@ protected:
if (addr_type == eAddressTypeLoad) {
// We're in business.
// Find out the size of this variable.
- size = m_option_watchpoint.watch_size.GetCurrentValue() == 0
- ? valobj_sp->GetByteSize().value_or(0)
- : m_option_watchpoint.watch_size.GetCurrentValue();
+ size =
+ m_option_watchpoint.watch_size.GetCurrentValue() == 0
+ ? llvm::expectedToOptional(valobj_sp->GetByteSize()).value_or(0)
+ : m_option_watchpoint.watch_size.GetCurrentValue();
}
compiler_type = valobj_sp->GetCompilerType();
} else {
@@ -1080,7 +1081,8 @@ protected:
/// of the expression, so convert to that if we found a valid type.
CompilerType compiler_type(valobj_sp->GetCompilerType());
- std::optional<uint64_t> valobj_size = valobj_sp->GetByteSize();
+ std::optional<uint64_t> valobj_size =
+ llvm::expectedToOptional(valobj_sp->GetByteSize());
// Set the type as a uint8_t array if the size being watched is
// larger than the ValueObject's size (which is probably the size
// of a pointer).