rsmith added a comment.

I'm not entirely sure whether I want to pursue this -- I'd prefer to have only 
a single mechanism that works well in both C and C++, rather than this (which 
is flexible but not really usable in C) and `__builtin_dump_struct` (which is 
extremely inflexible but works well for C) -- but I've not found a good way to 
expose this functionality that provides good support for both use cases yet. 
Thoughts on that are welcome.

This came from wanting to write up how I would have like to have seen 
`__builtin_dump_struct` be implemented. Note in particular that all of the work 
is done in `Sema` with proper semantic checking, rather than in CodeGen, which 
avoids the problems that `__builtin_dump_struct` has with converting arguments 
to the right type, provides a lot more flexibility in the function argument, 
and supports constant evaluation for free.

This is somewhat WIP: access checking is not done consistently (I'm not sure 
whether we should ignore access control or properly enforce it; the 
derived-to-base conversions currently enforce it and the field accesses ignore 
it, which is certainly not the right answer), and the changes to tame an 
over-aggressive  `-Wunused-value` warning on `PseudoObjectExpr`s aren't quite 
right yet, leading to test failures.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124221

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to