<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>26 apr 2009 kl. 13.41 skrev Anders Carlsson:</div><blockquote type="cite"><div><font class="Apple-style-span" color="#000000"><br></font>Cool, I'll change that!<br><br><blockquote type="cite">So basically, we give Sema a SmallVector of temporaries that we've<br></blockquote><blockquote type="cite">created. All statement actions check this buffer, and if it's not <br></blockquote><blockquote type="cite">empty,<br></blockquote><blockquote type="cite">a CXXExprWithTemporaries is created and wrapped around the current<br></blockquote><blockquote type="cite">statement, and gets all the temporaries added. Then the buffer is <br></blockquote><blockquote type="cite">cleared.<br></blockquote><blockquote type="cite">Is this right?<br></blockquote><blockquote type="cite"><br></blockquote>We also need to come up with a solid design where it's next to <br>impossible to forget to<br>have this callback invoked, I'm toying with the idea of adding a new <br>FullExprArg type,<br>and where the only way to create a FullExprArg from an ExprArg is to <br>go through this callback.<br><br></div></blockquote></div><br><div>Here's what I've come up with. A FullExprArg right now is a very simple wrapper around ExprArg:</div><div><br></div><div><div> class FullExprArg {</div><div> ExprArg &Arg;</div><div> friend class Action;</div><div> FullExprArg(ExprArg& a) : Arg(a) {}</div><div> </div><div> public:</div><div> FullExprArg& operator=(void *raw) {</div><div> Arg.operator=(raw);</div><div> return *this;</div><div> }</div><div> </div><div> void* release() { return Arg.release(); }</div><div> void* get() { return Arg.get(); }</div><div> </div><div> template<typename T></div><div> T *takeAs() {</div><div> return static_cast<T*>(Arg.take());</div><div> }</div><div> </div><div> };</div><div><br></div><div>Its constructor is private, and the Action class is a friend, so the only way to make one is to call </div><div><br></div><div>FullExprArg Action::FullExpr(ExprArg&);</div><div><br></div><div>which will make sure to call ActOnFinishFullExpr.</div><div><br></div><div>I'm not entirely happy with this solution since it sidesteps all the move security we have in the smart pointer classes. Sebastian, do you have a better idea?</div><div><br></div><div>Anders</div><div><br></div></div></body></html>