[PATCH] D122822: [Clang][CodeGen]Add constant array support for __builtin_dump_sturct

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 31 12:48:19 PDT 2022


erichkeane added a comment.

In D122822#3420357 <https://reviews.llvm.org/D122822#3420357>, @rsmith wrote:

> One thing we could do would be to build a descriptor for the type (as data) -- a type name string, a type "kind", plus (for a record type) a list of (field type descriptor, field name, offset) tuples -- and pass it to a user-specified function. We could provide a library implementation of a dumping function that takes that descriptor and a function with printf's signature and provides the "normal" formatting per the current `__builtin_dump_struct` behavior -- and indeed we could then implement `__builtin_dump_struct(p, f)` as a call to `normal_dumping_function(__builtin_type_descriptor(T), p, f)`. I'm not sure how comfortable we'd be putting that library implementation in compiler-rt versus somewhere else, though it presumably wouldn't be very large.

This seems to be quickly decaying into 'implement Reflection', doesn't it?  I see this `__builtin_dump_struct` to be a useful debugging builtin.  As much as I see 'Reflection' as incredibly useful, I would think this is intended to be something much simpler, right?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122822



More information about the cfe-commits mailing list