GCC Middle and Back End API Reference
spellcheck-tree.h File Reference
#include "spellcheck.h"
Include dependency graph for spellcheck-tree.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  edit_distance_traits< tree >
 

Functions

edit_distance_t get_edit_distance (tree ident_s, tree ident_t)
 
tree find_closest_identifier (tree target, const auto_vec< tree > *candidates)
 

Function Documentation

◆ find_closest_identifier()

tree find_closest_identifier ( tree target,
const auto_vec< tree > * candidates )
extern
Given TARGET, an identifier, and CANDIDATES, a vec of identifiers,
determine which element within CANDIDATES has the lowest edit
distance to TARGET.  If there are multiple elements with the
same minimal distance, the first in the vector wins.

If more than half of the letters were misspelled, the suggestion is
likely to be meaningless, so return NULL_TREE for this case.   

References candidates, best_match< GOAL_TYPE, CANDIDATE_TYPE >::consider(), FOR_EACH_VEC_ELT, gcc_assert, best_match< GOAL_TYPE, CANDIDATE_TYPE >::get_best_meaningful_candidate(), i, and TREE_CODE.

◆ get_edit_distance()

edit_distance_t get_edit_distance ( tree ident_s,
tree ident_t )
extern
Find near-matches for identifiers.
   Copyright (C) 2015-2024 Free Software Foundation, Inc.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3.  If not see
<http://www.gnu.org/licenses/>.   
spellcheck-tree.cc   
Find near-matches for identifiers.
   Copyright (C) 2015-2024 Free Software Foundation, Inc.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3.  If not see
<http://www.gnu.org/licenses/>.   
Calculate edit distance between two identifiers.   

References gcc_assert, get_edit_distance(), IDENTIFIER_LENGTH, IDENTIFIER_POINTER, and TREE_CODE.

Referenced by get_edit_distance().