This is an archive of the discontinued LLVM Phabricator instance.

[lldb/Utility] Make `StructuredData::Dictionary::GetKeys` return an `Array`
ClosedPublic

Authored by mib on Mar 24 2022, 12:20 PM.

Details

Summary

This patch changes StructuredData::Dictionary::GetKeys return type
from an StructuredData::ObjectSP to a StructuredData::ArraySP.

The function already stored the keys in an array but implicitely upcasted
it to an ObjectSP, which required the user to convert it again to a
Array object to access each element.

Since we know the keys should be held by an iterable container, it makes
more sense to return the allocated ArraySP as-is.

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>

Diff Detail

Event Timeline

mib created this revision.Mar 24 2022, 12:20 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 24 2022, 12:20 PM
mib requested review of this revision.Mar 24 2022, 12:20 PM
mib retitled this revision from [lldb/Utility] Make `StructuredData::Dictionary::GetKeys1 return an `Array` to [lldb/Utility] Make `StructuredData::Dictionary::GetKeys` return an `Array`.Mar 24 2022, 12:50 PM
JDevlieghere accepted this revision.Mar 25 2022, 2:34 PM

Makes sense. LGTM

This revision is now accepted and ready to land.Mar 25 2022, 2:34 PM