This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Remove ProcessStructReader from NSStringSummaryProvider (NFC)
ClosedPublic

Authored by kastiglione on Dec 31 2021, 2:04 PM.

Details

Summary

Simplify getting the length of NSPathStore2 strings.

NSStringSummaryProvider uses a single field from NSPathStore2 instances, its first ivar: _lengthAndRefCount. This change uses GetSyntheticChildAtOffset to replace the use of ProcessStructReader, and removes the hard coded CompilerType definition of NSPathStore2.

Diff Detail

Event Timeline

kastiglione requested review of this revision.Dec 31 2021, 2:04 PM
kastiglione created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptDec 31 2021, 2:04 PM
aprantl accepted this revision.Jan 7 2022, 1:00 PM

This doesn't look any less readable than the code it replaces and is definitely faster.

This revision is now accepted and ready to land.Jan 7 2022, 1:00 PM

To add more context, ProcessStructReader is used in only a few places, and none seem like they should truly need it. This was a low hanging fruit.

Something I don't understand about this code is why it the objc metadata is incomplete. The class is known, but not its ivars, why? In theory this code should be able to request the _lengthAndRefCount child member directly by name.

give name to synthetic child