Commit | Line | Data |
---|---|---|
de17c821 | 1 | /* Helper routines for C++ support in GDB. |
618f726f | 2 | Copyright (C) 2002-2016 Free Software Foundation, Inc. |
de17c821 DJ |
3 | |
4 | Contributed by MontaVista Software. | |
9219021c | 5 | Namespace support contributed by David Carlton. |
de17c821 DJ |
6 | |
7 | This file is part of GDB. | |
8 | ||
9 | This program is free software; you can redistribute it and/or modify | |
10 | it under the terms of the GNU General Public License as published by | |
a9762ec7 | 11 | the Free Software Foundation; either version 3 of the License, or |
de17c821 DJ |
12 | (at your option) any later version. |
13 | ||
14 | This program is distributed in the hope that it will be useful, | |
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | GNU General Public License for more details. | |
18 | ||
19 | You should have received a copy of the GNU General Public License | |
a9762ec7 | 20 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
de17c821 | 21 | |
9219021c DC |
22 | #ifndef CP_SUPPORT_H |
23 | #define CP_SUPPORT_H | |
24 | ||
1fcb5155 DC |
25 | /* We need this for 'domain_enum', alas... */ |
26 | ||
27 | #include "symtab.h" | |
32019081 | 28 | #include "vec.h" |
111dfaae | 29 | #include "gdb_vecs.h" |
3a93a0c2 | 30 | #include "gdb_obstack.h" |
32019081 | 31 | |
9219021c DC |
32 | /* Opaque declarations. */ |
33 | ||
b59661bd | 34 | struct symbol; |
9219021c | 35 | struct block; |
4a4b3fed | 36 | struct objfile; |
362ff856 | 37 | struct type; |
fb4c6eba | 38 | struct demangle_component; |
22cee43f | 39 | struct using_direct; |
9219021c | 40 | |
2b1dbab0 KS |
41 | /* A string representing the name of the anonymous namespace used in GDB. */ |
42 | ||
43 | #define CP_ANONYMOUS_NAMESPACE_STR "(anonymous namespace)" | |
44 | ||
45 | /* The length of the string representing the anonymous namespace. */ | |
46 | ||
47 | #define CP_ANONYMOUS_NAMESPACE_LEN 21 | |
48 | ||
3a93a0c2 KS |
49 | /* The result of parsing a name. */ |
50 | ||
51 | struct demangle_parse_info | |
52 | { | |
53 | /* The memory used during the parse. */ | |
54 | struct demangle_info *info; | |
55 | ||
56 | /* The result of the parse. */ | |
57 | struct demangle_component *tree; | |
58 | ||
59 | /* Any temporary memory used during typedef replacement. */ | |
60 | struct obstack obstack; | |
61 | }; | |
62 | ||
9219021c DC |
63 | |
64 | /* Functions from cp-support.c. */ | |
65 | ||
2f408ecb | 66 | extern std::string cp_canonicalize_string (const char *string); |
fb4c6eba | 67 | |
2f408ecb | 68 | extern std::string cp_canonicalize_string_no_typedefs (const char *string); |
3a93a0c2 | 69 | |
2621e0fd TT |
70 | typedef const char *(canonicalization_ftype) (struct type *, void *); |
71 | ||
2f408ecb PA |
72 | extern std::string cp_canonicalize_string_full (const char *string, |
73 | canonicalization_ftype *finder, | |
74 | void *data); | |
2621e0fd | 75 | |
31c27f77 | 76 | extern char *cp_class_name_from_physname (const char *physname); |
de17c821 DJ |
77 | |
78 | extern char *method_name_from_physname (const char *physname); | |
9219021c DC |
79 | |
80 | extern unsigned int cp_find_first_component (const char *name); | |
81 | ||
82 | extern unsigned int cp_entire_prefix_len (const char *name); | |
83 | ||
8d577d32 DC |
84 | extern char *cp_func_name (const char *full_name); |
85 | ||
3567439c DJ |
86 | extern char *cp_remove_params (const char *demangled_name); |
87 | ||
8d577d32 DC |
88 | extern struct symbol **make_symbol_overload_list (const char *, |
89 | const char *); | |
9219021c | 90 | |
7322dca9 SW |
91 | extern struct symbol **make_symbol_overload_list_adl (struct type **arg_types, |
92 | int nargs, | |
93 | const char *func_name); | |
94 | ||
362ff856 MC |
95 | extern struct type *cp_lookup_rtti_type (const char *name, |
96 | struct block *block); | |
97 | ||
9219021c DC |
98 | /* Functions/variables from cp-namespace.c. */ |
99 | ||
59da4d04 | 100 | extern int cp_is_in_anonymous (const char *symbol_name); |
9219021c | 101 | |
a10964d1 AR |
102 | extern void cp_scan_for_anonymous_namespaces (const struct symbol *symbol, |
103 | struct objfile *objfile); | |
9219021c | 104 | |
d12307c1 | 105 | extern struct block_symbol cp_lookup_symbol_nonlocal |
f606139a DE |
106 | (const struct language_defn *langdef, |
107 | const char *name, | |
108 | const struct block *block, | |
109 | const domain_enum domain); | |
1fcb5155 | 110 | |
d12307c1 PMR |
111 | extern struct block_symbol |
112 | cp_lookup_symbol_namespace (const char *the_namespace, | |
113 | const char *name, | |
114 | const struct block *block, | |
115 | const domain_enum domain); | |
13387711 | 116 | |
d12307c1 | 117 | extern struct block_symbol cp_lookup_symbol_imports_or_template |
34eaf542 TT |
118 | (const char *scope, |
119 | const char *name, | |
120 | const struct block *block, | |
121 | const domain_enum domain); | |
122 | ||
d12307c1 PMR |
123 | extern struct block_symbol |
124 | cp_lookup_nested_symbol (struct type *parent_type, | |
125 | const char *nested_name, | |
126 | const struct block *block, | |
127 | const domain_enum domain); | |
79c2c32d | 128 | |
b368761e DC |
129 | struct type *cp_lookup_transparent_type (const char *name); |
130 | ||
f7e3ecae KS |
131 | /* See description in cp-namespace.c. */ |
132 | ||
a07e3e18 DE |
133 | struct type *cp_find_type_baseclass_by_name (struct type *parent_type, |
134 | const char *name); | |
f7e3ecae | 135 | |
f88e9fd3 | 136 | /* Functions from cp-name-parser.y. */ |
fb4c6eba | 137 | |
3a93a0c2 KS |
138 | extern struct demangle_parse_info *cp_demangled_name_to_comp |
139 | (const char *demangled_name, const char **errmsg); | |
fb4c6eba DJ |
140 | |
141 | extern char *cp_comp_to_string (struct demangle_component *result, | |
142 | int estimated_len); | |
143 | ||
3a93a0c2 KS |
144 | extern void cp_demangled_name_parse_free (struct demangle_parse_info *); |
145 | extern struct cleanup *make_cleanup_cp_demangled_name_parse_free | |
146 | (struct demangle_parse_info *); | |
147 | extern void cp_merge_demangle_parse_infos (struct demangle_parse_info *, | |
148 | struct demangle_component *, | |
149 | struct demangle_parse_info *); | |
150 | ||
151 | extern struct demangle_parse_info *cp_new_demangle_parse_info (void); | |
152 | ||
5c4e30ca DC |
153 | /* The list of "maint cplus" commands. */ |
154 | ||
155 | extern struct cmd_list_element *maint_cplus_cmd_list; | |
156 | ||
8de20a37 TT |
157 | /* A wrapper for bfd_demangle. */ |
158 | ||
159 | char *gdb_demangle (const char *name, int options); | |
160 | ||
8b302db8 TT |
161 | /* Like gdb_demangle, but suitable for use as la_sniff_from_mangled_name. */ |
162 | ||
163 | int gdb_sniff_from_mangled_name (const char *mangled, char **demangled); | |
164 | ||
9219021c | 165 | #endif /* CP_SUPPORT_H */ |