<html><head><style>body{font-family:Helvetica,Arial;font-size:13px}</style></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">Here is another patch, with tests for CodeGen, it covers the same data types: NS/CG Rect, Size, Point and NSRange.</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">I’ve compiled test file with calls like ‘NSValue valueWith<Type>:' into LLVM IR, then added checks into the test file, they all passed.</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">After that I replaced direct NSValue calls with boxed expressions: @(cg_point), @(ns_rect), etc.</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">All the tests passes, excerpt of two which use NS/CGRect.</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">For the both cases CGM generates %ns_rect (%cg_rect respectively) variable and fills it with some data.</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">In case of direct call (valueWithRect) it just passes the variable to objc_msgSend, but in case of boxed expression there are some extra steps.</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">CGM creates additional variable (%agg-temp), copies %ns_rect’s value into it and passes the new var into objc_msgSend.</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">Actually, generated program has correct behaviour, but it has extra variable, which means that something is wrong.</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">Currently, I have no idea what is wrong and how to fix the issue, but, definitely, I’m going to dive deeper into the CodeGenModule.</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">I would really appreciate any suggestions or advice where to start. Also, any feedback on newly added CG tests are welcome.</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">In attachment you can find the patch and diff, which explains my problem in a better way.</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">Best regards.</div> <div id="bloop_sign_1416684277489888000" class="bloop_sign"><div style="font-family:helvetica,arial;font-size:13px">-- <br>AlexDenisov</div><div style="font-family:helvetica,arial;font-size:13px">Software Engineer, <a href="https://github.com/AlexDenisov">https://github.com/AlexDenisov</a></div></div> <br><p style="color:#000;">On 21 Nov 2014 at 18:10:46, AlexDenisov (<a href="mailto:1101.debian@gmail.com">1101.debian@gmail.com</a>) wrote:</p> <blockquote type="cite" class="clean_bq"><span><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div></div><div>




<title></title>



<div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">
Great, so let’s talk later, with another patch.</div>
<div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">
Thank you for help!</div>
<div id="bloop_sign_1416589819165182208" class="bloop_sign">
<div style="font-family:helvetica,arial;font-size:13px">
-- <br>
AlexDenisov</div>
<div style="font-family:helvetica,arial;font-size:13px">Software
Engineer, <a href="https://github.com/AlexDenisov">https://github.com/AlexDenisov</a></div>
</div>
<br>
<p style="color:#000;">On 21 Nov 2014 at 17:28:18, jahanian
(<a href="mailto:fjahanian@apple.com">fjahanian@apple.com</a>)
wrote:</p>
<blockquote type="cite" class="clean_bq">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div><span><br></span>
<div>
<div><span>On Nov 21, 2014, at 4:45 AM, AlexDenisov <<a href="mailto:1101.debian@gmail.com">1101.debian@gmail.com</a>>
wrote:</span></div>
<span><br class="Apple-interchange-newline"></span>
<blockquote type="cite">
<div style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div id="bloop_customfont" style="margin: 0px;">
<div>
<div style="font-family: Helvetica, Arial; font-size: 13px;">
<blockquote type="cite" class="clean_bq" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">
<div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div class=""><span>- It is important to have a complete IRGen
tests for all the supported boxed items.</span></div>
</div>
</blockquote>
</div>
<p style="font-family: Helvetica, Arial; font-size: 13px;">
<span>Could you, please, point me to the right direction? I’ve
found only few tests for literals under CodeGenObjC: boxing.m and
objc-literal-tests.m. Should I put new one there as well or just
create another file?</span></p>
<div><span><br></span></div>
</div>
</div>
</div>
</blockquote>
<span>The best one to look at is <span style="font-family: Menlo; font-size: 11px;">arc-literals.m. And it is
good to produce the test under -fobjc-arc and
without. </span></span></div>
<div><font face="Menlo"><span style="font-size: 11px;">Generally,
you need to compile your test with -emit-llvm -o -  and save
the output and then put the CHECKS</span></font></div>
<div><font face="Menlo"><span style="font-size: 11px;">around the code you care enough (and make
the register references generic, etc.).</span></font></div>
<div><font face="Menlo"><span style="font-size: 11px;">It will take
several iterations to get it right. </span></font></div>
<div><font face="Menlo"><span style="font-size: 11px;">Since you
need many tests of a variety of APIs it is good to have a brand new
test.</span></font></div>
<div><font face="Menlo"><span style="font-size: 11px;"><br></span></font>
<blockquote type="cite">
<div style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div id="bloop_customfont" style="margin: 0px;">
<div>
<div style="font-family: Helvetica, Arial; font-size: 13px;">
<blockquote type="cite" class="clean_bq" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">
<div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div class="">- <font face="Helvetica, Arial" size="2" class="">CGPoint, CGSize, CGRect are iOS APIs only. But I haven’t been
able to find their APIs in</font></div>
<div class=""><font face="Helvetica, Arial" size="2" class="">  the later version of iPhone SDKs. If they have been
removed recently, then we should make sure to check</font></div>
<div class=""><font face="Helvetica, Arial" size="2" class="">  the deployment target and issue proper diagnostics
if need be. This is generally the case for all the
APIs.</font></div>
<div class=""><font face="Helvetica, Arial" size="2" class="">  If we are going to use auto boxing, then
we need to make sure the APIs available in earlier (or
later) versions</font></div>
<div class=""><font face="Helvetica, Arial" size="2" class="">  of the SDKs.</font></div>
</div>
</blockquote>
</div>
<p>CG-structs are part of the CoreGraphics.framework. On OS X
NSValue' factory methods is a part of Foundation.framework
(NSGeometry.h,<span class="Apple-converted-space"> </span><font face="Helvetica">NSValueGeometryExtensions</font>), while on iOS they’re
part of UIKit (UIGeometry.h, <font face="Helvetica">NSValueUIGeometryExtensions</font>). I guess they’re
not going to disappear. Bu, I totally agree - deployment target
should be checked for methods/structs, which is unavailable at some
target version (e.g. <font face="Helvetica">NSEdgeInsets,
UIOffset</font>).</p>
<div><br></div>
</div>
</div>
</div>
</blockquote>
Great thanks.</div>
<div><br>
<blockquote type="cite">
<div style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div id="bloop_customfont" style="margin: 0px;">
<div>
<blockquote type="cite" class="clean_bq">
<div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div class=""><font face="Helvetica, Arial" size="2" class="">-
Have you though of supporting other item types? </font></div>
<div class=""><font face="Helvetica, Arial" size="2" class="">  </font><span class="" style="font-family: Menlo; font-size: 11px;">NSEdgeInsets
(</span>CGEdgeInsets for iOS?) macosx 10.10,  iPhone
8.0 </div>
<div class="">  non-retaining Objective-C objects.</div>
<div class="">  Any C pointers</div>
</div>
</blockquote>
<div style="font-family: Helvetica, Arial; font-size: 13px;">
<br></div>
<div style="font-family: Helvetica, Arial; font-size: 13px;">I
wasn’t sure if this feature will be accepted (and still don't), so
decided to sent patch only for these structs. But, yes, in my
opinion support for the whole ‘NSValueBoxable’ data types should be
implemented.</div>
</div>
</div>
</div>
</blockquote>
<div><br></div>
OK.  While you are focusing on the structs these can
wait.</div>
<div><br>
<blockquote type="cite">
<div style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div id="bloop_customfont" style="margin: 0px;">
<div>
<div style="font-family: Helvetica, Arial; font-size: 13px;">
<br class="Apple-interchange-newline"></div>
</div>
<div style="font-family: Helvetica, Arial; font-size: 13px;">
<br></div>
<div style="font-family: Helvetica, Arial; font-size: 13px;">Also,
I've realized later, there should be support for modernizer to
convert ‘old’ syntax to the new one.</div>
</div>
</div>
</blockquote>
<div><br></div>
Definitely, we should do that too. (I can help with that).</div>
<div><br>
<blockquote type="cite">
<div style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div id="bloop_customfont" style="margin: 0px;">
<div style="font-family: Helvetica, Arial; font-size: 13px;">I will
add more tests, and, probably add other data types support, if
there are no objections.</div>
</div>
</div>
</blockquote>
<div><br></div>
I would wait on the other data type support until we have gone
through the review process as it might impact implementation.</div>
<div><br>
<blockquote type="cite">
<div style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div id="bloop_customfont" style="margin: 0px;">
<div style="font-family: Helvetica, Arial; font-size: 13px;">
<br></div>
<div style="font-family: Helvetica, Arial; font-size: 13px;">Thank
you for feedback.</div>
</div>
</div>
</blockquote>
<div><br></div>
Thank you so much for working on this.</div>
<div>- Fariborz</div>
<div><br>
<blockquote type="cite">
<div style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div id="bloop_sign_1416572057165234176" class="bloop_sign">
<div style="font-family: helvetica, arial; font-size: 13px;">
-- <br>
AlexDenisov</div>
<div style="font-family: helvetica, arial; font-size: 13px;">
Software Engineer, <a href="https://github.com/AlexDenisov">https://github.com/AlexDenisov</a></div>
</div>
<br>
<p style="">On 20 Nov 2014 at 20:14:39, jahanian (<a href="mailto:fjahanian@apple.com">fjahanian@apple.com</a>) wrote:</p>
<blockquote type="cite" class="clean_bq">
<div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div><span>While, the review process is ongoing, I looked at the
patch. It is generally very good and closely follows the convention
for</span>
<div class=""><span>doing auto boxing of other types. I have few
general comments to make.</span></div>
<div class=""><span><br class=""></span></div>
<div class=""><span>- It is important to have a complete IRGen
tests for all the supported boxed items.</span></div>
<div class=""><span><br class=""></span></div>
<div class=""><span>- <font face="Helvetica, Arial" size="2" class="">CGPoint, CGSize, CGRect are iOS APIs only. But I haven’t
been able to find their APIs in</font></span></div>
<div class=""><span><font face="Helvetica, Arial" size="2" class="">  the later version of iPhone SDKs. If they have been
removed recently, then we should make sure to
check</font></span></div>
<div class=""><span><font face="Helvetica, Arial" size="2" class="">  the deployment target and issue proper diagnostics
if need be. This is generally the case for all the
APIs.</font></span></div>
<div class=""><span><font face="Helvetica, Arial" size="2" class="">  If we are going to use auto boxing, then
we need to make sure the APIs available in earlier (or
later) versions</font></span></div>
<div class=""><span><font face="Helvetica, Arial" size="2" class="">  of the SDKs.</font></span></div>
<div class=""><span><font face="Helvetica, Arial" size="2" class=""><br class=""></font></span></div>
<div class=""><span><font face="Helvetica, Arial" size="2" class="">- Have you though of supporting other item
types? </font></span></div>
<div class=""><span><font face="Helvetica, Arial" size="2" class="">  </font><span class="" style="font-family: Menlo; font-size: 11px;">NSEdgeInsets
(</span>CGEdgeInsets for iOS?) macosx 10.10,  iPhone
8.0 </span></div>
<div class="">  non-retaining Objective-C objects.</div>
<div class="">  Any C pointers</div>
<div class=""><br class=""></div>
<div class=""> One code comment: getNSValueFactoryMethod
has two default arguments but do not have non-default value.</div>
<div class=""> </div>
<div class="">- Fariborz</div>
<div class=""><font face="Helvetica, Arial" size="2" class=""><br class=""></font></div>
<div class="">
<blockquote type="cite" class="">
<div class="">On Nov 16, 2014, at 10:15 AM, AlexDenisov
<<a href="mailto:1101.debian@gmail.com" class="">1101.debian@gmail.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div id="bloop_customfont" class="" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px;">
<div id="bloop_customfont" class="" style="margin: 0px;">Patch
extends boxing expressions to support NSValue.</div>
<div id="bloop_customfont" class="" style="margin: 0px;"><br class=""></div>
<div id="bloop_customfont" class="" style="margin: 0px;">Some C
structures might be boxed into a NSValue, e.g.: NSPoint, CGPoint,
NSRect, etc.</div>
<div id="bloop_customfont" class="" style="margin: 0px;">This patch
extends boxing expressions to accept the structures, that could be
used to construct NSValue object:</div>
<div id="bloop_customfont" class="" style="margin: 0px;"><br class=""></div>
<div id="bloop_customfont" class="" style="margin: 0px;">NSPoint
p;</div>
<div id="bloop_customfont" class="" style="margin: 0px;">NSValue
*point = @(p);</div>
<div id="bloop_customfont" class="" style="margin: 0px;">CGRect
r;</div>
<div id="bloop_customfont" class="" style="margin: 0px;">NSValue
rect = @(r);</div>
<div id="bloop_customfont" class="" style="margin: 0px;"><br class=""></div>
<div id="bloop_customfont" class="" style="margin: 0px;">Full list
of supported structures:</div>
<div id="bloop_customfont" class="" style="margin: 0px;">NSPoint,
NSSize, NSRect, CGPoint, CGSize, CGRect, NSRange.</div>
</div>
<br class="" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">

<div id="bloop_sign_1416161623183923968" class="bloop_sign" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">
<div class="" style="font-family: helvetica, arial; font-size: 13px;">
-- <br class="">
AlexDenisov</div>
<div class="" style="font-family: helvetica, arial; font-size: 13px;">Software
Engineer, <a href="https://github.com/AlexDenisov" class="">https://github.com/AlexDenisov</a></div>
</div>
<span id="cid:D1043764-A448-4BA1-A4F6-1231A9C5186B@apple.com"><nsvalue_literals.diff></span><span class="" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">_______________________________________________</span><br class="" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">

<span class="" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">
cfe-commits mailing list</span><br class="" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">

<a href="mailto:cfe-commits@cs.uiuc.edu" class="" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">
cfe-commits@cs.uiuc.edu</a><br class="" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">

<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" class="" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a></div>
</blockquote>
</div>
</div>
</div>
</blockquote>
</div>
</blockquote>
</div>
<br></div>
</div>
</blockquote>


</div></div></span></blockquote></body></html>