From 745e57c5939e289789b9171e118b09c3c59c572a Mon Sep 17 00:00:00 2001 From: Cameron Desrochers Date: Wed, 9 Oct 2019 21:15:48 +0000 Subject: [PATCH] [LLDB] Fix for regression of test 'TestDataFormatterInvalidStdUniquePtr.py' introduced in r374195 Differential Revision: https://reviews.llvm.org/D68641 llvm-svn: 374231 --- lldb/source/Plugins/Language/CPlusPlus/LibCxxTuple.cpp | 4 +++- lldb/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp | 2 +- lldb/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp | 6 +++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxTuple.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxTuple.cpp index c86ab6b..45294e2 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxTuple.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxTuple.cpp @@ -79,7 +79,9 @@ ValueObjectSP TupleFrontEnd::GetChildAtIndex(size_t idx) { m_elements[idx] = elem_sp->Clone(ConstString(llvm::formatv("[{0}]", idx).str())).get(); - return m_elements[idx]->GetSP(); + if (m_elements[idx]) + return m_elements[idx]->GetSP(); + return ValueObjectSP(); } SyntheticChildrenFrontEnd * diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp index 15bf7f8..0ac7b8f 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp @@ -90,7 +90,7 @@ bool LibStdcppTupleSyntheticFrontEnd::MightHaveChildren() { return true; } lldb::ValueObjectSP LibStdcppTupleSyntheticFrontEnd::GetChildAtIndex(size_t idx) { - if (idx < m_members.size()) + if (idx < m_members.size() && m_members[idx]) return m_members[idx]->GetSP(); return lldb::ValueObjectSP(); } diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp index 84f9e57..cceb511 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp @@ -118,11 +118,11 @@ bool LibStdcppUniquePtrSyntheticFrontEnd::MightHaveChildren() { return true; } lldb::ValueObjectSP LibStdcppUniquePtrSyntheticFrontEnd::GetChildAtIndex(size_t idx) { - if (idx == 0) + if (idx == 0 && m_ptr_obj) return m_ptr_obj->GetSP(); - if (idx == 1) + if (idx == 1 && m_del_obj) return m_del_obj->GetSP(); - if (idx == 2) + if (idx == 2 && m_obj_obj) return m_obj_obj->GetSP(); return lldb::ValueObjectSP(); } -- 2.7.4