[cfe-commits] [patch] fix qualified name typo correction

David Blaikie dblaikie at gmail.com
Mon Oct 8 14:19:00 PDT 2012

Added this to phabricator just for fun: http://llvm-reviews.chandlerc.com/D57

On Fri, Oct 5, 2012 at 4:44 PM, David Blaikie <dblaikie at gmail.com> wrote:
> When suggesting "foo::bar" as a correction for "fob::bar" we
> mistakenly replaced only "bar" with "foo::bar" producing
> "fob::foo::bar" which was broken.
> This corrects that replacement in as many places as I could find &
> provides test cases for all those cases I could find a test case for.
> There are a couple that don't seem to be reachable (one looks entirely
> dead, the other just doesn't seem to ever get called with a namespace
> to namespace change).
> If anyone knows of ways to test these cases I didn't git - or wants to
> kill them off, that'd be great.
> Also, I'm open to suggestions/ideas on where to store the SourceRange
> & how to propagate it. I realize the current implementation (of
> calling "setCorrectionRange" (& passing in a CXXScopeSpec and
> DeclarationNameInfo) is perhaps a bit rough - alternatives include
> passing the information down through more layers so that the
> TypoCorrections can be constructed with this information from the
> get-go, or wrapping "CorrectTypo" in an outer function that adds the
> source range so that if someone adds another non-empty return from
> CorrectTypo they don't accidentally fail to add the source range
> information))
> We could also use the correction range for /all/ correction
> replacements just for consistency, but for now I just focused on any
> correction fixit that included an CXXScopeSpec range in the
> diagnostic.
> Thanks,
> - David

More information about the cfe-commits mailing list