This is an archive of the discontinued LLVM Phabricator instance.

Add dataformatter for NSDecimalNumber
ClosedPublic

Authored by JDevlieghere on Jun 12 2018, 8:23 PM.

Details

Summary

This patch adds a data formatter for NSDecimalNumber. The latter is a Foundation object used for representing and performing arithmetic on base-10 numbers that bridges to Decimal.

Diff Detail

Repository
rL LLVM

Event Timeline

JDevlieghere created this revision.Jun 12 2018, 8:23 PM
aprantl added inline comments.Jun 12 2018, 9:36 PM
source/Plugins/Language/ObjC/Cocoa.cpp
462 ↗(On Diff #151096)

Side note: It would be slightly faster/elegant to use a StringRef instead of the char* for the comparisons.

639 ↗(On Diff #151096)

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.

davide accepted this revision.Jun 12 2018, 10:50 PM
davide added a subscriber: davide.

I didn't check whether the representation was correct (although it looks lo). The structure of the patch looks fine to me, thanks for adding the comments :)

This revision is now accepted and ready to land.Jun 12 2018, 10:50 PM
jingham accepted this revision.Jun 13 2018, 10:25 AM

This looks fine to me. Nothing in the TypeSummaryOptions is relevant to printing these numbers, so it's correct to ignore them.

This revision was automatically updated to reflect the committed changes.