From: Davide Italiano Date: Wed, 14 Mar 2018 23:09:36 +0000 (+0000) Subject: [DataFormatters] Implement summary for __NSDictionary0. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8f2e86da36269ec23bb22ef93b82e76e5d22166a;p=platform%2Fupstream%2Fllvm.git [DataFormatters] Implement summary for __NSDictionary0. Before the patch: (lldb) frame var emptyDictionary (__NSDictionary0 *) emptyDictionary = 0x0000000100304420 After: (lldb) frame var emptyDictionary (__NSDictionary0 *) emptyDictionary = 0x0000000100304420 0 key/value pairs There's nothing much else we can do, as this is always empty by definition. llvm-svn: 327587 --- diff --git a/lldb/lit/DataFormatters/Inputs/NSDict.commands b/lldb/lit/DataFormatters/Inputs/NSDict.commands new file mode 100644 index 0000000..2f03dae --- /dev/null +++ b/lldb/lit/DataFormatters/Inputs/NSDict.commands @@ -0,0 +1,3 @@ +breakpoint set --file NSDict.m --line 8 +run +frame var diff --git a/lldb/lit/DataFormatters/Inputs/NSDict.m b/lldb/lit/DataFormatters/Inputs/NSDict.m new file mode 100644 index 0000000..efc96fd --- /dev/null +++ b/lldb/lit/DataFormatters/Inputs/NSDict.m @@ -0,0 +1,9 @@ +#include + +int main(void) +{ + NSDictionary *emptyDictionary = [[NSDictionary alloc] init]; + NSMutableDictionary *mutableDictionary = [NSMutableDictionary dictionary]; + NSDictionary *dictionary = @{ @"key": @{} }; + return 0; +} diff --git a/lldb/lit/DataFormatters/TestEmptyDictionary.test b/lldb/lit/DataFormatters/TestEmptyDictionary.test new file mode 100644 index 0000000..c9e6a0c --- /dev/null +++ b/lldb/lit/DataFormatters/TestEmptyDictionary.test @@ -0,0 +1,7 @@ +# Test that foundation NSDictionary0 is formatted correctly (the summary). +# Foundation is only available on Darwin so just restrict the test to run there. +# REQUIRES: darwin +# RUN: %cc %p/Inputs/NSDict.m -framework Foundation -g -o %t && %lldb -b \ +# RUN: -s %p/Inputs/NSDict.commands -- %t 2>&1 | FileCheck %s + +# CHECK: (__NSDictionary0 *) emptyDictionary = {{.*}} 0 key/value pairs diff --git a/lldb/lit/DataFormatters/lit.local.cfg b/lldb/lit/DataFormatters/lit.local.cfg new file mode 100644 index 0000000..df9b335 --- /dev/null +++ b/lldb/lit/DataFormatters/lit.local.cfg @@ -0,0 +1 @@ +config.suffixes = ['.test'] diff --git a/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp b/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp index 0af36f4..67b0ce8 100644 --- a/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp +++ b/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp @@ -396,6 +396,7 @@ bool lldb_private::formatters::NSDictionarySummaryProvider( static const ConstString g_DictionaryMLegacy("__NSDictionaryM_Legacy"); static const ConstString g_DictionaryMImmutable("__NSDictionaryM_Immutable"); static const ConstString g_Dictionary1("__NSSingleEntryDictionaryI"); + static const ConstString g_Dictionary0("__NSDictionary0"); if (class_name.IsEmpty()) return false; @@ -423,6 +424,8 @@ bool lldb_private::formatters::NSDictionarySummaryProvider( return false; } else if (class_name == g_Dictionary1) { value = 1; + } else if (class_name == g_Dictionary0) { + value = 0; } else { auto &map(NSDictionary_Additionals::GetAdditionalSummaries()); @@ -481,6 +484,7 @@ lldb_private::formatters::NSDictionarySyntheticFrontEndCreator( static const ConstString g_Dictionary1("__NSSingleEntryDictionaryI"); static const ConstString g_DictionaryImmutable("__NSDictionaryM_Immutable"); static const ConstString g_DictionaryMLegacy("__NSDictionaryM_Legacy"); + static const ConstString g_Dictionary0("__NSDictionary0"); if (class_name.IsEmpty()) return nullptr;