[PATCH] D96816: [ObjC] Encode pointers to C++ classes as "^v" if the encoded string would otherwise include template specialization types

David Chisnall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 17 01:20:53 PST 2021


theraven requested changes to this revision.
theraven added a comment.
This revision now requires changes to proceed.

I'm broadly in favour of this change, but with the GNUstep ABIs this is an ABI-breaking change and so should not be on by default.  The type encoding leaks into the ABI in two ways:

- Dispatch is dependent on type, which avoids some stack corruption bugs on NeXT-style runtimes.  This means that the types of the selector in the caller and the selector in the method definition must match.  I don't see a problem with turning this change off for this specific case, because it's incredibly rare to pass complex C++ template types as arguments to Objective-C methods.
- The variable that contains the offset of ivars includes the type encoding, so that changing the type of a public ivar breaks linkage, rather than just subtly corrupting data later.  We could leave this change on for any `@private` or `@package` ivars, but changing the type encoding for public ivars will break code linking with existing frameworks.

I'm quite happy with this to be opt-in for non-Apple runtimes and opt-out for Apple runtimes.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96816/new/

https://reviews.llvm.org/D96816



More information about the cfe-commits mailing list