[Patch][ObjC][Proposal] NSValue literals

Alexey Denisov 1101.debian at gmail.com
Tue Apr 7 15:29:08 PDT 2015


Hi guys,
here is ‘intermediate’ patch, please consider this version as a draft,
it’s not finished yet and has some issues besides that.
I’m posting this to keep you updated and to get feedback earlier.

Implementation details:

Usual 'ObjCBoxedExpr' has only one 'SubExpr', but in case of
'valueWithBytes:objCType:' it has two, it means that ObjCBoxedExpr has to be extended

I spent some time thinking about possible implementations and found  at least three:

  - 'PseudoObjectExpr': use pseudo object as a 'SubExpr' to mimic two arguments,
very close but it doesn't work because CodeGen module emits code generation for
every method parameter, though 'ObjCBoxedExpr' has only one 'SubExpr'
  - 'ObjCBoxableExpr': was thinking to introduce new AST node, but, imho, it's overkill
and node name is confusing, this option also was rejected
  - 'ObjCBoxedExpr' with SubExprs: finally I decided to extend 'ObjCBoxedExpr'
to accept array of sub-expressions, instead of one expression


Known issues:

  - documentation needs to be updated
  - ASTReader/ASTWriter lack tests
  - r-values aren't supported yet, need to add tests/implementation

Next steps:

  - get feedback about current implementation
  - fix known and newly discovered issues

--
AlexDenisov
Software Engineer, http://alexdenisov.github.io

-------------- next part --------------
A non-text attachment was scrubbed...
Name: objc_boxable.patch
Type: application/octet-stream
Size: 52329 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150408/dd78f92c/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 496 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150408/dd78f92c/attachment.sig>


More information about the cfe-commits mailing list