Re: [RFA] varobj: call CHECK_TYPEDEF

Keith Seitz
2003-04-24T20:44:44Z

On Thu, 2003-04-24 at 13:18, Daniel Jacobowitz wrote:
> CHECK_TYPEDEF does just about what the name suggests - it replaces a
> TYPE_CODE_TYPEDEF type with the type (TYPE_CODE_STRUCT in this case)
> that it points to. Feel free to add a comment to that effect.

Ah! Duh! :-)

> The question is whether the caller of get_type ever wants the typedef;
> depending on how it's used these calls may belong in particular
> callers, not in get_type.

Hmm. Ok, well I would think that varobj would not want the typedef. For
example, if we have, "typedef struct foo Bar" and I declare a variable
of type Bar, varobj should report the number of children as the number
of children of the struct itself, not the typedef. get_type and
get_target_type already explicitly bypass TYPE_CODE_TYPEDEF.

Now the real ambiguity is: where to put this in varobj's case? Since
get_type (and consequently get_target_type and get_type_deref) are used
all over the place, so we would want to use CHECK_TYPEDEF there. But how
to not call it when not necessary? In the case I'm currently working on,
the TYPE_CODE (type) is TYPE_CODE_PTR and TYPE_CODE (TYPE_TARGET_TYPE
(type)) is TYPE_CODE_STRUCT. Perhaps there is something else I'm
missing? (Of course, this is still how whatis_command does it...)

??
Keith