[PATCH] D124221: Reimplement `__builtin_dump_struct` in Sema.

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 2 00:52:07 PDT 2022


rsmith added a comment.

In D124221#3469251 <https://reviews.llvm.org/D124221#3469251>, @rsmith wrote:

> I think we can address most of my concerns with `__builtin_dump_struct` without a new builtin, by incorporating things from this implementation

Done; this patch now reimplements `__builtin_dump_struct` using the `Sema` desugaring approach rather than providing a new builtin. As in the prior patch, we still support passing an arbitrary callable and additional arguments, and in C++ we support constant-evaluation of the dump as well as generic printing of field values even for types that the builtin doesn't natively understand. But the interface remains simple enough that you can just call `__builtin_dump_struct(&s, printf)` or `__builtin_dump_struct(&s, fprintf, stderr)` and get a dump to stdout / stderr.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124221/new/

https://reviews.llvm.org/D124221



More information about the cfe-commits mailing list