[PATCH] coroutines, c++: Find lambda-ness from the ramp function [PR 96517].

Iain Sandoe iain@sandoe.co.uk
Sat Nov 6 00:48:54 GMT 2021


Hi Jason

> On 5 Nov 2021, at 21:53, Jason Merrill <jason@redhat.com> wrote:
> 
> On 11/5/21 17:16, Iain Sandoe wrote:
>> Hi Jason,
>>> On 5 Nov 2021, at 20:50, Jason Merrill via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
>>> 
>>> On 11/5/21 12:01, Iain Sandoe wrote:
>>>> +	      || (DECL_DECLARES_FUNCTION_P (DECL_CONTEXT (decl))
>>>> +		  && DECL_COROUTINE_P (DECL_CONTEXT (decl))
>>>> +		  && DECL_RAMP_FN (DECL_CONTEXT (decl))
>>>> +		  && LAMBDA_FUNCTION_P (DECL_RAMP_FN (DECL_CONTEXT (decl))))));
>>> 
>>> Are there other places that want to look through DECL_RAMP_FN like this, such that this should be factored into e.g.
>>> 
>>> LAMBDA_FUNCTION_P (non_coroutine (DECL_CONTEXT (decl)))
>> At present, I am not aware of another use (there are none in my WIP fixes) - but that stack of macros is a bit of a mouthful - maybe  a function would be neater anyway.
>> non_coroutine () doesn’t convey its meaning to me - what we are trying to say “get me the ramp context” but that’s very detailed.
> 
> I figured what we want is the user-written function corresponding to the argument.

yes, we want the context of the original function that contained the variable/proxy we’re examining.
- the original function becomes the ramp.

>  Hmm, the coroutine helpers don't use DECL_ABSTRACT_ORIGIN, do they?

No, it did not work AFAIR - at the time I figured it was because the helpers are not actually real clones of the original function but outlined portions of it (with a different signature).

Iain

> 
> Jason
> 



More information about the Gcc-patches mailing list