[Lldb-commits] [lldb] 300a39b - Revert "Change GetNumChildren()/CalculateNumChildren() methods return llvm::Expected (#84219)"
Florian Mayer via lldb-commits
lldb-commits at lists.llvm.org
Fri Mar 8 12:16:39 PST 2024
Author: Florian Mayer
Date: 2024-03-08T12:14:22-08:00
New Revision: 300a39bdad4593fdc2618eb28f6e838df735619a
URL: https://github.com/llvm/llvm-project/commit/300a39bdad4593fdc2618eb28f6e838df735619a
DIFF: https://github.com/llvm/llvm-project/commit/300a39bdad4593fdc2618eb28f6e838df735619a.diff
LOG: Revert "Change GetNumChildren()/CalculateNumChildren() methods return llvm::Expected (#84219)"
This reverts commit 99118c809367d518ffe4de60c16da953744b68b9.
Added:
Modified:
lldb/include/lldb/Core/ValueObject.h
lldb/include/lldb/Core/ValueObjectCast.h
lldb/include/lldb/Core/ValueObjectChild.h
lldb/include/lldb/Core/ValueObjectConstResult.h
lldb/include/lldb/Core/ValueObjectDynamicValue.h
lldb/include/lldb/Core/ValueObjectMemory.h
lldb/include/lldb/Core/ValueObjectRegister.h
lldb/include/lldb/Core/ValueObjectSyntheticFilter.h
lldb/include/lldb/Core/ValueObjectVTable.h
lldb/include/lldb/Core/ValueObjectVariable.h
lldb/include/lldb/DataFormatters/TypeSynthetic.h
lldb/include/lldb/DataFormatters/VectorIterator.h
lldb/include/lldb/Symbol/CompilerType.h
lldb/include/lldb/Symbol/Type.h
lldb/include/lldb/Symbol/TypeSystem.h
lldb/include/lldb/Target/StackFrameRecognizer.h
lldb/include/lldb/Utility/Log.h
lldb/source/API/SBValue.cpp
lldb/source/Core/FormatEntity.cpp
lldb/source/Core/IOHandlerCursesGUI.cpp
lldb/source/Core/ValueObject.cpp
lldb/source/Core/ValueObjectCast.cpp
lldb/source/Core/ValueObjectChild.cpp
lldb/source/Core/ValueObjectConstResult.cpp
lldb/source/Core/ValueObjectDynamicValue.cpp
lldb/source/Core/ValueObjectMemory.cpp
lldb/source/Core/ValueObjectRegister.cpp
lldb/source/Core/ValueObjectSyntheticFilter.cpp
lldb/source/Core/ValueObjectVTable.cpp
lldb/source/Core/ValueObjectVariable.cpp
lldb/source/DataFormatters/FormatManager.cpp
lldb/source/DataFormatters/TypeSynthetic.cpp
lldb/source/DataFormatters/ValueObjectPrinter.cpp
lldb/source/DataFormatters/VectorType.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp
lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp
lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp
lldb/source/Plugins/Language/CPlusPlus/Coroutines.cpp
lldb/source/Plugins/Language/CPlusPlus/Coroutines.h
lldb/source/Plugins/Language/CPlusPlus/GenericBitset.cpp
lldb/source/Plugins/Language/CPlusPlus/GenericOptional.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxx.h
lldb/source/Plugins/Language/CPlusPlus/LibCxxAtomic.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxQueue.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxRangesRefView.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxSpan.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxTuple.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxValarray.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxVariant.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp
lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
lldb/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp
lldb/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
lldb/source/Plugins/Language/ObjC/Cocoa.cpp
lldb/source/Plugins/Language/ObjC/NSArray.cpp
lldb/source/Plugins/Language/ObjC/NSDictionary.cpp
lldb/source/Plugins/Language/ObjC/NSError.cpp
lldb/source/Plugins/Language/ObjC/NSException.cpp
lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp
lldb/source/Plugins/Language/ObjC/NSSet.cpp
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
lldb/source/Symbol/CompilerType.cpp
lldb/source/Symbol/Type.cpp
lldb/source/Symbol/Variable.cpp
lldb/source/Target/StackFrame.cpp
Removed:
################################################################################
diff --git a/lldb/include/lldb/Core/ValueObject.h b/lldb/include/lldb/Core/ValueObject.h
index e7e35e2b2bffc0..b4d2c8098edc71 100644
--- a/lldb/include/lldb/Core/ValueObject.h
+++ b/lldb/include/lldb/Core/ValueObject.h
@@ -476,13 +476,7 @@ class ValueObject {
virtual size_t GetIndexOfChildWithName(llvm::StringRef name);
- llvm::Expected<uint32_t> GetNumChildren(uint32_t max = UINT32_MAX);
- /// Like \c GetNumChildren but returns 0 on error. You probably
- /// shouldn't be using this function. It exists primarily to ease the
- /// transition to more pervasive error handling while not all APIs
- /// have been updated.
- uint32_t GetNumChildrenIgnoringErrors(uint32_t max = UINT32_MAX);
- bool HasChildren() { return GetNumChildrenIgnoringErrors() > 0; }
+ uint32_t GetNumChildren(uint32_t max = UINT32_MAX);
const Value &GetValue() const { return m_value; }
@@ -964,8 +958,7 @@ class ValueObject {
int32_t synthetic_index);
/// Should only be called by ValueObject::GetNumChildren().
- virtual llvm::Expected<uint32_t>
- CalculateNumChildren(uint32_t max = UINT32_MAX) = 0;
+ virtual uint32_t CalculateNumChildren(uint32_t max = UINT32_MAX) = 0;
void SetNumChildren(uint32_t num_children);
diff --git a/lldb/include/lldb/Core/ValueObjectCast.h b/lldb/include/lldb/Core/ValueObjectCast.h
index ba25e166f32688..51c647680d5227 100644
--- a/lldb/include/lldb/Core/ValueObjectCast.h
+++ b/lldb/include/lldb/Core/ValueObjectCast.h
@@ -33,7 +33,7 @@ class ValueObjectCast : public ValueObject {
std::optional<uint64_t> GetByteSize() override;
- llvm::Expected<uint32_t> CalculateNumChildren(uint32_t max) override;
+ uint32_t CalculateNumChildren(uint32_t max) override;
lldb::ValueType GetValueType() const override;
diff --git a/lldb/include/lldb/Core/ValueObjectChild.h b/lldb/include/lldb/Core/ValueObjectChild.h
index 1f88e607cb5737..47a13be08bb83b 100644
--- a/lldb/include/lldb/Core/ValueObjectChild.h
+++ b/lldb/include/lldb/Core/ValueObjectChild.h
@@ -39,7 +39,7 @@ class ValueObjectChild : public ValueObject {
lldb::ValueType GetValueType() const override;
- llvm::Expected<uint32_t> CalculateNumChildren(uint32_t max) override;
+ uint32_t CalculateNumChildren(uint32_t max) override;
ConstString GetTypeName() override;
diff --git a/lldb/include/lldb/Core/ValueObjectConstResult.h b/lldb/include/lldb/Core/ValueObjectConstResult.h
index 37dc0867f26c9e..9f1246cf2a7874 100644
--- a/lldb/include/lldb/Core/ValueObjectConstResult.h
+++ b/lldb/include/lldb/Core/ValueObjectConstResult.h
@@ -67,7 +67,7 @@ class ValueObjectConstResult : public ValueObject {
lldb::ValueType GetValueType() const override;
- llvm::Expected<uint32_t> CalculateNumChildren(uint32_t max) override;
+ uint32_t CalculateNumChildren(uint32_t max) override;
ConstString GetTypeName() override;
diff --git a/lldb/include/lldb/Core/ValueObjectDynamicValue.h b/lldb/include/lldb/Core/ValueObjectDynamicValue.h
index 82c20eee0cd42d..21a9b409fd5bd7 100644
--- a/lldb/include/lldb/Core/ValueObjectDynamicValue.h
+++ b/lldb/include/lldb/Core/ValueObjectDynamicValue.h
@@ -43,7 +43,7 @@ class ValueObjectDynamicValue : public ValueObject {
ConstString GetDisplayTypeName() override;
- llvm::Expected<uint32_t> CalculateNumChildren(uint32_t max) override;
+ uint32_t CalculateNumChildren(uint32_t max) override;
lldb::ValueType GetValueType() const override;
diff --git a/lldb/include/lldb/Core/ValueObjectMemory.h b/lldb/include/lldb/Core/ValueObjectMemory.h
index a8fb0353d601b2..a74b325546b03c 100644
--- a/lldb/include/lldb/Core/ValueObjectMemory.h
+++ b/lldb/include/lldb/Core/ValueObjectMemory.h
@@ -47,7 +47,7 @@ class ValueObjectMemory : public ValueObject {
ConstString GetDisplayTypeName() override;
- llvm::Expected<uint32_t> CalculateNumChildren(uint32_t max) override;
+ uint32_t CalculateNumChildren(uint32_t max) override;
lldb::ValueType GetValueType() const override;
diff --git a/lldb/include/lldb/Core/ValueObjectRegister.h b/lldb/include/lldb/Core/ValueObjectRegister.h
index fec8566ba33d90..6c470c1a686503 100644
--- a/lldb/include/lldb/Core/ValueObjectRegister.h
+++ b/lldb/include/lldb/Core/ValueObjectRegister.h
@@ -47,7 +47,7 @@ class ValueObjectRegisterSet : public ValueObject {
ConstString GetQualifiedTypeName() override;
- llvm::Expected<uint32_t> CalculateNumChildren(uint32_t max) override;
+ uint32_t CalculateNumChildren(uint32_t max) override;
ValueObject *CreateChildAtIndex(size_t idx, bool synthetic_array_member,
int32_t synthetic_index) override;
@@ -95,7 +95,7 @@ class ValueObjectRegister : public ValueObject {
ConstString GetTypeName() override;
- llvm::Expected<uint32_t> CalculateNumChildren(uint32_t max) override;
+ uint32_t CalculateNumChildren(uint32_t max) override;
bool SetValueFromCString(const char *value_str, Status &error) override;
diff --git a/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h b/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h
index ca6d6c728005db..1e54babc94f395 100644
--- a/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h
+++ b/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h
@@ -47,7 +47,7 @@ class ValueObjectSynthetic : public ValueObject {
bool MightHaveChildren() override;
- llvm::Expected<uint32_t> CalculateNumChildren(uint32_t max) override;
+ uint32_t CalculateNumChildren(uint32_t max) override;
lldb::ValueType GetValueType() const override;
diff --git a/lldb/include/lldb/Core/ValueObjectVTable.h b/lldb/include/lldb/Core/ValueObjectVTable.h
index 4662f395a4dde9..e7e14fc83d7892 100644
--- a/lldb/include/lldb/Core/ValueObjectVTable.h
+++ b/lldb/include/lldb/Core/ValueObjectVTable.h
@@ -64,7 +64,7 @@ class ValueObjectVTable : public ValueObject {
std::optional<uint64_t> GetByteSize() override;
- llvm::Expected<uint32_t> CalculateNumChildren(uint32_t max) override;
+ uint32_t CalculateNumChildren(uint32_t max) override;
ValueObject *CreateChildAtIndex(size_t idx, bool synthetic_array_member,
int32_t synthetic_index) override;
diff --git a/lldb/include/lldb/Core/ValueObjectVariable.h b/lldb/include/lldb/Core/ValueObjectVariable.h
index db3847f14a0b5a..da270300df0b30 100644
--- a/lldb/include/lldb/Core/ValueObjectVariable.h
+++ b/lldb/include/lldb/Core/ValueObjectVariable.h
@@ -46,7 +46,7 @@ class ValueObjectVariable : public ValueObject {
ConstString GetDisplayTypeName() override;
- llvm::Expected<uint32_t> CalculateNumChildren(uint32_t max) override;
+ uint32_t CalculateNumChildren(uint32_t max) override;
lldb::ValueType GetValueType() const override;
diff --git a/lldb/include/lldb/DataFormatters/TypeSynthetic.h b/lldb/include/lldb/DataFormatters/TypeSynthetic.h
index ede7442a02bf6a..38f3ce0fa5f011 100644
--- a/lldb/include/lldb/DataFormatters/TypeSynthetic.h
+++ b/lldb/include/lldb/DataFormatters/TypeSynthetic.h
@@ -38,17 +38,13 @@ class SyntheticChildrenFrontEnd {
virtual ~SyntheticChildrenFrontEnd() = default;
- virtual llvm::Expected<uint32_t> CalculateNumChildren() = 0;
+ virtual uint32_t CalculateNumChildren() = 0;
- virtual llvm::Expected<uint32_t> CalculateNumChildren(uint32_t max) {
+ virtual uint32_t CalculateNumChildren(uint32_t max) {
auto count = CalculateNumChildren();
- if (!count)
- return count;
- return *count <= max ? *count : max;
+ return count <= max ? count : max;
}
- uint32_t CalculateNumChildrenIgnoringErrors(uint32_t max = UINT32_MAX);
-
virtual lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) = 0;
virtual size_t GetIndexOfChildWithName(ConstString name) = 0;
@@ -113,7 +109,7 @@ class SyntheticValueProviderFrontEnd : public SyntheticChildrenFrontEnd {
~SyntheticValueProviderFrontEnd() override = default;
- llvm::Expected<uint32_t> CalculateNumChildren() override { return 0; }
+ uint32_t CalculateNumChildren() override { return 0; }
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override { return nullptr; }
@@ -326,9 +322,7 @@ class TypeFilterImpl : public SyntheticChildren {
~FrontEnd() override = default;
- llvm::Expected<uint32_t> CalculateNumChildren() override {
- return filter->GetCount();
- }
+ uint32_t CalculateNumChildren() override { return filter->GetCount(); }
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override {
if (idx >= filter->GetCount())
@@ -432,9 +426,9 @@ class ScriptedSyntheticChildren : public SyntheticChildren {
bool IsValid();
- llvm::Expected<uint32_t> CalculateNumChildren() override;
+ uint32_t CalculateNumChildren() override;
- llvm::Expected<uint32_t> CalculateNumChildren(uint32_t max) override;
+ uint32_t CalculateNumChildren(uint32_t max) override;
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
diff --git a/lldb/include/lldb/DataFormatters/VectorIterator.h b/lldb/include/lldb/DataFormatters/VectorIterator.h
index 70bcf50ca1b1d2..7711b9de95dba8 100644
--- a/lldb/include/lldb/DataFormatters/VectorIterator.h
+++ b/lldb/include/lldb/DataFormatters/VectorIterator.h
@@ -24,7 +24,7 @@ class VectorIteratorSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
VectorIteratorSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp,
llvm::ArrayRef<ConstString> item_names);
- llvm::Expected<uint32_t> CalculateNumChildren() override;
+ uint32_t CalculateNumChildren() override;
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
diff --git a/lldb/include/lldb/Symbol/CompilerType.h b/lldb/include/lldb/Symbol/CompilerType.h
index c1dce4ccbf79c2..414c44275aaafc 100644
--- a/lldb/include/lldb/Symbol/CompilerType.h
+++ b/lldb/include/lldb/Symbol/CompilerType.h
@@ -386,9 +386,8 @@ class CompilerType {
std::optional<size_t> GetTypeBitAlign(ExecutionContextScope *exe_scope) const;
- llvm::Expected<uint32_t>
- GetNumChildren(bool omit_empty_base_classes,
- const ExecutionContext *exe_ctx) const;
+ uint32_t GetNumChildren(bool omit_empty_base_classes,
+ const ExecutionContext *exe_ctx) const;
lldb::BasicType GetBasicTypeEnumeration() const;
diff --git a/lldb/include/lldb/Symbol/Type.h b/lldb/include/lldb/Symbol/Type.h
index b5eac5fa732d67..acd1a769f13cd6 100644
--- a/lldb/include/lldb/Symbol/Type.h
+++ b/lldb/include/lldb/Symbol/Type.h
@@ -440,7 +440,7 @@ class Type : public std::enable_shared_from_this<Type>, public UserID {
std::optional<uint64_t> GetByteSize(ExecutionContextScope *exe_scope);
- llvm::Expected<uint32_t> GetNumChildren(bool omit_empty_base_classes);
+ uint32_t GetNumChildren(bool omit_empty_base_classes);
bool IsAggregateType();
diff --git a/lldb/include/lldb/Symbol/TypeSystem.h b/lldb/include/lldb/Symbol/TypeSystem.h
index f647fcbf1636ea..63829131556e87 100644
--- a/lldb/include/lldb/Symbol/TypeSystem.h
+++ b/lldb/include/lldb/Symbol/TypeSystem.h
@@ -300,10 +300,9 @@ class TypeSystem : public PluginInterface,
virtual lldb::Format GetFormat(lldb::opaque_compiler_type_t type) = 0;
- virtual llvm::Expected<uint32_t>
- GetNumChildren(lldb::opaque_compiler_type_t type,
- bool omit_empty_base_classes,
- const ExecutionContext *exe_ctx) = 0;
+ virtual uint32_t GetNumChildren(lldb::opaque_compiler_type_t type,
+ bool omit_empty_base_classes,
+ const ExecutionContext *exe_ctx) = 0;
virtual CompilerType GetBuiltinTypeByName(ConstString name);
diff --git a/lldb/include/lldb/Target/StackFrameRecognizer.h b/lldb/include/lldb/Target/StackFrameRecognizer.h
index 5e8e12b2a4e961..e111f4a4dc7029 100644
--- a/lldb/include/lldb/Target/StackFrameRecognizer.h
+++ b/lldb/include/lldb/Target/StackFrameRecognizer.h
@@ -164,8 +164,7 @@ class ValueObjectRecognizerSynthesizedValue : public ValueObject {
m_value = m_parent->GetValue();
return true;
}
- llvm::Expected<uint32_t>
- CalculateNumChildren(uint32_t max = UINT32_MAX) override {
+ uint32_t CalculateNumChildren(uint32_t max = UINT32_MAX) override {
return m_parent->GetNumChildren(max);
}
CompilerType GetCompilerTypeImpl() override {
diff --git a/lldb/include/lldb/Utility/Log.h b/lldb/include/lldb/Utility/Log.h
index 01876ad732d4b5..1fe28d61b9dacf 100644
--- a/lldb/include/lldb/Utility/Log.h
+++ b/lldb/include/lldb/Utility/Log.h
@@ -373,18 +373,4 @@ template <typename Cat> Log *GetLog(Cat mask) {
::llvm::consumeError(::std::move(error_private)); \
} while (0)
-// Write message to the verbose log, if error is set. In the log
-// message refer to the error with {0}. Error is cleared regardless of
-// whether logging is enabled.
-#define LLDB_LOG_ERRORV(log, error, ...) \
- do { \
- ::lldb_private::Log *log_private = (log); \
- ::llvm::Error error_private = (error); \
- if (log_private && log_private->GetVerbose() && error_private) { \
- log_private->FormatError(::std::move(error_private), __FILE__, __func__, \
- __VA_ARGS__); \
- } else \
- ::llvm::consumeError(::std::move(error_private)); \
- } while (0)
-
#endif // LLDB_UTILITY_LOG_H
diff --git a/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp
index 94a8f3ea319e89..89d26a1fbe2824 100644
--- a/lldb/source/API/SBValue.cpp
+++ b/lldb/source/API/SBValue.cpp
@@ -947,7 +947,7 @@ uint32_t SBValue::GetNumChildren(uint32_t max) {
ValueLocker locker;
lldb::ValueObjectSP value_sp(GetSP(locker));
if (value_sp)
- num_children = value_sp->GetNumChildrenIgnoringErrors(max);
+ num_children = value_sp->GetNumChildren(max);
return num_children;
}
diff --git a/lldb/source/Core/FormatEntity.cpp b/lldb/source/Core/FormatEntity.cpp
index cf82676beddabe..fa5eadc6ff4e9a 100644
--- a/lldb/source/Core/FormatEntity.cpp
+++ b/lldb/source/Core/FormatEntity.cpp
@@ -926,7 +926,7 @@ static bool DumpValue(Stream &s, const SymbolContext *sc,
s.PutChar('[');
if (index_higher < 0)
- index_higher = valobj->GetNumChildrenIgnoringErrors() - 1;
+ index_higher = valobj->GetNumChildren() - 1;
uint32_t max_num_children =
target->GetTargetSP()->GetMaximumNumberOfChildrenToDisplay();
diff --git a/lldb/source/Core/IOHandlerCursesGUI.cpp b/lldb/source/Core/IOHandlerCursesGUI.cpp
index f86dce247135f8..620e68a28510ef 100644
--- a/lldb/source/Core/IOHandlerCursesGUI.cpp
+++ b/lldb/source/Core/IOHandlerCursesGUI.cpp
@@ -4519,7 +4519,7 @@ struct Row {
calculated_children = true;
ValueObjectSP valobj = value.GetSP();
if (valobj) {
- const uint32_t num_children = valobj->GetNumChildrenIgnoringErrors();
+ const size_t num_children = valobj->GetNumChildren();
for (size_t i = 0; i < num_children; ++i) {
children.push_back(Row(valobj->GetChildAtIndex(i), this));
}
diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp
index d813044d02ff5f..0ed7f03be25c16 100644
--- a/lldb/source/Core/ValueObject.cpp
+++ b/lldb/source/Core/ValueObject.cpp
@@ -377,7 +377,7 @@ ValueObjectSP ValueObject::GetChildAtIndex(uint32_t idx, bool can_create) {
// We may need to update our value if we are dynamic
if (IsPossibleDynamicType())
UpdateValueIfNeeded(false);
- if (idx < GetNumChildrenIgnoringErrors()) {
+ if (idx < GetNumChildren()) {
// Check if we have already made the child value object?
if (can_create && !m_children.HasChildAtIndex(idx)) {
// No we haven't created the child at this index, so lets have our
@@ -440,7 +440,7 @@ ValueObjectSP ValueObject::GetChildMemberWithName(llvm::StringRef name,
return child_sp;
}
-llvm::Expected<uint32_t> ValueObject::GetNumChildren(uint32_t max) {
+uint32_t ValueObject::GetNumChildren(uint32_t max) {
UpdateValueIfNeeded();
if (max < UINT32_MAX) {
@@ -452,24 +452,11 @@ llvm::Expected<uint32_t> ValueObject::GetNumChildren(uint32_t max) {
}
if (!m_flags.m_children_count_valid) {
- auto num_children_or_err = CalculateNumChildren();
- if (num_children_or_err)
- SetNumChildren(*num_children_or_err);
- else
- return num_children_or_err;
+ SetNumChildren(CalculateNumChildren());
}
return m_children.GetChildrenCount();
}
-uint32_t ValueObject::GetNumChildrenIgnoringErrors(uint32_t max) {
- auto value_or_err = GetNumChildren(max);
- if (value_or_err)
- return *value_or_err;
- LLDB_LOG_ERRORV(GetLog(LLDBLog::DataFormatters), value_or_err.takeError(),
- "{0}");
- return 0;
-}
-
bool ValueObject::MightHaveChildren() {
bool has_children = false;
const uint32_t type_info = GetTypeInfo();
@@ -477,7 +464,7 @@ bool ValueObject::MightHaveChildren() {
if (type_info & (eTypeHasChildren | eTypeIsPointer | eTypeIsReference))
has_children = true;
} else {
- has_children = GetNumChildrenIgnoringErrors() > 0;
+ has_children = GetNumChildren() > 0;
}
return has_children;
}
@@ -1189,7 +1176,7 @@ bool ValueObject::DumpPrintableRepresentation(
if (flags.Test(eTypeIsArray)) {
if ((custom_format == eFormatBytes) ||
(custom_format == eFormatBytesWithASCII)) {
- const size_t count = GetNumChildrenIgnoringErrors();
+ const size_t count = GetNumChildren();
s << '[';
for (size_t low = 0; low < count; low++) {
@@ -1228,7 +1215,7 @@ bool ValueObject::DumpPrintableRepresentation(
// format should be printed
// directly
{
- const size_t count = GetNumChildrenIgnoringErrors();
+ const size_t count = GetNumChildren();
Format format = FormatManager::GetSingleItemFormat(custom_format);
@@ -1307,7 +1294,7 @@ bool ValueObject::DumpPrintableRepresentation(
break;
case eValueObjectRepresentationStyleChildrenCount:
- strm.Printf("%" PRIu64 "", (uint64_t)GetNumChildrenIgnoringErrors());
+ strm.Printf("%" PRIu64 "", (uint64_t)GetNumChildren());
str = strm.GetString();
break;
@@ -2333,9 +2320,7 @@ ValueObjectSP ValueObject::GetValueForExpressionPath_Impl(
child_valobj_sp = root->GetSyntheticArrayMember(index, true);
if (!child_valobj_sp)
if (root->HasSyntheticValue() &&
- llvm::expectedToStdOptional(
- root->GetSyntheticValue()->GetNumChildren())
- .value_or(0) > index)
+ root->GetSyntheticValue()->GetNumChildren() > index)
child_valobj_sp =
root->GetSyntheticValue()->GetChildAtIndex(index);
if (child_valobj_sp) {
diff --git a/lldb/source/Core/ValueObjectCast.cpp b/lldb/source/Core/ValueObjectCast.cpp
index c8e31641514170..a5c555f86b1372 100644
--- a/lldb/source/Core/ValueObjectCast.cpp
+++ b/lldb/source/Core/ValueObjectCast.cpp
@@ -41,13 +41,11 @@ ValueObjectCast::~ValueObjectCast() = default;
CompilerType ValueObjectCast::GetCompilerTypeImpl() { return m_cast_type; }
-llvm::Expected<uint32_t> ValueObjectCast::CalculateNumChildren(uint32_t max) {
+uint32_t ValueObjectCast::CalculateNumChildren(uint32_t max) {
ExecutionContext exe_ctx(GetExecutionContextRef());
auto children_count = GetCompilerType().GetNumChildren(
true, &exe_ctx);
- if (!children_count)
- return children_count;
- return *children_count <= max ? *children_count : max;
+ return children_count <= max ? children_count : max;
}
std::optional<uint64_t> ValueObjectCast::GetByteSize() {
diff --git a/lldb/source/Core/ValueObjectChild.cpp b/lldb/source/Core/ValueObjectChild.cpp
index c6a97dd1a5cd7e..2e55dd7726bdd9 100644
--- a/lldb/source/Core/ValueObjectChild.cpp
+++ b/lldb/source/Core/ValueObjectChild.cpp
@@ -49,12 +49,10 @@ lldb::ValueType ValueObjectChild::GetValueType() const {
return m_parent->GetValueType();
}
-llvm::Expected<uint32_t> ValueObjectChild::CalculateNumChildren(uint32_t max) {
+uint32_t ValueObjectChild::CalculateNumChildren(uint32_t max) {
ExecutionContext exe_ctx(GetExecutionContextRef());
auto children_count = GetCompilerType().GetNumChildren(true, &exe_ctx);
- if (!children_count)
- return children_count;
- return *children_count <= max ? *children_count : max;
+ return children_count <= max ? children_count : max;
}
static void AdjustForBitfieldness(ConstString &name,
diff --git a/lldb/source/Core/ValueObjectConstResult.cpp b/lldb/source/Core/ValueObjectConstResult.cpp
index 8ac2c1cac2f665..5c7aa4452b70db 100644
--- a/lldb/source/Core/ValueObjectConstResult.cpp
+++ b/lldb/source/Core/ValueObjectConstResult.cpp
@@ -216,13 +216,10 @@ std::optional<uint64_t> ValueObjectConstResult::GetByteSize() {
void ValueObjectConstResult::SetByteSize(size_t size) { m_byte_size = size; }
-llvm::Expected<uint32_t>
-ValueObjectConstResult::CalculateNumChildren(uint32_t max) {
+uint32_t ValueObjectConstResult::CalculateNumChildren(uint32_t max) {
ExecutionContext exe_ctx(GetExecutionContextRef());
auto children_count = GetCompilerType().GetNumChildren(true, &exe_ctx);
- if (!children_count)
- return children_count;
- return *children_count <= max ? *children_count : max;
+ return children_count <= max ? children_count : max;
}
ConstString ValueObjectConstResult::GetTypeName() {
diff --git a/lldb/source/Core/ValueObjectDynamicValue.cpp b/lldb/source/Core/ValueObjectDynamicValue.cpp
index 4695febdf8ca12..4e64760371ae52 100644
--- a/lldb/source/Core/ValueObjectDynamicValue.cpp
+++ b/lldb/source/Core/ValueObjectDynamicValue.cpp
@@ -85,15 +85,12 @@ ConstString ValueObjectDynamicValue::GetDisplayTypeName() {
return m_parent->GetDisplayTypeName();
}
-llvm::Expected<uint32_t>
-ValueObjectDynamicValue::CalculateNumChildren(uint32_t max) {
+uint32_t ValueObjectDynamicValue::CalculateNumChildren(uint32_t max) {
const bool success = UpdateValueIfNeeded(false);
if (success && m_dynamic_type_info.HasType()) {
ExecutionContext exe_ctx(GetExecutionContextRef());
auto children_count = GetCompilerType().GetNumChildren(true, &exe_ctx);
- if (!children_count)
- return children_count;
- return *children_count <= max ? *children_count : max;
+ return children_count <= max ? children_count : max;
} else
return m_parent->GetNumChildren(max);
}
diff --git a/lldb/source/Core/ValueObjectMemory.cpp b/lldb/source/Core/ValueObjectMemory.cpp
index f555ab82f4418a..7f68236c7884ec 100644
--- a/lldb/source/Core/ValueObjectMemory.cpp
+++ b/lldb/source/Core/ValueObjectMemory.cpp
@@ -126,21 +126,17 @@ ConstString ValueObjectMemory::GetDisplayTypeName() {
return m_compiler_type.GetDisplayTypeName();
}
-llvm::Expected<uint32_t> ValueObjectMemory::CalculateNumChildren(uint32_t max) {
+uint32_t ValueObjectMemory::CalculateNumChildren(uint32_t max) {
if (m_type_sp) {
auto child_count = m_type_sp->GetNumChildren(true);
- if (!child_count)
- return child_count;
- return *child_count <= max ? *child_count : max;
+ return child_count <= max ? child_count : max;
}
ExecutionContext exe_ctx(GetExecutionContextRef());
const bool omit_empty_base_classes = true;
auto child_count =
m_compiler_type.GetNumChildren(omit_empty_base_classes, &exe_ctx);
- if (!child_count)
- return child_count;
- return *child_count <= max ? *child_count : max;
+ return child_count <= max ? child_count : max;
}
std::optional<uint64_t> ValueObjectMemory::GetByteSize() {
diff --git a/lldb/source/Core/ValueObjectRegister.cpp b/lldb/source/Core/ValueObjectRegister.cpp
index 9d9da8bb119df2..d4c144cc7edb9a 100644
--- a/lldb/source/Core/ValueObjectRegister.cpp
+++ b/lldb/source/Core/ValueObjectRegister.cpp
@@ -74,8 +74,7 @@ ConstString ValueObjectRegisterSet::GetQualifiedTypeName() {
return ConstString();
}
-llvm::Expected<uint32_t>
-ValueObjectRegisterSet::CalculateNumChildren(uint32_t max) {
+uint32_t ValueObjectRegisterSet::CalculateNumChildren(uint32_t max) {
const RegisterSet *reg_set = m_reg_ctx_sp->GetRegisterSet(m_reg_set_idx);
if (reg_set) {
auto reg_count = reg_set->num_registers;
@@ -119,7 +118,7 @@ ValueObject *ValueObjectRegisterSet::CreateChildAtIndex(
size_t idx, bool synthetic_array_member, int32_t synthetic_index) {
ValueObject *valobj = nullptr;
if (m_reg_ctx_sp && m_reg_set) {
- uint32_t num_children = GetNumChildrenIgnoringErrors();
+ const size_t num_children = GetNumChildren();
if (idx < num_children)
valobj = new ValueObjectRegister(
*this, m_reg_ctx_sp,
@@ -221,13 +220,10 @@ ConstString ValueObjectRegister::GetTypeName() {
return m_type_name;
}
-llvm::Expected<uint32_t>
-ValueObjectRegister::CalculateNumChildren(uint32_t max) {
+uint32_t ValueObjectRegister::CalculateNumChildren(uint32_t max) {
ExecutionContext exe_ctx(GetExecutionContextRef());
auto children_count = GetCompilerType().GetNumChildren(true, &exe_ctx);
- if (!children_count)
- return children_count;
- return *children_count <= max ? *children_count : max;
+ return children_count <= max ? children_count : max;
}
std::optional<uint64_t> ValueObjectRegister::GetByteSize() {
diff --git a/lldb/source/Core/ValueObjectSyntheticFilter.cpp b/lldb/source/Core/ValueObjectSyntheticFilter.cpp
index adac1b400705e2..7f8a9a34cb35df 100644
--- a/lldb/source/Core/ValueObjectSyntheticFilter.cpp
+++ b/lldb/source/Core/ValueObjectSyntheticFilter.cpp
@@ -31,9 +31,7 @@ class DummySyntheticFrontEnd : public SyntheticChildrenFrontEnd {
DummySyntheticFrontEnd(ValueObject &backend)
: SyntheticChildrenFrontEnd(backend) {}
- llvm::Expected<uint32_t> CalculateNumChildren() override {
- return m_backend.GetNumChildren();
- }
+ uint32_t CalculateNumChildren() override { return m_backend.GetNumChildren(); }
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override {
return m_backend.GetChildAtIndex(idx);
@@ -86,8 +84,7 @@ ConstString ValueObjectSynthetic::GetDisplayTypeName() {
return m_parent->GetDisplayTypeName();
}
-llvm::Expected<uint32_t>
-ValueObjectSynthetic::CalculateNumChildren(uint32_t max) {
+uint32_t ValueObjectSynthetic::CalculateNumChildren(uint32_t max) {
Log *log = GetLog(LLDBLog::DataFormatters);
UpdateValueIfNeeded();
@@ -95,23 +92,18 @@ ValueObjectSynthetic::CalculateNumChildren(uint32_t max) {
return m_synthetic_children_count <= max ? m_synthetic_children_count : max;
if (max < UINT32_MAX) {
- auto num_children = m_synth_filter_up->CalculateNumChildren(max);
+ size_t num_children = m_synth_filter_up->CalculateNumChildren(max);
LLDB_LOGF(log,
"[ValueObjectSynthetic::CalculateNumChildren] for VO of name "
- "%s and type %s, the filter returned %u child values",
- GetName().AsCString(), GetTypeName().AsCString(),
- num_children ? *num_children : 0);
+ "%s and type %s, the filter returned %zu child values",
+ GetName().AsCString(), GetTypeName().AsCString(), num_children);
return num_children;
} else {
- auto num_children_or_err = m_synth_filter_up->CalculateNumChildren(max);
- if (!num_children_or_err) {
- m_synthetic_children_count = 0;
- return num_children_or_err;
- }
- auto num_children = (m_synthetic_children_count = *num_children_or_err);
+ size_t num_children = (m_synthetic_children_count =
+ m_synth_filter_up->CalculateNumChildren(max));
LLDB_LOGF(log,
"[ValueObjectSynthetic::CalculateNumChildren] for VO of name "
- "%s and type %s, the filter returned %u child values",
+ "%s and type %s, the filter returned %zu child values",
GetName().AsCString(), GetTypeName().AsCString(), num_children);
return num_children;
}
diff --git a/lldb/source/Core/ValueObjectVTable.cpp b/lldb/source/Core/ValueObjectVTable.cpp
index 9bfe8dc9700d30..4d1cbb8d2f6fc2 100644
--- a/lldb/source/Core/ValueObjectVTable.cpp
+++ b/lldb/source/Core/ValueObjectVTable.cpp
@@ -33,9 +33,7 @@ class ValueObjectVTableChild : public ValueObject {
std::optional<uint64_t> GetByteSize() override { return m_addr_size; };
- llvm::Expected<uint32_t> CalculateNumChildren(uint32_t max) override {
- return 0;
- };
+ uint32_t CalculateNumChildren(uint32_t max) override { return 0; };
ValueType GetValueType() const override { return eValueTypeVTableEntry; };
@@ -161,7 +159,7 @@ std::optional<uint64_t> ValueObjectVTable::GetByteSize() {
return std::nullopt;
}
-llvm::Expected<uint32_t> ValueObjectVTable::CalculateNumChildren(uint32_t max) {
+uint32_t ValueObjectVTable::CalculateNumChildren(uint32_t max) {
if (UpdateValueIfNeeded(false))
return m_num_vtable_entries <= max ? m_num_vtable_entries : max;
return 0;
diff --git a/lldb/source/Core/ValueObjectVariable.cpp b/lldb/source/Core/ValueObjectVariable.cpp
index fb29c22c0ab5af..dc62bb6358dc97 100644
--- a/lldb/source/Core/ValueObjectVariable.cpp
+++ b/lldb/source/Core/ValueObjectVariable.cpp
@@ -94,8 +94,7 @@ ConstString ValueObjectVariable::GetQualifiedTypeName() {
return ConstString();
}
-llvm::Expected<uint32_t>
-ValueObjectVariable::CalculateNumChildren(uint32_t max) {
+uint32_t ValueObjectVariable::CalculateNumChildren(uint32_t max) {
CompilerType type(GetCompilerType());
if (!type.IsValid())
@@ -104,9 +103,7 @@ ValueObjectVariable::CalculateNumChildren(uint32_t max) {
ExecutionContext exe_ctx(GetExecutionContextRef());
const bool omit_empty_base_classes = true;
auto child_count = type.GetNumChildren(omit_empty_base_classes, &exe_ctx);
- if (!child_count)
- return child_count;
- return *child_count <= max ? *child_count : max;
+ return child_count <= max ? child_count : max;
}
std::optional<uint64_t> ValueObjectVariable::GetByteSize() {
diff --git a/lldb/source/DataFormatters/FormatManager.cpp b/lldb/source/DataFormatters/FormatManager.cpp
index d7ba5b4b70c949..092fa3c8ce496d 100644
--- a/lldb/source/DataFormatters/FormatManager.cpp
+++ b/lldb/source/DataFormatters/FormatManager.cpp
@@ -451,13 +451,8 @@ bool FormatManager::ShouldPrintAsOneLiner(ValueObject &valobj) {
if (valobj.GetSummaryFormat().get() != nullptr)
return valobj.GetSummaryFormat()->IsOneLiner();
- auto num_children = valobj.GetNumChildren();
- if (!num_children) {
- llvm::consumeError(num_children.takeError());
- return true;
- }
// no children, no party
- if (*num_children == 0)
+ if (valobj.GetNumChildren() == 0)
return false;
// ask the type if it has any opinion about this eLazyBoolCalculate == no
@@ -476,7 +471,7 @@ bool FormatManager::ShouldPrintAsOneLiner(ValueObject &valobj) {
size_t total_children_name_len = 0;
- for (size_t idx = 0; idx < *num_children; idx++) {
+ for (size_t idx = 0; idx < valobj.GetNumChildren(); idx++) {
bool is_synth_val = false;
ValueObjectSP child_sp(valobj.GetChildAtIndex(idx));
// something is wrong here - bail out
@@ -528,7 +523,7 @@ bool FormatManager::ShouldPrintAsOneLiner(ValueObject &valobj) {
}
// if this child has children..
- if (child_sp->HasChildren()) {
+ if (child_sp->GetNumChildren()) {
// ...and no summary...
// (if it had a summary and the summary wanted children, we would have
// bailed out anyway
diff --git a/lldb/source/DataFormatters/TypeSynthetic.cpp b/lldb/source/DataFormatters/TypeSynthetic.cpp
index e3f613606aa87e..0ae38c4d31f26b 100644
--- a/lldb/source/DataFormatters/TypeSynthetic.cpp
+++ b/lldb/source/DataFormatters/TypeSynthetic.cpp
@@ -115,17 +115,6 @@ std::string CXXSyntheticChildren::GetDescription() {
return std::string(sstr.GetString());
}
-uint32_t
-SyntheticChildrenFrontEnd::CalculateNumChildrenIgnoringErrors(uint32_t max) {
- auto value_or_err = CalculateNumChildren(max);
- if (value_or_err)
- return *value_or_err;
- Log *log = GetLog(LLDBLog::DataFormatters);
- if (log && log->GetVerbose())
- LLDB_LOG_ERROR(log, value_or_err.takeError(), "{0}");
- return 0;
-}
-
lldb::ValueObjectSP SyntheticChildrenFrontEnd::CreateValueObjectFromExpression(
llvm::StringRef name, llvm::StringRef expression,
const ExecutionContext &exe_ctx) {
@@ -189,15 +178,13 @@ bool ScriptedSyntheticChildren::FrontEnd::IsValid() {
return (m_wrapper_sp && m_wrapper_sp->IsValid() && m_interpreter);
}
-llvm::Expected<uint32_t>
-ScriptedSyntheticChildren::FrontEnd::CalculateNumChildren() {
+uint32_t ScriptedSyntheticChildren::FrontEnd::CalculateNumChildren() {
if (!m_wrapper_sp || m_interpreter == nullptr)
return 0;
return m_interpreter->CalculateNumChildren(m_wrapper_sp, UINT32_MAX);
}
-llvm::Expected<uint32_t>
-ScriptedSyntheticChildren::FrontEnd::CalculateNumChildren(uint32_t max) {
+uint32_t ScriptedSyntheticChildren::FrontEnd::CalculateNumChildren(uint32_t max) {
if (!m_wrapper_sp || m_interpreter == nullptr)
return 0;
return m_interpreter->CalculateNumChildren(m_wrapper_sp, max);
diff --git a/lldb/source/DataFormatters/ValueObjectPrinter.cpp b/lldb/source/DataFormatters/ValueObjectPrinter.cpp
index b853199e878c95..46e50a8d421a71 100644
--- a/lldb/source/DataFormatters/ValueObjectPrinter.cpp
+++ b/lldb/source/DataFormatters/ValueObjectPrinter.cpp
@@ -627,7 +627,7 @@ uint32_t ValueObjectPrinter::GetMaxNumChildrenToPrint(bool &print_dotdotdot) {
if (m_options.m_pointer_as_array)
return m_options.m_pointer_as_array.m_element_count;
- uint32_t num_children = synth_valobj.GetNumChildrenIgnoringErrors();
+ size_t num_children = synth_valobj.GetNumChildren();
print_dotdotdot = false;
if (num_children) {
const size_t max_num_children = GetMostSpecializedValue()
diff --git a/lldb/source/DataFormatters/VectorType.cpp b/lldb/source/DataFormatters/VectorType.cpp
index 19de204c24353a..a0626a8cba7788 100644
--- a/lldb/source/DataFormatters/VectorType.cpp
+++ b/lldb/source/DataFormatters/VectorType.cpp
@@ -9,7 +9,6 @@
#include "lldb/DataFormatters/VectorType.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"
@@ -225,16 +224,10 @@ class VectorTypeSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
~VectorTypeSyntheticFrontEnd() override = default;
- llvm::Expected<uint32_t> CalculateNumChildren() override {
- return m_num_children;
- }
+ uint32_t CalculateNumChildren() override { return m_num_children; }
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override {
- auto num_children_or_err = CalculateNumChildren();
- if (!num_children_or_err)
- return ValueObjectConstResult::Create(
- nullptr, Status(num_children_or_err.takeError()));
- if (idx >= *num_children_or_err)
+ if (idx >= CalculateNumChildren())
return {};
std::optional<uint64_t> size = m_child_type.GetByteSize(nullptr);
if (!size)
@@ -273,7 +266,7 @@ class VectorTypeSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
size_t GetIndexOfChildWithName(ConstString name) override {
const char *item_name = name.GetCString();
uint32_t idx = ExtractIndexFromString(item_name);
- if (idx < UINT32_MAX && idx >= CalculateNumChildrenIgnoringErrors())
+ if (idx < UINT32_MAX && idx >= CalculateNumChildren())
return UINT32_MAX;
return idx;
}
@@ -300,8 +293,7 @@ bool lldb_private::formatters::VectorTypeSummaryProvider(
s.PutChar('(');
bool first = true;
- size_t idx = 0,
- len = synthetic_children->CalculateNumChildrenIgnoringErrors();
+ size_t idx = 0, len = synthetic_children->CalculateNumChildren();
for (; idx < len; idx++) {
auto child_sp = synthetic_children->GetChildAtIndex(idx);
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp
index 3d43ed3f99ffba..b48bbbecc0cd52 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp
@@ -229,7 +229,7 @@ void AddLambdaCaptureDecls(StreamString &stream, StackFrame *frame,
assert(frame);
if (auto thisValSP = ClangExpressionUtil::GetLambdaValueObject(frame)) {
- uint32_t numChildren = thisValSP->GetNumChildrenIgnoringErrors();
+ uint32_t numChildren = thisValSP->GetNumChildren();
for (uint32_t i = 0; i < numChildren; ++i) {
auto childVal = thisValSP->GetChildAtIndex(i);
ConstString childName(childVal ? childVal->GetName() : ConstString(""));
diff --git a/lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp b/lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp
index b2781aa5e7db15..72293c5331f40d 100644
--- a/lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp
+++ b/lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp
@@ -27,8 +27,6 @@
#include "lldb/Target/StopInfo.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
-#include "lldb/Utility/LLDBLog.h"
-#include "lldb/Utility/Log.h"
#include "lldb/Utility/RegularExpression.h"
#include "lldb/Utility/Stream.h"
@@ -213,7 +211,7 @@ CreateStackTrace(ValueObjectSP o,
auto trace_sp = std::make_shared<StructuredData::Array>();
ValueObjectSP trace_value_object =
o->GetValueForExpressionPath(trace_item_name.c_str());
- size_t count = trace_value_object->GetNumChildrenIgnoringErrors();
+ size_t count = trace_value_object->GetNumChildren();
for (size_t j = 0; j < count; j++) {
addr_t trace_addr =
trace_value_object->GetChildAtIndex(j)->GetValueAsUnsigned(0);
diff --git a/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp b/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp
index 9a6e135e008348..ef0f67d1e9f9e7 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp
@@ -74,7 +74,7 @@ class BlockPointerSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
~BlockPointerSyntheticFrontEnd() override = default;
- llvm::Expected<uint32_t> CalculateNumChildren() override {
+ uint32_t CalculateNumChildren() override {
const bool omit_empty_base_classes = false;
return m_block_struct_type.GetNumChildren(omit_empty_base_classes, nullptr);
}
@@ -84,7 +84,7 @@ class BlockPointerSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
return lldb::ValueObjectSP();
}
- if (idx >= CalculateNumChildrenIgnoringErrors()) {
+ if (idx >= CalculateNumChildren()) {
return lldb::ValueObjectSP();
}
diff --git a/lldb/source/Plugins/Language/CPlusPlus/Coroutines.cpp b/lldb/source/Plugins/Language/CPlusPlus/Coroutines.cpp
index 5e63d1d7b21453..3827f9c21effab 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/Coroutines.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/Coroutines.cpp
@@ -11,8 +11,6 @@
#include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
#include "lldb/Symbol/Function.h"
#include "lldb/Symbol/VariableList.h"
-#include "lldb/Utility/LLDBLog.h"
-#include "lldb/Utility/Log.h"
using namespace lldb;
using namespace lldb_private;
@@ -24,7 +22,7 @@ static lldb::addr_t GetCoroFramePtrFromHandle(ValueObjectSP valobj_sp) {
// We expect a single pointer in the `coroutine_handle` class.
// We don't care about its name.
- if (valobj_sp->GetNumChildrenIgnoringErrors() != 1)
+ if (valobj_sp->GetNumChildren() != 1)
return LLDB_INVALID_ADDRESS;
ValueObjectSP ptr_sp(valobj_sp->GetChildAtIndex(0));
if (!ptr_sp)
@@ -106,8 +104,8 @@ lldb_private::formatters::StdlibCoroutineHandleSyntheticFrontEnd::
lldb_private::formatters::StdlibCoroutineHandleSyntheticFrontEnd::
~StdlibCoroutineHandleSyntheticFrontEnd() = default;
-llvm::Expected<uint32_t> lldb_private::formatters::
- StdlibCoroutineHandleSyntheticFrontEnd::CalculateNumChildren() {
+uint32_t lldb_private::formatters::StdlibCoroutineHandleSyntheticFrontEnd::
+ CalculateNumChildren() {
if (!m_resume_ptr_sp || !m_destroy_ptr_sp)
return 0;
diff --git a/lldb/source/Plugins/Language/CPlusPlus/Coroutines.h b/lldb/source/Plugins/Language/CPlusPlus/Coroutines.h
index 1d4bc65e26374f..5c6a80b57ff424 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/Coroutines.h
+++ b/lldb/source/Plugins/Language/CPlusPlus/Coroutines.h
@@ -34,7 +34,7 @@ class StdlibCoroutineHandleSyntheticFrontEnd
~StdlibCoroutineHandleSyntheticFrontEnd() override;
- llvm::Expected<uint32_t> CalculateNumChildren() override;
+ uint32_t CalculateNumChildren() override;
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
diff --git a/lldb/source/Plugins/Language/CPlusPlus/GenericBitset.cpp b/lldb/source/Plugins/Language/CPlusPlus/GenericBitset.cpp
index 33955dccb6ccc3..6a9da1d17c7620 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/GenericBitset.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/GenericBitset.cpp
@@ -34,9 +34,7 @@ class GenericBitsetFrontEnd : public SyntheticChildrenFrontEnd {
bool MightHaveChildren() override { return true; }
lldb::ChildCacheState Update() override;
- llvm::Expected<uint32_t> CalculateNumChildren() override {
- return m_elements.size();
- }
+ uint32_t CalculateNumChildren() override { return m_elements.size(); }
ValueObjectSP GetChildAtIndex(uint32_t idx) override;
private:
diff --git a/lldb/source/Plugins/Language/CPlusPlus/GenericOptional.cpp b/lldb/source/Plugins/Language/CPlusPlus/GenericOptional.cpp
index 23756de7f1e66e..c06afb53eb8aad 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/GenericOptional.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/GenericOptional.cpp
@@ -19,7 +19,7 @@ using namespace lldb_private;
bool lldb_private::formatters::GenericOptionalSummaryProvider(
ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
stream.Printf(" Has Value=%s ",
- valobj.GetNumChildrenIgnoringErrors() == 0 ? "false" : "true");
+ valobj.GetNumChildren() == 0 ? "false" : "true");
return true;
}
@@ -41,9 +41,7 @@ class GenericOptionalFrontend : public SyntheticChildrenFrontEnd {
}
bool MightHaveChildren() override { return true; }
- llvm::Expected<uint32_t> CalculateNumChildren() override {
- return m_has_value ? 1U : 0U;
- }
+ uint32_t CalculateNumChildren() override { return m_has_value ? 1U : 0U; }
ValueObjectSP GetChildAtIndex(uint32_t idx) override;
lldb::ChildCacheState Update() override;
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
index 10a1fe03918984..bba887fec3ac3f 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
@@ -63,7 +63,7 @@ lldb::ValueObjectSP
lldb_private::formatters::GetSecondValueOfLibCXXCompressedPair(
ValueObject &pair) {
ValueObjectSP value;
- if (pair.GetNumChildrenIgnoringErrors() > 1) {
+ if (pair.GetNumChildren() > 1) {
ValueObjectSP second_child = pair.GetChildAtIndex(1);
if (second_child) {
value = second_child->GetChildMemberWithName("__value_");
@@ -351,8 +351,8 @@ lldb_private::formatters::LibCxxMapIteratorSyntheticFrontEnd::Update() {
return lldb::ChildCacheState::eRefetch;
}
-llvm::Expected<uint32_t> lldb_private::formatters::
- LibCxxMapIteratorSyntheticFrontEnd::CalculateNumChildren() {
+uint32_t lldb_private::formatters::LibCxxMapIteratorSyntheticFrontEnd::
+ CalculateNumChildren() {
return 2;
}
@@ -509,8 +509,8 @@ lldb::ChildCacheState lldb_private::formatters::
return lldb::ChildCacheState::eRefetch;
}
-llvm::Expected<uint32_t> lldb_private::formatters::
- LibCxxUnorderedMapIteratorSyntheticFrontEnd::CalculateNumChildren() {
+uint32_t lldb_private::formatters::LibCxxUnorderedMapIteratorSyntheticFrontEnd::
+ CalculateNumChildren() {
return 2;
}
@@ -566,8 +566,8 @@ lldb_private::formatters::LibcxxSharedPtrSyntheticFrontEnd::
Update();
}
-llvm::Expected<uint32_t> lldb_private::formatters::
- LibcxxSharedPtrSyntheticFrontEnd::CalculateNumChildren() {
+uint32_t lldb_private::formatters::LibcxxSharedPtrSyntheticFrontEnd::
+ CalculateNumChildren() {
return (m_cntrl ? 1 : 0);
}
@@ -661,8 +661,8 @@ lldb_private::formatters::LibcxxUniquePtrSyntheticFrontEndCreator(
: nullptr);
}
-llvm::Expected<uint32_t> lldb_private::formatters::
- LibcxxUniquePtrSyntheticFrontEnd::CalculateNumChildren() {
+uint32_t lldb_private::formatters::LibcxxUniquePtrSyntheticFrontEnd::
+ CalculateNumChildren() {
if (m_value_ptr_sp)
return m_deleter_sp ? 2 : 1;
return 0;
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.h b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.h
index a59f21841ec890..ad2f58508ab7b6 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.h
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.h
@@ -87,7 +87,7 @@ class LibCxxMapIteratorSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
public:
LibCxxMapIteratorSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
- llvm::Expected<uint32_t> CalculateNumChildren() override;
+ uint32_t CalculateNumChildren() override;
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
@@ -135,7 +135,7 @@ class LibCxxUnorderedMapIteratorSyntheticFrontEnd
~LibCxxUnorderedMapIteratorSyntheticFrontEnd() override = default;
- llvm::Expected<uint32_t> CalculateNumChildren() override;
+ uint32_t CalculateNumChildren() override;
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
@@ -166,7 +166,7 @@ class LibcxxSharedPtrSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
public:
LibcxxSharedPtrSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
- llvm::Expected<uint32_t> CalculateNumChildren() override;
+ uint32_t CalculateNumChildren() override;
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
@@ -186,7 +186,7 @@ class LibcxxUniquePtrSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
public:
LibcxxUniquePtrSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
- llvm::Expected<uint32_t> CalculateNumChildren() override;
+ uint32_t CalculateNumChildren() override;
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxAtomic.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxAtomic.cpp
index 7f30dc186291e9..8e4c36103a744d 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxAtomic.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxAtomic.cpp
@@ -90,7 +90,7 @@ class LibcxxStdAtomicSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
~LibcxxStdAtomicSyntheticFrontEnd() override = default;
- llvm::Expected<uint32_t> CalculateNumChildren() override;
+ uint32_t CalculateNumChildren() override;
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
@@ -124,8 +124,8 @@ bool lldb_private::formatters::LibcxxStdAtomicSyntheticFrontEnd::
return true;
}
-llvm::Expected<uint32_t> lldb_private::formatters::
- LibcxxStdAtomicSyntheticFrontEnd::CalculateNumChildren() {
+uint32_t lldb_private::formatters::LibcxxStdAtomicSyntheticFrontEnd::
+ CalculateNumChildren() {
return m_real_child ? 1 : 0;
}
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp
index bd9c72497664a0..00012dfc056e47 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp
@@ -26,7 +26,7 @@ class LibcxxInitializerListSyntheticFrontEnd
~LibcxxInitializerListSyntheticFrontEnd() override;
- llvm::Expected<uint32_t> CalculateNumChildren() override;
+ uint32_t CalculateNumChildren() override;
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
@@ -59,8 +59,8 @@ lldb_private::formatters::LibcxxInitializerListSyntheticFrontEnd::
// delete m_start;
}
-llvm::Expected<uint32_t> lldb_private::formatters::
- LibcxxInitializerListSyntheticFrontEnd::CalculateNumChildren() {
+uint32_t lldb_private::formatters::LibcxxInitializerListSyntheticFrontEnd::
+ CalculateNumChildren() {
m_num_elements = 0;
ValueObjectSP size_sp(m_backend.GetChildMemberWithName("__size_"));
if (size_sp)
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp
index d7cfeb30557c36..17f6b737d9f628 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp
@@ -136,7 +136,7 @@ class ForwardListFrontEnd : public AbstractListFrontEnd {
public:
ForwardListFrontEnd(ValueObject &valobj);
- llvm::Expected<uint32_t> CalculateNumChildren() override;
+ uint32_t CalculateNumChildren() override;
ValueObjectSP GetChildAtIndex(uint32_t idx) override;
lldb::ChildCacheState Update() override;
};
@@ -147,7 +147,7 @@ class ListFrontEnd : public AbstractListFrontEnd {
~ListFrontEnd() override = default;
- llvm::Expected<uint32_t> CalculateNumChildren() override;
+ uint32_t CalculateNumChildren() override;
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
@@ -240,7 +240,7 @@ ForwardListFrontEnd::ForwardListFrontEnd(ValueObject &valobj)
Update();
}
-llvm::Expected<uint32_t> ForwardListFrontEnd::CalculateNumChildren() {
+uint32_t ForwardListFrontEnd::CalculateNumChildren() {
if (m_count != UINT32_MAX)
return m_count;
@@ -254,7 +254,7 @@ llvm::Expected<uint32_t> ForwardListFrontEnd::CalculateNumChildren() {
}
ValueObjectSP ForwardListFrontEnd::GetChildAtIndex(uint32_t idx) {
- if (idx >= CalculateNumChildrenIgnoringErrors())
+ if (idx >= CalculateNumChildren())
return nullptr;
if (!m_head)
@@ -308,7 +308,7 @@ ListFrontEnd::ListFrontEnd(lldb::ValueObjectSP valobj_sp)
Update();
}
-llvm::Expected<uint32_t> ListFrontEnd::CalculateNumChildren() {
+uint32_t ListFrontEnd::CalculateNumChildren() {
if (m_count != UINT32_MAX)
return m_count;
if (!m_head || !m_tail || m_node_address == 0)
@@ -347,7 +347,7 @@ lldb::ValueObjectSP ListFrontEnd::GetChildAtIndex(uint32_t idx) {
static ConstString g_value("__value_");
static ConstString g_next("__next_");
- if (idx >= CalculateNumChildrenIgnoringErrors())
+ if (idx >= CalculateNumChildren())
return lldb::ValueObjectSP();
if (!m_head || !m_tail || m_node_address == 0)
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
index ec5b320e2218cf..6d24eb03779ca3 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
@@ -177,7 +177,7 @@ class LibcxxStdMapSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
~LibcxxStdMapSyntheticFrontEnd() override = default;
- llvm::Expected<uint32_t> CalculateNumChildren() override;
+ uint32_t CalculateNumChildren() override;
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
@@ -209,8 +209,8 @@ lldb_private::formatters::LibcxxStdMapSyntheticFrontEnd::
Update();
}
-llvm::Expected<uint32_t> lldb_private::formatters::
- LibcxxStdMapSyntheticFrontEnd::CalculateNumChildren() {
+uint32_t lldb_private::formatters::LibcxxStdMapSyntheticFrontEnd::
+ CalculateNumChildren() {
if (m_count != UINT32_MAX)
return m_count;
@@ -311,13 +311,13 @@ lldb_private::formatters::LibcxxStdMapSyntheticFrontEnd::GetChildAtIndex(
uint32_t idx) {
static ConstString g_cc_("__cc_"), g_cc("__cc");
static ConstString g_nc("__nc");
- uint32_t num_children = CalculateNumChildrenIgnoringErrors();
- if (idx >= num_children)
+
+ if (idx >= CalculateNumChildren())
return lldb::ValueObjectSP();
if (m_tree == nullptr || m_root_node == nullptr)
return lldb::ValueObjectSP();
- MapIterator iterator(m_root_node, num_children);
+ MapIterator iterator(m_root_node, CalculateNumChildren());
const bool need_to_skip = (idx > 0);
size_t actual_advancde = idx;
@@ -382,7 +382,7 @@ lldb_private::formatters::LibcxxStdMapSyntheticFrontEnd::GetChildAtIndex(
name.Printf("[%" PRIu64 "]", (uint64_t)idx);
auto potential_child_sp = iterated_sp->Clone(ConstString(name.GetString()));
if (potential_child_sp) {
- switch (potential_child_sp->GetNumChildrenIgnoringErrors()) {
+ switch (potential_child_sp->GetNumChildren()) {
case 1: {
auto child0_sp = potential_child_sp->GetChildAtIndex(0);
if (child0_sp &&
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxQueue.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxQueue.cpp
index 5b459a17fe29ba..fbadee89b7b7f2 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxQueue.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxQueue.cpp
@@ -28,7 +28,7 @@ class QueueFrontEnd : public SyntheticChildrenFrontEnd {
bool MightHaveChildren() override { return true; }
lldb::ChildCacheState Update() override;
- llvm::Expected<uint32_t> CalculateNumChildren() override {
+ uint32_t CalculateNumChildren() override {
return m_container_sp ? m_container_sp->GetNumChildren() : 0;
}
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxRangesRefView.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxRangesRefView.cpp
index 01a7b8f142ecb9..74f54f76735667 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxRangesRefView.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxRangesRefView.cpp
@@ -27,7 +27,7 @@ class LibcxxStdRangesRefViewSyntheticFrontEnd
~LibcxxStdRangesRefViewSyntheticFrontEnd() override = default;
- llvm::Expected<uint32_t> CalculateNumChildren() override {
+ uint32_t CalculateNumChildren() override {
// __range_ will be the sole child of this type
return 1;
}
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxSpan.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxSpan.cpp
index 9895f336bfd020..af2b51d2b54016 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxSpan.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxSpan.cpp
@@ -27,7 +27,7 @@ class LibcxxStdSpanSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
~LibcxxStdSpanSyntheticFrontEnd() override = default;
- llvm::Expected<uint32_t> CalculateNumChildren() override;
+ uint32_t CalculateNumChildren() override;
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
@@ -73,8 +73,8 @@ lldb_private::formatters::LibcxxStdSpanSyntheticFrontEnd::
Update();
}
-llvm::Expected<uint32_t> lldb_private::formatters::
- LibcxxStdSpanSyntheticFrontEnd::CalculateNumChildren() {
+uint32_t lldb_private::formatters::LibcxxStdSpanSyntheticFrontEnd::
+ CalculateNumChildren() {
return m_num_elements;
}
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxTuple.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxTuple.cpp
index 3e3259ab428df3..62bb7d619267a3 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxTuple.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxTuple.cpp
@@ -26,9 +26,7 @@ class TupleFrontEnd: public SyntheticChildrenFrontEnd {
bool MightHaveChildren() override { return true; }
lldb::ChildCacheState Update() override;
- llvm::Expected<uint32_t> CalculateNumChildren() override {
- return m_elements.size();
- }
+ uint32_t CalculateNumChildren() override { return m_elements.size(); }
ValueObjectSP GetChildAtIndex(uint32_t idx) override;
private:
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp
index af29fdb6d00109..b3c36429433570 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp
@@ -33,7 +33,7 @@ class LibcxxStdUnorderedMapSyntheticFrontEnd
~LibcxxStdUnorderedMapSyntheticFrontEnd() override = default;
- llvm::Expected<uint32_t> CalculateNumChildren() override;
+ uint32_t CalculateNumChildren() override;
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
@@ -62,8 +62,8 @@ lldb_private::formatters::LibcxxStdUnorderedMapSyntheticFrontEnd::
Update();
}
-llvm::Expected<uint32_t> lldb_private::formatters::
- LibcxxStdUnorderedMapSyntheticFrontEnd::CalculateNumChildren() {
+uint32_t lldb_private::formatters::LibcxxStdUnorderedMapSyntheticFrontEnd::
+ CalculateNumChildren() {
return m_num_elements;
}
@@ -94,7 +94,7 @@ static bool isUnorderedMap(ConstString type_name) {
lldb::ValueObjectSP lldb_private::formatters::
LibcxxStdUnorderedMapSyntheticFrontEnd::GetChildAtIndex(uint32_t idx) {
- if (idx >= CalculateNumChildrenIgnoringErrors())
+ if (idx >= CalculateNumChildren())
return lldb::ValueObjectSP();
if (m_tree == nullptr)
return lldb::ValueObjectSP();
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxValarray.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxValarray.cpp
index 99f94406e99a6a..463c7b8d7ce3bb 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxValarray.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxValarray.cpp
@@ -24,7 +24,7 @@ class LibcxxStdValarraySyntheticFrontEnd : public SyntheticChildrenFrontEnd {
~LibcxxStdValarraySyntheticFrontEnd() override;
- llvm::Expected<uint32_t> CalculateNumChildren() override;
+ uint32_t CalculateNumChildren() override;
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
@@ -63,8 +63,8 @@ lldb_private::formatters::LibcxxStdValarraySyntheticFrontEnd::
// delete m_finish;
}
-llvm::Expected<uint32_t> lldb_private::formatters::
- LibcxxStdValarraySyntheticFrontEnd::CalculateNumChildren() {
+uint32_t lldb_private::formatters::LibcxxStdValarraySyntheticFrontEnd::
+ CalculateNumChildren() {
if (!m_start || !m_finish)
return 0;
uint64_t start_val = m_start->GetValueAsUnsigned(0);
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxVariant.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxVariant.cpp
index 62794318e0777c..1f62062f09be30 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxVariant.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxVariant.cpp
@@ -205,7 +205,7 @@ class VariantFrontEnd : public SyntheticChildrenFrontEnd {
bool MightHaveChildren() override { return true; }
lldb::ChildCacheState Update() override;
- llvm::Expected<uint32_t> CalculateNumChildren() override { return m_size; }
+ uint32_t CalculateNumChildren() override { return m_size; }
ValueObjectSP GetChildAtIndex(uint32_t idx) override;
private:
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp
index 461fed35164b4d..fcf727ad2ea027 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp
@@ -25,7 +25,7 @@ class LibcxxStdVectorSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
~LibcxxStdVectorSyntheticFrontEnd() override;
- llvm::Expected<uint32_t> CalculateNumChildren() override;
+ uint32_t CalculateNumChildren() override;
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
@@ -46,7 +46,7 @@ class LibcxxVectorBoolSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
public:
LibcxxVectorBoolSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
- llvm::Expected<uint32_t> CalculateNumChildren() override;
+ uint32_t CalculateNumChildren() override;
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
@@ -82,8 +82,8 @@ lldb_private::formatters::LibcxxStdVectorSyntheticFrontEnd::
// delete m_finish;
}
-llvm::Expected<uint32_t> lldb_private::formatters::
- LibcxxStdVectorSyntheticFrontEnd::CalculateNumChildren() {
+uint32_t lldb_private::formatters::LibcxxStdVectorSyntheticFrontEnd::
+ CalculateNumChildren() {
if (!m_start || !m_finish)
return 0;
uint64_t start_val = m_start->GetValueAsUnsigned(0);
@@ -165,8 +165,8 @@ lldb_private::formatters::LibcxxVectorBoolSyntheticFrontEnd::
}
}
-llvm::Expected<uint32_t> lldb_private::formatters::
- LibcxxVectorBoolSyntheticFrontEnd::CalculateNumChildren() {
+uint32_t lldb_private::formatters::LibcxxVectorBoolSyntheticFrontEnd::
+ CalculateNumChildren() {
return m_count;
}
@@ -259,7 +259,7 @@ size_t lldb_private::formatters::LibcxxVectorBoolSyntheticFrontEnd::
return UINT32_MAX;
const char *item_name = name.GetCString();
uint32_t idx = ExtractIndexFromString(item_name);
- if (idx < UINT32_MAX && idx >= CalculateNumChildrenIgnoringErrors())
+ if (idx < UINT32_MAX && idx >= CalculateNumChildren())
return UINT32_MAX;
return idx;
}
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
index 86bb575af5ca34..5abb3d50674bc5 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
@@ -43,7 +43,7 @@ class LibstdcppMapIteratorSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
public:
explicit LibstdcppMapIteratorSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
- llvm::Expected<uint32_t> CalculateNumChildren() override;
+ uint32_t CalculateNumChildren() override;
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
@@ -64,7 +64,7 @@ class LibStdcppSharedPtrSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
public:
explicit LibStdcppSharedPtrSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
- llvm::Expected<uint32_t> CalculateNumChildren() override;
+ uint32_t CalculateNumChildren() override;
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
@@ -132,8 +132,7 @@ lldb::ChildCacheState LibstdcppMapIteratorSyntheticFrontEnd::Update() {
return lldb::ChildCacheState::eReuse;
}
-llvm::Expected<uint32_t>
-LibstdcppMapIteratorSyntheticFrontEnd::CalculateNumChildren() {
+uint32_t LibstdcppMapIteratorSyntheticFrontEnd::CalculateNumChildren() {
return 2;
}
@@ -220,10 +219,7 @@ lldb::ChildCacheState VectorIteratorSyntheticFrontEnd::Update() {
return lldb::ChildCacheState::eRefetch;
}
-llvm::Expected<uint32_t>
-VectorIteratorSyntheticFrontEnd::CalculateNumChildren() {
- return 1;
-}
+uint32_t VectorIteratorSyntheticFrontEnd::CalculateNumChildren() { return 1; }
lldb::ValueObjectSP
VectorIteratorSyntheticFrontEnd::GetChildAtIndex(uint32_t idx) {
@@ -375,10 +371,7 @@ LibStdcppSharedPtrSyntheticFrontEnd::LibStdcppSharedPtrSyntheticFrontEnd(
Update();
}
-llvm::Expected<uint32_t>
-LibStdcppSharedPtrSyntheticFrontEnd::CalculateNumChildren() {
- return 1;
-}
+uint32_t LibStdcppSharedPtrSyntheticFrontEnd::CalculateNumChildren() { return 1; }
lldb::ValueObjectSP
LibStdcppSharedPtrSyntheticFrontEnd::GetChildAtIndex(uint32_t idx) {
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp
index 05199ba35b9a45..64d2ec9d943a2a 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp
@@ -26,7 +26,7 @@ class LibStdcppTupleSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
public:
explicit LibStdcppTupleSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
- llvm::Expected<uint32_t> CalculateNumChildren() override;
+ uint32_t CalculateNumChildren() override;
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
@@ -65,7 +65,7 @@ lldb::ChildCacheState LibStdcppTupleSyntheticFrontEnd::Update() {
ValueObjectSP current_child = next_child_sp;
next_child_sp = nullptr;
- size_t child_count = current_child->GetNumChildrenIgnoringErrors();
+ size_t child_count = current_child->GetNumChildren();
for (size_t i = 0; i < child_count; ++i) {
ValueObjectSP child_sp = current_child->GetChildAtIndex(i);
llvm::StringRef name_str = child_sp->GetName().GetStringRef();
@@ -95,8 +95,7 @@ LibStdcppTupleSyntheticFrontEnd::GetChildAtIndex(uint32_t idx) {
return lldb::ValueObjectSP();
}
-llvm::Expected<uint32_t>
-LibStdcppTupleSyntheticFrontEnd::CalculateNumChildren() {
+uint32_t LibStdcppTupleSyntheticFrontEnd::CalculateNumChildren() {
return m_members.size();
}
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
index 92f540d9ca5233..3a48fe412e0721 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
@@ -26,7 +26,7 @@ class LibStdcppUniquePtrSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
public:
explicit LibStdcppUniquePtrSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
- llvm::Expected<uint32_t> CalculateNumChildren() override;
+ uint32_t CalculateNumChildren() override;
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
@@ -135,8 +135,7 @@ LibStdcppUniquePtrSyntheticFrontEnd::GetChildAtIndex(uint32_t idx) {
return lldb::ValueObjectSP();
}
-llvm::Expected<uint32_t>
-LibStdcppUniquePtrSyntheticFrontEnd::CalculateNumChildren() {
+uint32_t LibStdcppUniquePtrSyntheticFrontEnd::CalculateNumChildren() {
if (m_del_obj)
return 2;
return 1;
diff --git a/lldb/source/Plugins/Language/ObjC/Cocoa.cpp b/lldb/source/Plugins/Language/ObjC/Cocoa.cpp
index 96166657ceeb62..cb740f8e71e168 100644
--- a/lldb/source/Plugins/Language/ObjC/Cocoa.cpp
+++ b/lldb/source/Plugins/Language/ObjC/Cocoa.cpp
@@ -1038,7 +1038,7 @@ class ObjCClassSyntheticChildrenFrontEnd : public SyntheticChildrenFrontEnd {
~ObjCClassSyntheticChildrenFrontEnd() override = default;
- llvm::Expected<uint32_t> CalculateNumChildren() override { return 0; }
+ uint32_t CalculateNumChildren() override { return 0; }
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override {
return lldb::ValueObjectSP();
diff --git a/lldb/source/Plugins/Language/ObjC/NSArray.cpp b/lldb/source/Plugins/Language/ObjC/NSArray.cpp
index 67d0cd08f51aeb..7f060b2613d6f3 100644
--- a/lldb/source/Plugins/Language/ObjC/NSArray.cpp
+++ b/lldb/source/Plugins/Language/ObjC/NSArray.cpp
@@ -50,7 +50,7 @@ class NSArrayMSyntheticFrontEndBase : public SyntheticChildrenFrontEnd {
~NSArrayMSyntheticFrontEndBase() override = default;
- llvm::Expected<uint32_t> CalculateNumChildren() override;
+ uint32_t CalculateNumChildren() override;
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
@@ -214,7 +214,7 @@ class GenericNSArrayISyntheticFrontEnd : public SyntheticChildrenFrontEnd {
~GenericNSArrayISyntheticFrontEnd() override;
- llvm::Expected<uint32_t> CalculateNumChildren() override;
+ uint32_t CalculateNumChildren() override;
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
@@ -302,7 +302,7 @@ class NSArray0SyntheticFrontEnd : public SyntheticChildrenFrontEnd {
~NSArray0SyntheticFrontEnd() override = default;
- llvm::Expected<uint32_t> CalculateNumChildren() override;
+ uint32_t CalculateNumChildren() override;
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
@@ -319,7 +319,7 @@ class NSArray1SyntheticFrontEnd : public SyntheticChildrenFrontEnd {
~NSArray1SyntheticFrontEnd() override = default;
- llvm::Expected<uint32_t> CalculateNumChildren() override;
+ uint32_t CalculateNumChildren() override;
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
@@ -477,15 +477,15 @@ lldb_private::formatters::
: NSArrayMSyntheticFrontEndBase(valobj_sp), m_data_32(nullptr),
m_data_64(nullptr) {}
-llvm::Expected<uint32_t> lldb_private::formatters::
- NSArrayMSyntheticFrontEndBase::CalculateNumChildren() {
+uint32_t lldb_private::formatters::NSArrayMSyntheticFrontEndBase::
+ CalculateNumChildren() {
return GetUsedCount();
}
lldb::ValueObjectSP
lldb_private::formatters::NSArrayMSyntheticFrontEndBase::GetChildAtIndex(
uint32_t idx) {
- if (idx >= CalculateNumChildrenIgnoringErrors())
+ if (idx >= CalculateNumChildren())
return lldb::ValueObjectSP();
lldb::addr_t object_at_idx = GetDataAddress();
size_t pyhs_idx = idx;
@@ -542,7 +542,7 @@ lldb_private::formatters::NSArrayMSyntheticFrontEndBase::GetIndexOfChildWithName
ConstString name) {
const char *item_name = name.GetCString();
uint32_t idx = ExtractIndexFromString(item_name);
- if (idx < UINT32_MAX && idx >= CalculateNumChildrenIgnoringErrors())
+ if (idx < UINT32_MAX && idx >= CalculateNumChildren())
return UINT32_MAX;
return idx;
}
@@ -628,15 +628,15 @@ lldb_private::formatters::GenericNSArrayISyntheticFrontEnd<D32, D64, Inline>::
GetIndexOfChildWithName(ConstString name) {
const char *item_name = name.GetCString();
uint32_t idx = ExtractIndexFromString(item_name);
- if (idx < UINT32_MAX && idx >= CalculateNumChildrenIgnoringErrors())
+ if (idx < UINT32_MAX && idx >= CalculateNumChildren())
return UINT32_MAX;
return idx;
}
template <typename D32, typename D64, bool Inline>
-llvm::Expected<uint32_t>
-lldb_private::formatters::GenericNSArrayISyntheticFrontEnd<
- D32, D64, Inline>::CalculateNumChildren() {
+uint32_t
+lldb_private::formatters::GenericNSArrayISyntheticFrontEnd<D32, D64, Inline>::
+ CalculateNumChildren() {
return m_data_32 ? m_data_32->used : m_data_64->used;
}
@@ -685,7 +685,7 @@ template <typename D32, typename D64, bool Inline>
lldb::ValueObjectSP
lldb_private::formatters::GenericNSArrayISyntheticFrontEnd<D32, D64, Inline>::
GetChildAtIndex(uint32_t idx) {
- if (idx >= CalculateNumChildrenIgnoringErrors())
+ if (idx >= CalculateNumChildren())
return lldb::ValueObjectSP();
lldb::addr_t object_at_idx;
if (Inline) {
@@ -719,7 +719,7 @@ lldb_private::formatters::NSArray0SyntheticFrontEnd::GetIndexOfChildWithName(
return UINT32_MAX;
}
-llvm::Expected<uint32_t>
+uint32_t
lldb_private::formatters::NSArray0SyntheticFrontEnd::CalculateNumChildren() {
return 0;
}
@@ -754,7 +754,7 @@ lldb_private::formatters::NSArray1SyntheticFrontEnd::GetIndexOfChildWithName(
return UINT32_MAX;
}
-llvm::Expected<uint32_t>
+uint32_t
lldb_private::formatters::NSArray1SyntheticFrontEnd::CalculateNumChildren() {
return 1;
}
diff --git a/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp b/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp
index ec6fd756394a2f..da94eda1529ce1 100644
--- a/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp
+++ b/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp
@@ -103,7 +103,7 @@ class NSDictionaryISyntheticFrontEnd : public SyntheticChildrenFrontEnd {
~NSDictionaryISyntheticFrontEnd() override;
- llvm::Expected<uint32_t> CalculateNumChildren() override;
+ uint32_t CalculateNumChildren() override;
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
@@ -144,7 +144,7 @@ class NSConstantDictionarySyntheticFrontEnd : public SyntheticChildrenFrontEnd {
public:
NSConstantDictionarySyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
- llvm::Expected<uint32_t> CalculateNumChildren() override;
+ uint32_t CalculateNumChildren() override;
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
@@ -176,7 +176,7 @@ class NSCFDictionarySyntheticFrontEnd : public SyntheticChildrenFrontEnd {
public:
NSCFDictionarySyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
- llvm::Expected<uint32_t> CalculateNumChildren() override;
+ uint32_t CalculateNumChildren() override;
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
@@ -209,7 +209,7 @@ class NSDictionary1SyntheticFrontEnd : public SyntheticChildrenFrontEnd {
~NSDictionary1SyntheticFrontEnd() override = default;
- llvm::Expected<uint32_t> CalculateNumChildren() override;
+ uint32_t CalculateNumChildren() override;
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
@@ -230,7 +230,7 @@ class GenericNSDictionaryMSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
~GenericNSDictionaryMSyntheticFrontEnd() override;
- llvm::Expected<uint32_t> CalculateNumChildren() override;
+ uint32_t CalculateNumChildren() override;
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
@@ -262,9 +262,9 @@ namespace Foundation1100 {
NSDictionaryMSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
~NSDictionaryMSyntheticFrontEnd() override;
-
- llvm::Expected<uint32_t> CalculateNumChildren() override;
-
+
+ uint32_t CalculateNumChildren() override;
+
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
lldb::ChildCacheState Update() override;
@@ -601,13 +601,13 @@ size_t lldb_private::formatters::NSDictionaryISyntheticFrontEnd::
GetIndexOfChildWithName(ConstString name) {
const char *item_name = name.GetCString();
uint32_t idx = ExtractIndexFromString(item_name);
- if (idx < UINT32_MAX && idx >= CalculateNumChildrenIgnoringErrors())
+ if (idx < UINT32_MAX && idx >= CalculateNumChildren())
return UINT32_MAX;
return idx;
}
-llvm::Expected<uint32_t> lldb_private::formatters::
- NSDictionaryISyntheticFrontEnd::CalculateNumChildren() {
+uint32_t lldb_private::formatters::NSDictionaryISyntheticFrontEnd::
+ CalculateNumChildren() {
if (!m_data_32 && !m_data_64)
return 0;
return (m_data_32 ? m_data_32->_used : m_data_64->_used);
@@ -656,7 +656,7 @@ bool lldb_private::formatters::NSDictionaryISyntheticFrontEnd::
lldb::ValueObjectSP
lldb_private::formatters::NSDictionaryISyntheticFrontEnd::GetChildAtIndex(
uint32_t idx) {
- uint32_t num_children = CalculateNumChildrenIgnoringErrors();
+ uint32_t num_children = CalculateNumChildren();
if (idx >= num_children)
return lldb::ValueObjectSP();
@@ -739,13 +739,13 @@ size_t lldb_private::formatters::NSCFDictionarySyntheticFrontEnd::
GetIndexOfChildWithName(ConstString name) {
const char *item_name = name.GetCString();
const uint32_t idx = ExtractIndexFromString(item_name);
- if (idx < UINT32_MAX && idx >= CalculateNumChildrenIgnoringErrors())
+ if (idx < UINT32_MAX && idx >= CalculateNumChildren())
return UINT32_MAX;
return idx;
}
-llvm::Expected<uint32_t> lldb_private::formatters::
- NSCFDictionarySyntheticFrontEnd::CalculateNumChildren() {
+uint32_t lldb_private::formatters::NSCFDictionarySyntheticFrontEnd::
+ CalculateNumChildren() {
if (!m_hashtable.IsValid())
return 0;
return m_hashtable.GetCount();
@@ -781,7 +781,7 @@ lldb_private::formatters::NSCFDictionarySyntheticFrontEnd::GetChildAtIndex(
lldb::addr_t m_keys_ptr = m_hashtable.GetKeyPointer();
lldb::addr_t m_values_ptr = m_hashtable.GetValuePointer();
- const uint32_t num_children = CalculateNumChildrenIgnoringErrors();
+ const uint32_t num_children = CalculateNumChildren();
if (idx >= num_children)
return lldb::ValueObjectSP();
@@ -875,13 +875,13 @@ size_t lldb_private::formatters::NSConstantDictionarySyntheticFrontEnd::
GetIndexOfChildWithName(ConstString name) {
const char *item_name = name.GetCString();
uint32_t idx = ExtractIndexFromString(item_name);
- if (idx < UINT32_MAX && idx >= CalculateNumChildrenIgnoringErrors())
+ if (idx < UINT32_MAX && idx >= CalculateNumChildren())
return UINT32_MAX;
return idx;
}
-llvm::Expected<uint32_t> lldb_private::formatters::
- NSConstantDictionarySyntheticFrontEnd::CalculateNumChildren() {
+uint32_t lldb_private::formatters::NSConstantDictionarySyntheticFrontEnd::
+ CalculateNumChildren() {
return m_size;
}
@@ -921,7 +921,7 @@ bool lldb_private::formatters::NSConstantDictionarySyntheticFrontEnd::
lldb::ValueObjectSP lldb_private::formatters::
NSConstantDictionarySyntheticFrontEnd::GetChildAtIndex(uint32_t idx) {
- uint32_t num_children = CalculateNumChildrenIgnoringErrors();
+ uint32_t num_children = CalculateNumChildren();
if (idx >= num_children)
return lldb::ValueObjectSP();
@@ -994,8 +994,8 @@ size_t lldb_private::formatters::NSDictionary1SyntheticFrontEnd::
return name == g_zero ? 0 : UINT32_MAX;
}
-llvm::Expected<uint32_t> lldb_private::formatters::
- NSDictionary1SyntheticFrontEnd::CalculateNumChildren() {
+uint32_t lldb_private::formatters::NSDictionary1SyntheticFrontEnd::
+ CalculateNumChildren() {
return 1;
}
@@ -1081,18 +1081,17 @@ size_t lldb_private::formatters::GenericNSDictionaryMSyntheticFrontEnd<
D32, D64>::GetIndexOfChildWithName(ConstString name) {
const char *item_name = name.GetCString();
uint32_t idx = ExtractIndexFromString(item_name);
- if (idx < UINT32_MAX && idx >= CalculateNumChildrenIgnoringErrors())
+ if (idx < UINT32_MAX && idx >= CalculateNumChildren())
return UINT32_MAX;
return idx;
}
template <typename D32, typename D64>
-llvm::Expected<uint32_t>
-lldb_private::formatters::GenericNSDictionaryMSyntheticFrontEnd<
- D32, D64>::CalculateNumChildren() {
+uint32_t
+lldb_private::formatters::GenericNSDictionaryMSyntheticFrontEnd<D32,D64>::CalculateNumChildren() {
if (!m_data_32 && !m_data_64)
return 0;
- return (m_data_32 ? (uint32_t)m_data_32->_used : (uint32_t)m_data_64->_used);
+ return (m_data_32 ? m_data_32->_used : m_data_64->_used);
}
template <typename D32, typename D64>
@@ -1154,7 +1153,7 @@ lldb_private::formatters::GenericNSDictionaryMSyntheticFrontEnd<
m_values_ptr = m_data_64->_buffer + (m_ptr_size * size);
}
- uint32_t num_children = CalculateNumChildrenIgnoringErrors();
+ uint32_t num_children = CalculateNumChildren();
if (idx >= num_children)
return lldb::ValueObjectSP();
@@ -1246,13 +1245,14 @@ lldb_private::formatters::Foundation1100::
NSDictionaryMSyntheticFrontEnd::GetIndexOfChildWithName(ConstString name) {
const char *item_name = name.GetCString();
uint32_t idx = ExtractIndexFromString(item_name);
- if (idx < UINT32_MAX && idx >= CalculateNumChildrenIgnoringErrors())
+ if (idx < UINT32_MAX && idx >= CalculateNumChildren())
return UINT32_MAX;
return idx;
}
-llvm::Expected<uint32_t> lldb_private::formatters::Foundation1100::
- NSDictionaryMSyntheticFrontEnd::CalculateNumChildren() {
+uint32_t
+lldb_private::formatters::Foundation1100::
+ NSDictionaryMSyntheticFrontEnd::CalculateNumChildren() {
if (!m_data_32 && !m_data_64)
return 0;
return (m_data_32 ? m_data_32->_used : m_data_64->_used);
@@ -1306,7 +1306,7 @@ lldb_private::formatters::Foundation1100::
lldb::addr_t m_values_ptr =
(m_data_32 ? m_data_32->_objs_addr : m_data_64->_objs_addr);
- uint32_t num_children = CalculateNumChildrenIgnoringErrors();
+ uint32_t num_children = CalculateNumChildren();
if (idx >= num_children)
return lldb::ValueObjectSP();
diff --git a/lldb/source/Plugins/Language/ObjC/NSError.cpp b/lldb/source/Plugins/Language/ObjC/NSError.cpp
index 5ef7edc7e80c1a..b034e799b716e7 100644
--- a/lldb/source/Plugins/Language/ObjC/NSError.cpp
+++ b/lldb/source/Plugins/Language/ObjC/NSError.cpp
@@ -116,7 +116,7 @@ class NSErrorSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
// no need to delete m_child_ptr - it's kept alive by the cluster manager on
// our behalf
- llvm::Expected<uint32_t> CalculateNumChildren() override {
+ uint32_t CalculateNumChildren() override {
if (m_child_ptr)
return 1;
if (m_child_sp)
diff --git a/lldb/source/Plugins/Language/ObjC/NSException.cpp b/lldb/source/Plugins/Language/ObjC/NSException.cpp
index e7ce26ea4c6f50..09d3a1b42b747f 100644
--- a/lldb/source/Plugins/Language/ObjC/NSException.cpp
+++ b/lldb/source/Plugins/Language/ObjC/NSException.cpp
@@ -123,7 +123,9 @@ class NSExceptionSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
~NSExceptionSyntheticFrontEnd() override = default;
- llvm::Expected<uint32_t> CalculateNumChildren() override { return 4; }
+ uint32_t CalculateNumChildren() override {
+ return 4;
+ }
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override {
switch (idx) {
diff --git a/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp b/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp
index a434cee09d3822..10bb907c58ed42 100644
--- a/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp
+++ b/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp
@@ -40,9 +40,7 @@ class NSIndexPathSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
~NSIndexPathSyntheticFrontEnd() override = default;
- llvm::Expected<uint32_t> CalculateNumChildren() override {
- return m_impl.GetNumIndexes();
- }
+ uint32_t CalculateNumChildren() override { return m_impl.GetNumIndexes(); }
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override {
return m_impl.GetIndexAtIndex(idx, m_uint_star_type);
@@ -129,7 +127,7 @@ class NSIndexPathSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
size_t GetIndexOfChildWithName(ConstString name) override {
const char *item_name = name.GetCString();
uint32_t idx = ExtractIndexFromString(item_name);
- if (idx < UINT32_MAX && idx >= CalculateNumChildrenIgnoringErrors())
+ if (idx < UINT32_MAX && idx >= CalculateNumChildren())
return UINT32_MAX;
return idx;
}
diff --git a/lldb/source/Plugins/Language/ObjC/NSSet.cpp b/lldb/source/Plugins/Language/ObjC/NSSet.cpp
index 7d0a6a507211f8..c965a2a1340030 100644
--- a/lldb/source/Plugins/Language/ObjC/NSSet.cpp
+++ b/lldb/source/Plugins/Language/ObjC/NSSet.cpp
@@ -46,7 +46,7 @@ class NSSetISyntheticFrontEnd : public SyntheticChildrenFrontEnd {
~NSSetISyntheticFrontEnd() override;
- llvm::Expected<uint32_t> CalculateNumChildren() override;
+ uint32_t CalculateNumChildren() override;
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
@@ -84,7 +84,7 @@ class NSCFSetSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
public:
NSCFSetSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
- llvm::Expected<uint32_t> CalculateNumChildren() override;
+ uint32_t CalculateNumChildren() override;
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
@@ -117,7 +117,7 @@ class GenericNSSetMSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
~GenericNSSetMSyntheticFrontEnd() override;
- llvm::Expected<uint32_t> CalculateNumChildren() override;
+ uint32_t CalculateNumChildren() override;
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
@@ -233,7 +233,7 @@ class NSSetCodeRunningSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
~NSSetCodeRunningSyntheticFrontEnd() override;
- llvm::Expected<uint32_t> CalculateNumChildren() override;
+ uint32_t CalculateNumChildren() override;
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
@@ -414,12 +414,12 @@ lldb_private::formatters::NSSetISyntheticFrontEnd::GetIndexOfChildWithName(
ConstString name) {
const char *item_name = name.GetCString();
uint32_t idx = ExtractIndexFromString(item_name);
- if (idx < UINT32_MAX && idx >= CalculateNumChildrenIgnoringErrors())
+ if (idx < UINT32_MAX && idx >= CalculateNumChildren())
return UINT32_MAX;
return idx;
}
-llvm::Expected<uint32_t>
+uint32_t
lldb_private::formatters::NSSetISyntheticFrontEnd::CalculateNumChildren() {
if (!m_data_32 && !m_data_64)
return 0;
@@ -468,7 +468,7 @@ bool lldb_private::formatters::NSSetISyntheticFrontEnd::MightHaveChildren() {
lldb::ValueObjectSP
lldb_private::formatters::NSSetISyntheticFrontEnd::GetChildAtIndex(
uint32_t idx) {
- uint32_t num_children = CalculateNumChildrenIgnoringErrors();
+ uint32_t num_children = CalculateNumChildren();
if (idx >= num_children)
return lldb::ValueObjectSP();
@@ -551,12 +551,12 @@ lldb_private::formatters::NSCFSetSyntheticFrontEnd::GetIndexOfChildWithName(
ConstString name) {
const char *item_name = name.GetCString();
const uint32_t idx = ExtractIndexFromString(item_name);
- if (idx < UINT32_MAX && idx >= CalculateNumChildrenIgnoringErrors())
+ if (idx < UINT32_MAX && idx >= CalculateNumChildren())
return UINT32_MAX;
return idx;
}
-llvm::Expected<uint32_t>
+uint32_t
lldb_private::formatters::NSCFSetSyntheticFrontEnd::CalculateNumChildren() {
if (!m_hashtable.IsValid())
return 0;
@@ -591,7 +591,7 @@ lldb_private::formatters::NSCFSetSyntheticFrontEnd::GetChildAtIndex(
uint32_t idx) {
lldb::addr_t m_values_ptr = m_hashtable.GetValuePointer();
- const uint32_t num_children = CalculateNumChildrenIgnoringErrors();
+ const uint32_t num_children = CalculateNumChildren();
if (idx >= num_children)
return lldb::ValueObjectSP();
@@ -691,18 +691,18 @@ lldb_private::formatters::
ConstString name) {
const char *item_name = name.GetCString();
uint32_t idx = ExtractIndexFromString(item_name);
- if (idx < UINT32_MAX && idx >= CalculateNumChildrenIgnoringErrors())
+ if (idx < UINT32_MAX && idx >= CalculateNumChildren())
return UINT32_MAX;
return idx;
}
template <typename D32, typename D64>
-llvm::Expected<uint32_t>
-lldb_private::formatters::GenericNSSetMSyntheticFrontEnd<
- D32, D64>::CalculateNumChildren() {
+uint32_t
+lldb_private::formatters::
+ GenericNSSetMSyntheticFrontEnd<D32, D64>::CalculateNumChildren() {
if (!m_data_32 && !m_data_64)
return 0;
- return (m_data_32 ? (uint32_t)m_data_32->_used : (uint32_t)m_data_64->_used);
+ return (m_data_32 ? m_data_32->_used : m_data_64->_used);
}
template <typename D32, typename D64>
@@ -753,7 +753,7 @@ lldb_private::formatters::
lldb::addr_t m_objs_addr =
(m_data_32 ? m_data_32->_objs_addr : m_data_64->_objs_addr);
- uint32_t num_children = CalculateNumChildrenIgnoringErrors();
+ uint32_t num_children = CalculateNumChildren();
if (idx >= num_children)
return lldb::ValueObjectSP();
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
index 9434376f7d9ea0..f08f9f0f815d0c 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
@@ -539,8 +539,7 @@ ThreadSP AppleObjCRuntime::GetBacktraceThreadFromException(
return object;
};
- for (size_t idx = 0; idx < reserved_dict->GetNumChildrenIgnoringErrors();
- idx++) {
+ for (size_t idx = 0; idx < reserved_dict->GetNumChildren(); idx++) {
ValueObjectSP dict_entry = reserved_dict->GetChildAtIndex(idx);
DataExtractor data;
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index c02b08cb478280..51ab13108feb3a 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -5263,10 +5263,9 @@ GetDynamicArrayInfo(TypeSystemClang &ast, SymbolFile *sym_file,
return std::nullopt;
}
-llvm::Expected<uint32_t>
-TypeSystemClang::GetNumChildren(lldb::opaque_compiler_type_t type,
- bool omit_empty_base_classes,
- const ExecutionContext *exe_ctx) {
+uint32_t TypeSystemClang::GetNumChildren(lldb::opaque_compiler_type_t type,
+ bool omit_empty_base_classes,
+ const ExecutionContext *exe_ctx) {
if (!type)
return 0;
@@ -5362,13 +5361,9 @@ TypeSystemClang::GetNumChildren(lldb::opaque_compiler_type_t type,
CompilerType pointee_clang_type(GetPointeeType(type));
uint32_t num_pointee_children = 0;
- if (pointee_clang_type.IsAggregateType()) {
- auto num_children_or_err =
+ if (pointee_clang_type.IsAggregateType())
+ num_pointee_children =
pointee_clang_type.GetNumChildren(omit_empty_base_classes, exe_ctx);
- if (!num_children_or_err)
- return num_children_or_err;
- num_pointee_children = *num_children_or_err;
- }
// If this type points to a simple type, then it has 1 child
if (num_pointee_children == 0)
num_children = 1;
@@ -5402,13 +5397,9 @@ TypeSystemClang::GetNumChildren(lldb::opaque_compiler_type_t type,
clang::QualType pointee_type(pointer_type->getPointeeType());
CompilerType pointee_clang_type(GetType(pointee_type));
uint32_t num_pointee_children = 0;
- if (pointee_clang_type.IsAggregateType()) {
- auto num_children_or_err =
+ if (pointee_clang_type.IsAggregateType())
+ num_pointee_children =
pointee_clang_type.GetNumChildren(omit_empty_base_classes, exe_ctx);
- if (!num_children_or_err)
- return num_children_or_err;
- num_pointee_children = *num_children_or_err;
- }
if (num_pointee_children == 0) {
// We have a pointer to a pointee type that claims it has no children. We
// will want to look at
@@ -6117,15 +6108,8 @@ CompilerType TypeSystemClang::GetChildCompilerTypeAtIndex(
child_is_base_class = false;
language_flags = 0;
- auto num_children_or_err =
- GetNumChildren(type, omit_empty_base_classes, exe_ctx);
- if (!num_children_or_err) {
- LLDB_LOG_ERRORV(GetLog(LLDBLog::Types), num_children_or_err.takeError(),
- "{0}");
- return {};
- }
-
- const bool idx_is_valid = idx < *num_children_or_err;
+ const bool idx_is_valid =
+ idx < GetNumChildren(type, omit_empty_base_classes, exe_ctx);
int32_t bit_offset;
switch (parent_type_class) {
case clang::Type::Builtin:
@@ -6281,10 +6265,8 @@ CompilerType TypeSystemClang::GetChildCompilerTypeAtIndex(
CompilerType base_class_clang_type =
GetType(getASTContext().getObjCInterfaceType(
superclass_interface_decl));
- if (llvm::expectedToStdOptional(
- base_class_clang_type.GetNumChildren(
- omit_empty_base_classes, exe_ctx))
- .value_or(0) > 0) {
+ if (base_class_clang_type.GetNumChildren(omit_empty_base_classes,
+ exe_ctx) > 0) {
if (idx == 0) {
clang::QualType ivar_qual_type(
getASTContext().getObjCInterfaceType(
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
index 05c303baa41640..a73164895baa80 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
@@ -833,10 +833,9 @@ class TypeSystemClang : public TypeSystem {
GetTypeBitAlign(lldb::opaque_compiler_type_t type,
ExecutionContextScope *exe_scope) override;
- llvm::Expected<uint32_t>
- GetNumChildren(lldb::opaque_compiler_type_t type,
- bool omit_empty_base_classes,
- const ExecutionContext *exe_ctx) override;
+ uint32_t GetNumChildren(lldb::opaque_compiler_type_t type,
+ bool omit_empty_base_classes,
+ const ExecutionContext *exe_ctx) override;
CompilerType GetBuiltinTypeByName(ConstString name) override;
diff --git a/lldb/source/Symbol/CompilerType.cpp b/lldb/source/Symbol/CompilerType.cpp
index 85dd2d841a5a0c..76b79daa6ac154 100644
--- a/lldb/source/Symbol/CompilerType.cpp
+++ b/lldb/source/Symbol/CompilerType.cpp
@@ -770,9 +770,8 @@ lldb::Format CompilerType::GetFormat() const {
return lldb::eFormatDefault;
}
-llvm::Expected<uint32_t>
-CompilerType::GetNumChildren(bool omit_empty_base_classes,
- const ExecutionContext *exe_ctx) const {
+uint32_t CompilerType::GetNumChildren(bool omit_empty_base_classes,
+ const ExecutionContext *exe_ctx) const {
if (IsValid())
if (auto type_system_sp = GetTypeSystem())
return type_system_sp->GetNumChildren(m_type, omit_empty_base_classes,
diff --git a/lldb/source/Symbol/Type.cpp b/lldb/source/Symbol/Type.cpp
index 44a24d7178f562..6069d066eaf66b 100644
--- a/lldb/source/Symbol/Type.cpp
+++ b/lldb/source/Symbol/Type.cpp
@@ -488,7 +488,7 @@ std::optional<uint64_t> Type::GetByteSize(ExecutionContextScope *exe_scope) {
return {};
}
-llvm::Expected<uint32_t> Type::GetNumChildren(bool omit_empty_base_classes) {
+uint32_t Type::GetNumChildren(bool omit_empty_base_classes) {
return GetForwardCompilerType().GetNumChildren(omit_empty_base_classes, nullptr);
}
diff --git a/lldb/source/Symbol/Variable.cpp b/lldb/source/Symbol/Variable.cpp
index 90edede0f06538..a33c3433d9e245 100644
--- a/lldb/source/Symbol/Variable.cpp
+++ b/lldb/source/Symbol/Variable.cpp
@@ -27,8 +27,6 @@
#include "lldb/Target/StackFrame.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
-#include "lldb/Utility/LLDBLog.h"
-#include "lldb/Utility/Log.h"
#include "lldb/Utility/RegularExpression.h"
#include "lldb/Utility/Stream.h"
@@ -570,9 +568,7 @@ static void PrivateAutoComplete(
case eTypeClassObjCObjectPointer:
case eTypeClassPointer: {
bool omit_empty_base_classes = true;
- if (llvm::expectedToStdOptional(
- compiler_type.GetNumChildren(omit_empty_base_classes, nullptr))
- .value_or(0))
+ if (compiler_type.GetNumChildren(omit_empty_base_classes, nullptr) > 0)
request.AddCompletion((prefix_path + "->").str());
else {
request.AddCompletion(prefix_path.str());
diff --git a/lldb/source/Target/StackFrame.cpp b/lldb/source/Target/StackFrame.cpp
index c29a71d92572e2..50cf01e63cd493 100644
--- a/lldb/source/Target/StackFrame.cpp
+++ b/lldb/source/Target/StackFrame.cpp
@@ -857,11 +857,10 @@ ValueObjectSP StackFrame::GetValueForVariableExpressionPath(
"\"(%s) %s\" is not an array type",
valobj_sp->GetTypeName().AsCString("<invalid type>"),
var_expr_path_strm.GetData());
- } else if (static_cast<uint32_t>(child_index) >=
- synthetic
- ->GetNumChildrenIgnoringErrors() /* synthetic does
- not have that
- many values */) {
+ } else if (
+ static_cast<uint32_t>(child_index) >=
+ synthetic
+ ->GetNumChildren() /* synthetic does not have that many values */) {
valobj_sp->GetExpressionPath(var_expr_path_strm);
error.SetErrorStringWithFormat(
"array index %ld is not valid for \"(%s) %s\"", child_index,
@@ -930,9 +929,10 @@ ValueObjectSP StackFrame::GetValueForVariableExpressionPath(
"\"(%s) %s\" is not an array type",
valobj_sp->GetTypeName().AsCString("<invalid type>"),
var_expr_path_strm.GetData());
- } else if (static_cast<uint32_t>(child_index) >=
- synthetic->GetNumChildrenIgnoringErrors() /* synthetic
- does not have that many values */) {
+ } else if (
+ static_cast<uint32_t>(child_index) >=
+ synthetic
+ ->GetNumChildren() /* synthetic does not have that many values */) {
valobj_sp->GetExpressionPath(var_expr_path_strm);
error.SetErrorStringWithFormat(
"array index %ld is not valid for \"(%s) %s\"", child_index,
@@ -1397,8 +1397,7 @@ ValueObjectSP GetValueForOffset(StackFrame &frame, ValueObjectSP &parent,
return parent;
}
- for (int ci = 0, ce = parent->GetNumChildrenIgnoringErrors(); ci != ce;
- ++ci) {
+ for (int ci = 0, ce = parent->GetNumChildren(); ci != ce; ++ci) {
ValueObjectSP child_sp = parent->GetChildAtIndex(ci);
if (!child_sp) {
More information about the lldb-commits
mailing list