<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Jul 25, 2014 at 2:39 PM, Kaelyn Takata <span dir="ltr"><<a href="mailto:rikka@google.com" target="_blank">rikka@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div class="">On Fri, Jul 25, 2014 at 2:01 PM, Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">+  TypoCorrection &getNextCorrection();<br>

<div class="gmail_extra"><div class="gmail_extra">+</div><div class="gmail_extra">+  /// \brief Get the last correction returned by getNextCorrection().</div><div class="gmail_extra">
+  TypoCorrection &getCurrentCorrection() {</div><div class="gmail_extra"></div></div><div class="gmail_extra"><br></div><div class="gmail_extra">Since the TypoCorrections are now intended to be reused, it would seem wise to return them either by value or by const reference.<br>

</div></div></blockquote><div><br></div></div><div>They originally were returned by value, but there is a case where the set of decls associated with the TypoCorrection needs to be modified for the proper diagnostics to be emitted: specifically by the overload resolution in the MemberExprTypoRecovery callback introduced in patch #9. Making the return value be a non-const reference had been a separate patch that I folded into the others to avoid unnecessary churn. I agree it would be nicer to return them by value or const reference, but doing so greatly complicates the recovery callback's ability to select the right method from a group of methods with the same name in a way that will be visible to TransformTypos::Transform when it comes time to emit diagnostics (particularly without introducing any additional AST<->Sema layering violations).</div>
</div></div></div></blockquote><div><br></div><div>OK. My main concern was that someone might be accidentally modifying a TypoCorrection and then disrupting other people who rewind the typo correction stream and look at the same typo again. Perhaps that's not a concern.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div>On Mon, Jul 14, 2014 at 4:55 PM, Kaelyn Takata <span dir="ltr"><<a href="mailto:rikka@google.com" target="_blank">rikka@google.com</a>></span> wrote:<br>

</div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div>
<br>
Two additional methods are provided: one to return the current<br>
correction (the last correction returned by getNextCorrection), and one<br>
to "reset" the state so that getNextCorrection will return the previous<br>
corrections before returning any new corrections.<br>
<br>
Also ensure that all TypoCorrections have valid source ranges.<br>
---<br>
 include/clang/Sema/SemaInternal.h   | 31 ++++++++++++++++++++++++++-----<br>
 include/clang/Sema/TypoCorrection.h |  2 +-<br>
 lib/Sema/SemaLookup.cpp             | 16 ++++++++++++----<br>
 3 files changed, 39 insertions(+), 10 deletions(-)<br>
<br>
<br></div></div>_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>

<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
<br></blockquote></div><br></div></div>
</blockquote></div></div><br></div></div>
</blockquote></div><br></div></div>