On 6/8/20 5:46 AM, Eric Botcazou wrote:
The only case handled specially is TYPE_DECL; other DECL_EXPRs fall
through to the default case, where we WALK_SUBTREE over all the operands
of the expression, which for DECL_EXPR is the decl.
It seems hard to believe that the inliner relies on this to copy DECLs though,
I agree! I imagine the actual inliner is unaffected because that
happens in GIMPLE now, so this only affects FE cloning. I don't know if
any other front ends use a walk_tree callback like copy_tree_body_r that
would replace a type in the same way.
see the calls to remap_decl[s].
Which ones?
And note that remap_decl has had a special
handling for DECL_ORIGINAL_TYPE of TYPE_DECLs since 2003.
Yes, but the problem is that remap_decl isn't getting called.
Are you sure the
problem is not that the TYPE_DECL is not attached to the enclosing BIND_EXPR?
Attaching it to the BIND_EXPR doesn't help walk_tree_1 do the right
thing with the DECL_EXPR.
Jason