From 4502e3531f623c47e71d3a159580a72560b90954 Mon Sep 17 00:00:00 2001 From: Slava Gurevich Date: Tue, 2 Aug 2022 11:54:52 -0700 Subject: [PATCH] [LLDB][NFC] Fix incorrect return status Some functions always return 'false' for both success and fail return paths. Differential Revision: https://reviews.llvm.org/D131013 --- lldb/source/Plugins/Language/ObjC/NSArray.cpp | 10 ++++------ lldb/source/Plugins/Language/ObjC/NSDictionary.cpp | 10 ++++------ lldb/source/Plugins/Language/ObjC/NSSet.cpp | 6 ++---- 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/lldb/source/Plugins/Language/ObjC/NSArray.cpp b/lldb/source/Plugins/Language/ObjC/NSArray.cpp index adda04e..876efda 100644 --- a/lldb/source/Plugins/Language/ObjC/NSArray.cpp +++ b/lldb/source/Plugins/Language/ObjC/NSArray.cpp @@ -532,9 +532,8 @@ lldb_private::formatters:: process_sp->ReadMemory(data_location, m_data_64, sizeof(D64), error); } - if (error.Fail()) - return false; - return false; + + return error.Success(); } bool @@ -675,9 +674,8 @@ lldb_private::formatters::GenericNSArrayISyntheticFrontEnd:: process_sp->ReadMemory(data_location, m_data_64, sizeof(D64), error); } - if (error.Fail()) - return false; - return false; + + return error.Success(); } template diff --git a/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp b/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp index e5e62b5..be74338 100644 --- a/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp +++ b/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp @@ -1121,9 +1121,8 @@ lldb_private::formatters::GenericNSDictionaryMSyntheticFrontEnd:: process_sp->ReadMemory(data_location, m_data_64, sizeof(D64), error); } - if (error.Fail()) - return false; - return true; + + return error.Success(); } template @@ -1284,9 +1283,8 @@ lldb_private::formatters::Foundation1100:: process_sp->ReadMemory(data_location, m_data_64, sizeof(DataDescriptor_64), error); } - if (error.Fail()) - return false; - return false; + + return error.Success(); } bool diff --git a/lldb/source/Plugins/Language/ObjC/NSSet.cpp b/lldb/source/Plugins/Language/ObjC/NSSet.cpp index b5c8e84..fac8594 100644 --- a/lldb/source/Plugins/Language/ObjC/NSSet.cpp +++ b/lldb/source/Plugins/Language/ObjC/NSSet.cpp @@ -461,7 +461,7 @@ bool lldb_private::formatters::NSSetISyntheticFrontEnd::Update() { if (error.Fail()) return false; m_data_ptr = data_location + m_ptr_size; - return false; + return true; } bool lldb_private::formatters::NSSetISyntheticFrontEnd::MightHaveChildren() { @@ -735,9 +735,7 @@ lldb_private::formatters:: process_sp->ReadMemory(data_location, m_data_64, sizeof(D64), error); } - if (error.Fail()) - return false; - return false; + return error.Success(); } template -- 2.7.4