[Patch][ObjC][Proposal] NSValue literals

John McCall rjmccall at apple.com
Tue Apr 7 15:45:22 PDT 2015


> On Apr 7, 2015, at 3:29 PM, Alexey Denisov <1101.debian at gmail.com> wrote:
> 
> 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

This seems like the right way to go.  You can limit it to two if it makes the representation more efficient.

I’ll take a look at the patch later.

John.

> 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
> 
> <objc_boxable.patch>





More information about the cfe-commits mailing list