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

David Blaikie dblaikie at gmail.com
Fri Oct 5 16:44:48 PDT 2012


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qualified_typo.diff
Type: application/octet-stream
Size: 10597 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20121005/f8708852/attachment.obj>


More information about the cfe-commits mailing list