[all-commits] [llvm/llvm-project] c4f95e: Reimplement `__builtin_dump_struct` in Sema.
Richard Smith via All-commits
all-commits at lists.llvm.org
Thu May 5 14:56:03 PDT 2022
Author: Richard Smith <richard at metafoo.co.uk>
Date: 2022-05-05 (Thu, 05 May 2022)
Reimplement `__builtin_dump_struct` in Sema.
Compared to the old implementation:
* In C++, we only recurse into aggregate classes.
* Unnamed bit-fields are not printed.
* Constant evaluation is supported.
* Proper conversion is done when passing arguments through `...`.
* Additional arguments are supported and are injected prior to the
format string; this directly supports use with `fprintf`, for example.
* An arbitrary callable can be passed rather than only a function
pointer. In particular, in C++, a function template or overload set is
* All text generated by Clang is printed via `%s` rather than directly;
this avoids issues where Clang's pretty-printing output might itself
contain a `%` character.
* Fields of types that we don't know how to print are printed with a
`"*%p"` format and passed by address to the print function.
* No return value is produced.
Reviewed By: aaron.ballman, erichkeane, yihanaa
Differential Revision: https://reviews.llvm.org/D124221
More information about the All-commits