John McCall wrote:
> Author: rjmccall
> Date: Thu Oct 22 17:37:11 2009
> New Revision: 84907
>
> URL: http://llvm.org/viewvc/llvm-project?rev=84907&view=rev
> Log:
> When building types from declarators, instead of building two types (one for
> the DeclaratorInfo, one for semantic analysis), just build a single type whose
> canonical type will reflect the semantic analysis (assuming the type is
> well-formed, of course).
>
> To make that work, make a few changes to the type system:
> * allow the nominal pointee type of a reference type to be a (possibly
> sugared)
> reference type. Also, preserve the original spelling of the reference type.
> Both of these can be ignored on canonical reference types.
>
> - QualType getPointeeType() const { return PointeeType; }
> + bool isSpelledAsLValue() const { return SpelledAsLValue; }
> +
> + QualType getPointeeTypeAsWritten() const { return PointeeType; }
> + QualType getPointeeType() const {
> + // FIXME: this might strip inner qualifiers; okay?
> + const ReferenceType *T = this;
> + while (T->InnerRef)
> + T = T->PointeeType->getAs<ReferenceType>();
> + return T->PointeeType;
> + }
>
Yes, I believe this is OK. Technically, there can't be any other
qualifiers, since references cannot be qualified. If we accept them,
they're still ignored.
typedef const int &IRef; // This const must be preserved
typedef const IRef &IRefRef; // This const will get lost, but is
meaningless anyway.
Hmm ... it might not be OK for the restrict qualifier.
Sebastian
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits