Patch for Bug 30413, including test case

Lobron, David via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 9 13:01:29 PST 2017


Hi Akira,

> My concern is that the patch changes the encoding of @encode(id<NSObject>) on Darwin, which I think isn’t what you are trying to fix. If you compile the following code with command “clang -cc1 -triple x86_64-apple-macosx”, the type encoding changes after applying the patch.
> 
> const char *foo() {
>  return @encode(id<NSObject>);
> }
> 
> It seems like you can fix your problem without affecting Darwin by passing an extra argument to getObjCEncodingForType, just like CGObjCCommonMac::GetMethodVarType does.

Ah, thanks- I understand now.  Yes, this change seems a lot safer, and I verified that it passes my test.  I've attached my new patch file, and I've also attached the test again.  Please let me know if this works for you or if you think it needs any additional work.

--David

-------------- next part --------------
A non-text attachment was scrubbed...
Name: CGObjCGNU.cpp.patch
Type: application/octet-stream
Size: 657 bytes
Desc: CGObjCGNU.cpp.patch
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170309/08a9fedf/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ivar-type-encoding.m
Type: application/octet-stream
Size: 770 bytes
Desc: ivar-type-encoding.m
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170309/08a9fedf/attachment-0001.obj>


More information about the cfe-commits mailing list