]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/c-family/c-spellcheck.h
Move macro-spellchecking code from "gcc" to new files in c-family
[thirdparty/gcc.git] / gcc / c-family / c-spellcheck.h
CommitLineData
613bc14f
DM
1/* Find near-matches for macros.
2 Copyright (C) 2016-2017 Free Software Foundation, Inc.
3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify it under
7the terms of the GNU General Public License as published by the Free
8Software Foundation; either version 3, or (at your option) any later
9version.
10
11GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12WARRANTY; without even the implied warranty of MERCHANTABILITY or
13FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14for more details.
15
16You should have received a copy of the GNU General Public License
17along with GCC; see the file COPYING3. If not see
18<http://www.gnu.org/licenses/>. */
19
20#ifndef C_SPELLCHECK_H
21#define C_SPELLCHECK_H
22
23#include "spellcheck.h"
24
25/* Specialization of edit_distance_traits for preprocessor macros. */
26
27template <>
28struct edit_distance_traits<cpp_hashnode *>
29{
30 static size_t get_length (cpp_hashnode *hashnode)
31 {
32 return hashnode->ident.len;
33 }
34
35 static const char *get_string (cpp_hashnode *hashnode)
36 {
37 return (const char *)hashnode->ident.str;
38 }
39};
40
41/* Specialization of best_match<> for finding the closest preprocessor
42 macro to a given identifier. */
43
44class best_macro_match : public best_match<tree, cpp_hashnode *>
45{
46 public:
47 best_macro_match (tree goal, edit_distance_t best_distance_so_far,
48 cpp_reader *reader);
49};
50
51#endif /* C_SPELLCHECK_H */