[PATCH] D57076: [ObjC generics] Fix applying `__kindof` to the type parameter.

Volodymyr Sapsai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 22 18:19:48 PST 2019


vsapsai created this revision.
vsapsai added reviewers: ahatanak, erik.pilkington.
Herald added subscribers: dexonsmith, jkorous.

Fixes the warning about incompatible pointer types on assigning to a
subclass of type argument an expression of type `__kindof TypeParam`.

We already have a mechanism in `ASTContext::canAssignObjCInterfaces`
that handles `ObjCObjectType` with `__kindof`. But it wasn't triggered
because during type substitution `__kindof TypeParam` was represented as
`AttributedType` with attribute `ObjCKindOf` and equivalent type
`TypeArg`. For assignment type checking we use canonical types so
attributed type was desugared and the attribute was ignored.

The fix is in checking transformed `AttributedType` and pushing
`__kindof` down into `ObjCObjectType` when necessary.

rdar://problem/38514910


https://reviews.llvm.org/D57076

Files:
  clang/lib/AST/Type.cpp
  clang/test/SemaObjC/kindof.m

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57076.183011.patch
Type: text/x-patch
Size: 4782 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190123/6b2b0cb3/attachment-0001.bin>


More information about the cfe-commits mailing list