spellcheck.h: add best_match template; implement early-reject
authorDavid Malcolm <dmalcolm@redhat.com>
Wed, 15 Jun 2016 03:29:39 +0000 (03:29 +0000)
committerDavid Malcolm <dmalcolm@gcc.gnu.org>
Wed, 15 Jun 2016 03:29:39 +0000 (03:29 +0000)
commit6a3f203c3cc8e0f0757f7ed038b3cb34063936ba
treee99b8b2be80b721ed128799b811f4eccae4a9f64
parent9e990b5d19d930bd1769d6db455fcbda8e7eae11
spellcheck.h: add best_match template; implement early-reject

gcc/c/ChangeLog:
* c-typeck.c: Include spellcheck-tree.h rather than spellcheck.h.

gcc/cp/ChangeLog:
* search.c: Include spellcheck-tree.h rather than spellcheck.h.

gcc/ChangeLog:
* spellcheck-tree.c: Include spellcheck-tree.h rather than
spellcheck.h.
(find_closest_identifier): Reimplement in terms of
best_match<tree,tree>.
* spellcheck-tree.h: New file.
* spellcheck.c (struct edit_distance_traits<const char *>): New
struct.
(find_closest_string): Reimplement in terms of
best_match<const char *, const char *>.
* spellcheck.h (levenshtein_distance): Move prototype of tree-based
overload to spellcheck-tree.h.
(find_closest_identifier): Likewise.
(struct edit_distance_traits<T>): New template.
(class best_match): New class.

From-SVN: r237471
gcc/ChangeLog
gcc/c/ChangeLog
gcc/c/c-typeck.c
gcc/cp/ChangeLog
gcc/cp/search.c
gcc/spellcheck-tree.c
gcc/spellcheck-tree.h [new file with mode: 0644]
gcc/spellcheck.c
gcc/spellcheck.h