[cfe-dev] ArrayType and qualifiers

John McCall rjmccall at apple.com
Thu Jan 27 13:18:26 PST 2011

On Jan 27, 2011, at 10:03 AM, Abramo Bagnara wrote:
> In recent clang versions while syntactically parsed ArrayTypes have
> qualifiers in element type (congruently with the standard), canonical
> ArrayTypes have qualifers *only* on array type.

Syntactically parsed array types can have qualifiers at any level due to
typedefs, just like always.

> 1) why element qualifiers are *moved* to ArrayType instead of to be
> *propagated* to ArrayType? (i.e. qualifiers would be in both ArrayType
> and element type)

Because it's still quite expensive to canonicalize a type in that representation,
and it becomes very awkward to manipulate qualifiers on even canonical

> 2) considered that now calling getElementType() on a canonical ArrayType
> returns the wrong result, how is possible to get the right element type
> e.g. using TypeVisitor?

I hadn't really considered the effects this would have on people using
TypeVisitor on a canonical type.  Mostly, I wasn't aware that that was at all
common.  If it is, maybe we should change TypeVisitor.


More information about the cfe-dev mailing list