This patch creates a new `FormatEntity::Formatter` class and moves `FormatEntity::Format` (and related APIs) into it. Most of the parameters to `Format` are immutable across all recursive calls, so I made them `const` member variables of `Formatter`. The main changes are just mechanical renaming of: ``` FormatEntity::Format(...) ``` to ``` FormatEntity::Formatter(...).Format(stream, entry, valobj) ``` and making use of the member variables from inside `Format`. We can probably make most of the parameters to the `Formatter` constructor defaulted, but I chose not to in this patch to keep the diff smaller. The motivation for this is that I'm planning on adding logic to detect recursive format entities (which would crash LLDB). That requires some state, which in my opinion is best kept inside the `Formatter` class instead of another parameter to `Format`. The patch should be entirely NFC.
5.7 KiB
5.7 KiB