<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Dec 8, 2010, at 1:47 PM, Douglas Gregor wrote:</div><blockquote type="cite"><div>On Dec 8, 2010, at 11:53 AM, Eric Niebler <<a href="mailto:eric@boostpro.com">eric@boostpro.com</a>> wrote:<font class="Apple-style-span" color="#006312"><br></font><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">3) Where should the rewrite happen? Is it OK to leave in<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">references to the pseudo-field in the AST, or should the AST<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">reflect what will actually be executed -- invocations of the<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">getters and setters? My instinct tells me that the AST should have<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">the pseudo-field, not the getters and setters. Anything else might <br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">confuse things like IDEs.<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">The AST should have the pseudo-field (possibly with a special <br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">"MSPropertyRefExpr" expression type to reference them), and we<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">should introduce implicit AST nodes (e.g., an ImplicitCastExpr<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">wrapping a call) to handle the get and put calls. <br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I'm afraid I didn't follow that.<br></blockquote><br>Somehow, you need to represent an expression<br><br>  foo.property<br><br>That probably means creating a new expression node type. This expression node type may be used in an assignment (calling the put operation) or via an lvalue-to-rvalue conversion (calling the get operation), which will be represented via implicitly-generated AST nodes.</div></blockquote><div><br></div>I'm a little worried about adopting our current representation for a C++-oriented feature.  Presumably we'd need to allow filling in default arguments, etc., plus a wide range of stuff that we technically have to support with ObjC++ properties but actually haven't gotten around to yet, like what happens when we're doing a compound assignment on an implicit property reference and the getter and setter have really different types.  Really I think this is an argument for improving the representation of all property expressions.</div><div><br></div><div>My intuition here is to just rename OK_ObjCProperty to OK_Property instead of differentiating the two cases.  It can mean "this is an entity which can be both read and written to, but requires special code to do so".  The existing hook in Sema for loads (ConvertPropertyForRValue) can easily be modified to handle the MS properties, and we can make BuildBinOp check for OK_Property LHS's and just immediately defer to some better hook.</div><div><br></div><div>John.</div></body></html>