[cfe-dev] What are canonical Types in Clang

Richard Smith richard at metafoo.co.uk
Tue Aug 12 12:11:13 PDT 2014


On Tue, Aug 12, 2014 at 9:17 AM, cedlemo <cedlemo at gmx.com> wrote:

>  On 11/08/2014 20:37, Richard Smith wrote:
>
>  according to the clang reference on type
>> http://clang.llvm.org/docs/InternalsManual.html#canonical-types , I
>> thought that the isCanonical() should return true when no typedef is
>> involved.
>>
> No, there are lots of other things that can make a type non-canonical.
>
>  Could you be a bit more specific ?
>

Sure. Consider:

  int (x);

The type of x is not a BuiltinType; it's a ParenType whose canonical type
is a BuiltinType. And given

  struct X { int n; };
  struct X x;

the type of x will probably be represented as an ElaboratedType whose
canonical type is a RecordType.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140812/88e9d293/attachment.html>


More information about the cfe-dev mailing list