Commit | Line | Data |
---|---|---|
de17c821 | 1 | /* Helper routines for C++ support in GDB. |
61baf725 | 2 | Copyright (C) 2002-2017 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 | { | |
c8b23b3f TT |
53 | demangle_parse_info (); |
54 | ||
55 | ~demangle_parse_info (); | |
56 | ||
3a93a0c2 KS |
57 | /* The memory used during the parse. */ |
58 | struct demangle_info *info; | |
59 | ||
60 | /* The result of the parse. */ | |
61 | struct demangle_component *tree; | |
62 | ||
63 | /* Any temporary memory used during typedef replacement. */ | |
64 | struct obstack obstack; | |
65 | }; | |
66 | ||
9219021c DC |
67 | |
68 | /* Functions from cp-support.c. */ | |
69 | ||
2f408ecb | 70 | extern std::string cp_canonicalize_string (const char *string); |
fb4c6eba | 71 | |
2f408ecb | 72 | extern std::string cp_canonicalize_string_no_typedefs (const char *string); |
3a93a0c2 | 73 | |
2621e0fd TT |
74 | typedef const char *(canonicalization_ftype) (struct type *, void *); |
75 | ||
2f408ecb PA |
76 | extern std::string cp_canonicalize_string_full (const char *string, |
77 | canonicalization_ftype *finder, | |
78 | void *data); | |
2621e0fd | 79 | |
31c27f77 | 80 | extern char *cp_class_name_from_physname (const char *physname); |
de17c821 DJ |
81 | |
82 | extern char *method_name_from_physname (const char *physname); | |
9219021c DC |
83 | |
84 | extern unsigned int cp_find_first_component (const char *name); | |
85 | ||
86 | extern unsigned int cp_entire_prefix_len (const char *name); | |
87 | ||
8d577d32 DC |
88 | extern char *cp_func_name (const char *full_name); |
89 | ||
3567439c DJ |
90 | extern char *cp_remove_params (const char *demangled_name); |
91 | ||
8d577d32 DC |
92 | extern struct symbol **make_symbol_overload_list (const char *, |
93 | const char *); | |
9219021c | 94 | |
7322dca9 SW |
95 | extern struct symbol **make_symbol_overload_list_adl (struct type **arg_types, |
96 | int nargs, | |
97 | const char *func_name); | |
98 | ||
362ff856 MC |
99 | extern struct type *cp_lookup_rtti_type (const char *name, |
100 | struct block *block); | |
101 | ||
9219021c DC |
102 | /* Functions/variables from cp-namespace.c. */ |
103 | ||
59da4d04 | 104 | extern int cp_is_in_anonymous (const char *symbol_name); |
9219021c | 105 | |
a10964d1 AR |
106 | extern void cp_scan_for_anonymous_namespaces (const struct symbol *symbol, |
107 | struct objfile *objfile); | |
9219021c | 108 | |
d12307c1 | 109 | extern struct block_symbol cp_lookup_symbol_nonlocal |
f606139a DE |
110 | (const struct language_defn *langdef, |
111 | const char *name, | |
112 | const struct block *block, | |
113 | const domain_enum domain); | |
1fcb5155 | 114 | |
d12307c1 PMR |
115 | extern struct block_symbol |
116 | cp_lookup_symbol_namespace (const char *the_namespace, | |
117 | const char *name, | |
118 | const struct block *block, | |
119 | const domain_enum domain); | |
13387711 | 120 | |
d12307c1 | 121 | extern struct block_symbol cp_lookup_symbol_imports_or_template |
34eaf542 TT |
122 | (const char *scope, |
123 | const char *name, | |
124 | const struct block *block, | |
125 | const domain_enum domain); | |
126 | ||
d12307c1 PMR |
127 | extern struct block_symbol |
128 | cp_lookup_nested_symbol (struct type *parent_type, | |
129 | const char *nested_name, | |
130 | const struct block *block, | |
131 | const domain_enum domain); | |
79c2c32d | 132 | |
b368761e DC |
133 | struct type *cp_lookup_transparent_type (const char *name); |
134 | ||
f7e3ecae KS |
135 | /* See description in cp-namespace.c. */ |
136 | ||
a07e3e18 DE |
137 | struct type *cp_find_type_baseclass_by_name (struct type *parent_type, |
138 | const char *name); | |
f7e3ecae | 139 | |
f88e9fd3 | 140 | /* Functions from cp-name-parser.y. */ |
fb4c6eba | 141 | |
c8b23b3f | 142 | extern std::unique_ptr<demangle_parse_info> cp_demangled_name_to_comp |
3a93a0c2 | 143 | (const char *demangled_name, const char **errmsg); |
fb4c6eba DJ |
144 | |
145 | extern char *cp_comp_to_string (struct demangle_component *result, | |
146 | int estimated_len); | |
147 | ||
3a93a0c2 KS |
148 | extern void cp_merge_demangle_parse_infos (struct demangle_parse_info *, |
149 | struct demangle_component *, | |
150 | struct demangle_parse_info *); | |
151 | ||
5c4e30ca DC |
152 | /* The list of "maint cplus" commands. */ |
153 | ||
154 | extern struct cmd_list_element *maint_cplus_cmd_list; | |
155 | ||
8de20a37 TT |
156 | /* A wrapper for bfd_demangle. */ |
157 | ||
158 | char *gdb_demangle (const char *name, int options); | |
159 | ||
8b302db8 TT |
160 | /* Like gdb_demangle, but suitable for use as la_sniff_from_mangled_name. */ |
161 | ||
162 | int gdb_sniff_from_mangled_name (const char *mangled, char **demangled); | |
163 | ||
9219021c | 164 | #endif /* CP_SUPPORT_H */ |