From 113f56fbb80e8d6f705be19f8ae169a3fee2e4f8 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Sat, 25 Jul 2020 08:27:21 -0700 Subject: Unify the return value of GetByteSize to an llvm::Optional (NFC-ish) This cleanup patch unifies all methods called GetByteSize() in the ValueObject hierarchy to return an optional, like the methods in CompilerType do. This means fewer magic 0 values, which could fix bugs down the road in languages where types can have a size of zero, such as Swift and C (but not C++). Differential Revision: https://reviews.llvm.org/D84285 This re-lands the patch with bogus :m_byte_size(0) initalizations removed. --- lldb/source/Commands/CommandObjectWatchpoint.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lldb/source/Commands/CommandObjectWatchpoint.cpp') diff --git a/lldb/source/Commands/CommandObjectWatchpoint.cpp b/lldb/source/Commands/CommandObjectWatchpoint.cpp index ce46629..c2a008a 100644 --- a/lldb/source/Commands/CommandObjectWatchpoint.cpp +++ b/lldb/source/Commands/CommandObjectWatchpoint.cpp @@ -905,7 +905,7 @@ protected: // We're in business. // Find out the size of this variable. size = m_option_watchpoint.watch_size == 0 - ? valobj_sp->GetByteSize() + ? valobj_sp->GetByteSize().getValueOr(0) : m_option_watchpoint.watch_size; } compiler_type = valobj_sp->GetCompilerType(); -- cgit v1.1