Open bbannier opened 2 months ago
If the unit is public we can never make this optimization since hooks might be implemented in C++ which we cannot inspect.
If the field is anonymous, one can't install a hook, no? Seems reasonable to to imply "cannot be accessed and imply skip" even if the unit is public, no?
If the field is anonymous, one can't install a hook, no? Seems reasonable to to imply "cannot be accessed and imply skip" even if the unit is public, no?
Of course 🤦, since one cannot refer to anon fields elsewhere, hooks on them have to be defined inline!
If the unit is public we can never make this optimization since hooks might be implemented in C++ which we cannot inspect.
I don't think this is the case. How would you add a hook implementation in custom C++? For that to run, it would need to be called from the generated hook stub, which won't know anything about the hook. Or am I missing something?
The value from an anonymous field is not accessed via
$$
in attributes like e.g.,&convert
or&requires
, or hooks it should always be possible to automatically mark itskip
.~While checking the attributes can be done locally, checking for
$$
in hooks would require global analysis looking at all files in the compilation. If the unit ispublic
we can never make this optimization since hooks might be implemented in C++ which we cannot inspect.~ We can make use of the fact that one can only add hooks to anon fields inline.