[ObjC] Fix the formatter for NSOrderedSet.

While I'm here, delete some dead code.

<rdar://problem/40622096>

llvm-svn: 333465
This commit is contained in:
Davide Italiano 2018-05-29 22:08:07 +00:00
parent dbd371e931
commit d9b9c919bc
3 changed files with 30 additions and 28 deletions

View File

@ -0,0 +1,17 @@
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestOrderedSet(TestBase):
mydir = TestBase.compute_mydir(__file__)
def test_ordered_set(self):
self.build()
src_file = "main.m"
src_file_spec = lldb.SBFileSpec(src_file)
(target, process, thread, main_breakpoint) = lldbutil.run_to_source_breakpoint(self,
"break here", src_file_spec, exe_name = "a.out")
frame = thread.GetSelectedFrame()
self.expect("expr -d run -- orderedSet", substrs=["3 elements"])
self.expect("expr -d run -- *orderedSet", substrs=["(int)1", "(int)2", "(int)3"])

View File

@ -0,0 +1,8 @@
#import <Foundation/Foundation.h>
int main() {
NSOrderedSet *orderedSet =
[NSOrderedSet orderedSetWithArray:@[@1,@2,@3,@1]];
NSLog(@"%@",orderedSet);
return 0; // break here
}

View File

@ -269,7 +269,8 @@ bool lldb_private::formatters::NSSetSummaryProvider(
if (!class_name || !*class_name)
return false;
if (!strcmp(class_name, "__NSSetI")) {
if (!strcmp(class_name, "__NSSetI") ||
!strcmp(class_name, "__NSOrderedSetI")) {
Status error;
value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size,
ptr_size, 0, error);
@ -289,32 +290,7 @@ bool lldb_private::formatters::NSSetSummaryProvider(
}
if (error.Fail())
return false;
}
/*else if (!strcmp(class_name,"__NSCFSet"))
{
Status error;
value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + (is_64bit ?
20 : 12), 4, 0, error);
if (error.Fail())
return false;
if (is_64bit)
value &= ~0x1fff000000000000UL;
}
else if (!strcmp(class_name,"NSCountedSet"))
{
Status error;
value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size,
ptr_size, 0, error);
if (error.Fail())
return false;
value = process_sp->ReadUnsignedIntegerFromMemory(value + (is_64bit ? 20 :
12), 4, 0, error);
if (error.Fail())
return false;
if (is_64bit)
value &= ~0x1fff000000000000UL;
}*/
else {
} else {
auto &map(NSSet_Additionals::GetAdditionalSummaries());
auto iter = map.find(class_name_cs), end = map.end();
if (iter != end)
@ -371,7 +347,8 @@ lldb_private::formatters::NSSetSyntheticFrontEndCreator(
if (!class_name || !*class_name)
return nullptr;
if (!strcmp(class_name, "__NSSetI")) {
if (!strcmp(class_name, "__NSSetI") ||
!strcmp(class_name, "__NSOrderedSetI")) {
return (new NSSetISyntheticFrontEnd(valobj_sp));
} else if (!strcmp(class_name, "__NSSetM")) {
AppleObjCRuntime *apple_runtime =