Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Computing return type for auto fold-expressions

Thanks for your help. I got my solution to work before I saw your first email but your solution was much better. I've changed my solution to the one with your suggestion (hopefully).

This last email confuses me more than it helps :D I'm not sure if I understand you correctly now. You don‘t want me to use the evaluations for the arguments while constructing the tree but the evaluations for the ICPPParameter? 

I create my evaluation (EvalFold) with the evaluation for the pack expansion and (if existing) the init _expression_ as an array. If the evaluation hasn't been instantiated yet I'm just creating a TypeOfDependentExpression on getType().
I'm creating the tree currently in the instantiate(InstantiationContext, int): I get the instantiation point with CPPSemantics.getCurrentLookupPoint(), get the ICPPASTFunctionCallExpression from there on and then the evaluation of the function call where I get the evaluations from the arguments from. Then I create the tree with the evaluations for the arguments (+init if existing) and replace the existing evaluations that I constructed the EvalFold in the beginning with. I thought that this was maybe not the intended way but could not find a better way to get the evaluations for the arguments.

What do you mean now exactly? Which part is not correct about that?

Marco


On Tue, Oct 3, 2017 at 7:14 AM Nathan Ridge <zeratul976@xxxxxxxxxxx> wrote:
> You have evaluations for the concrete arguments t1, t2, and t4.
> I'll just refer to those as "t1", "t2", and "t4".
>
> The _expression_ that gets instantiated is "t1 + t2 + t4". Since + is
> left-associative, that's parenthesized as (t1 + t2) + t4.
>
> So construct the following evaluation tree:
>
>   EvalBinary
>     left: EvalBinary
>       left: t1
>       right: t2
>     right: t4

Thinking about this some more, just wanted to clarify that you
wouldn't be using the evaluations for the _arguments_ when
constructing the evaluation tree, since you'd probably be doing
it when instantiating the function body, at which time you don't
have the arguments yet. Rather, you'd be using the evaluations
for the _parameters_ of the instantiated function, as obtained
by ICPPFunction.getParameters().

However, the general idea of constructing an evaluation tree
is unchanged.

Hope that clarifies things further.

Regards,
Nate
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/cdt-dev

Back to the top