On Fri, Jul 25, 2014 at 2:39 PM, Kaelyn Takata <[email protected]> wrote:
> On Fri, Jul 25, 2014 at 2:01 PM, Richard Smith <[email protected]> > wrote: > >> + TypoCorrection &getNextCorrection(); >> + >> + /// \brief Get the last correction returned by getNextCorrection(). >> + TypoCorrection &getCurrentCorrection() { >> >> Since the TypoCorrections are now intended to be reused, it would seem >> wise to return them either by value or by const reference. >> > > 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). > 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. > On Mon, Jul 14, 2014 at 4:55 PM, Kaelyn Takata <[email protected]> wrote: >> >>> >>> Two additional methods are provided: one to return the current >>> correction (the last correction returned by getNextCorrection), and one >>> to "reset" the state so that getNextCorrection will return the previous >>> corrections before returning any new corrections. >>> >>> Also ensure that all TypoCorrections have valid source ranges. >>> --- >>> include/clang/Sema/SemaInternal.h | 31 ++++++++++++++++++++++++++----- >>> include/clang/Sema/TypoCorrection.h | 2 +- >>> lib/Sema/SemaLookup.cpp | 16 ++++++++++++---- >>> 3 files changed, 39 insertions(+), 10 deletions(-) >>> >>> >>> _______________________________________________ >>> cfe-commits mailing list >>> [email protected] >>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits >>> >>> >> >
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
