[Lldb-commits] [PATCH] D48114: Add dataformatter for NSDecimalNumber

Adrian Prantl via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 12 21:36:16 PDT 2018


aprantl added inline comments.


================
Comment at: source/Plugins/Language/ObjC/Cocoa.cpp:462
 
+  if (!strcmp(class_name, "NSDecimalNumber"))
+    return NSDecimalNumberSummaryProvider(valobj, stream, options);
----------------
Side note: It would be slightly faster/elegant to use a StringRef instead of the char* for the comparisons.


================
Comment at: source/Plugins/Language/ObjC/Cocoa.cpp:639
+  lldb::addr_t valobj_addr = valobj.GetValueAsUnsigned(0);
+  uint32_t ptr_size = process_sp->GetAddressByteSize();
+
----------------
Since the whole structure is one packed bitfield, an alternative implementation would be to read all 16b at once and memcpy to a local variable bitfield and let the compiler do the unpacking; that might be shorter. This version seems fine, too.


Repository:
  rL LLVM

https://reviews.llvm.org/D48114





More information about the lldb-commits mailing list