This is an archive of the discontinued LLVM Phabricator instance.

[lldb][NFC] Let CompilerType::DumpTypeValue take a option struct instead of a huge list of options
AbandonedPublic

Authored by teemperor on Nov 12 2019, 4:55 AM.

Details

Reviewers
labath
davide
Summary

This function has 8 parameters which makes its function calls hard to read. It also
doesn't help that half the parameters are just integers of some form. What's even worse is that
we fiddle around with all these signatures/invocations downstream in swift-lldb just because we
add one parameter there.

Let's just pass a struct here so that we can add the default values in a sensible way and actually
have some descriptive name beside the values we pass as parameters when we call this function.
Also moves the hidden documentation from the one function call to the struct so that it becomes
more obvious what's going on here.

Diff Detail

Event Timeline

teemperor created this revision.Nov 12 2019, 4:55 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 12 2019, 4:55 AM

I can't say I'm a fan of one-shot argument pack structures... For instance, one thing that's lost by this particular implementation is the implicit "nonnull" annotations on the arguments conferred by the references (the data extractor is already "nonnull", the stream isn't but it probably ought to be).

IIRC, we have a nontrivial number of functions which have a need to take a "reference" to some bitfield-y thing. For instance, the DumpDataExtractor function, which is also mentioned in this patch... Can we come up with some clever way to pack the arguments specifying the data to process into a single entity? That would replace five of these arguments by one, which should bring down the total number of arguments to this function to a reasonable size. And it would be usable in other contexts too...

teemperor abandoned this revision.Nov 15 2019, 1:44 AM

D70294 is the new thing