Provide type_align gdbarch function for nios2.
[deliverable/binutils-gdb.git] / gdb / cp-support.h
... / ...
CommitLineData
1/* Helper routines for C++ support in GDB.
2 Copyright (C) 2002-2018 Free Software Foundation, Inc.
3
4 Contributed by MontaVista Software.
5 Namespace support contributed by David Carlton.
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
11 the Free Software Foundation; either version 3 of the License, or
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
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21
22#ifndef CP_SUPPORT_H
23#define CP_SUPPORT_H
24
25/* We need this for 'domain_enum', alas... */
26
27#include "symtab.h"
28#include "vec.h"
29#include "gdb_vecs.h"
30#include "gdb_obstack.h"
31
32/* Opaque declarations. */
33
34struct symbol;
35struct block;
36struct buildsym_compunit;
37struct objfile;
38struct type;
39struct demangle_component;
40struct using_direct;
41
42/* A string representing the name of the anonymous namespace used in GDB. */
43
44#define CP_ANONYMOUS_NAMESPACE_STR "(anonymous namespace)"
45
46/* The length of the string representing the anonymous namespace. */
47
48#define CP_ANONYMOUS_NAMESPACE_LEN 21
49
50/* A string representing the start of an operator name. */
51
52#define CP_OPERATOR_STR "operator"
53
54/* The length of CP_OPERATOR_STR. */
55
56#define CP_OPERATOR_LEN 8
57
58/* The result of parsing a name. */
59
60struct demangle_parse_info
61{
62 demangle_parse_info ();
63
64 ~demangle_parse_info ();
65
66 /* The memory used during the parse. */
67 struct demangle_info *info;
68
69 /* The result of the parse. */
70 struct demangle_component *tree;
71
72 /* Any temporary memory used during typedef replacement. */
73 struct obstack obstack;
74};
75
76
77/* Functions from cp-support.c. */
78
79extern std::string cp_canonicalize_string (const char *string);
80
81extern std::string cp_canonicalize_string_no_typedefs (const char *string);
82
83typedef const char *(canonicalization_ftype) (struct type *, void *);
84
85extern std::string cp_canonicalize_string_full (const char *string,
86 canonicalization_ftype *finder,
87 void *data);
88
89extern char *cp_class_name_from_physname (const char *physname);
90
91extern char *method_name_from_physname (const char *physname);
92
93extern unsigned int cp_find_first_component (const char *name);
94
95extern unsigned int cp_entire_prefix_len (const char *name);
96
97extern char *cp_func_name (const char *full_name);
98
99extern gdb::unique_xmalloc_ptr<char> cp_remove_params
100 (const char *demanged_name);
101
102/* DEMANGLED_NAME is the name of a function, (optionally) including
103 parameters and (optionally) a return type. Return the name of the
104 function without parameters or return type, or NULL if we can not
105 parse the name. If COMPLETION_MODE is true, then tolerate a
106 non-existing or unbalanced parameter list. */
107extern gdb::unique_xmalloc_ptr<char> cp_remove_params_if_any
108 (const char *demangled_name, bool completion_mode);
109
110extern struct symbol **make_symbol_overload_list (const char *,
111 const char *);
112
113extern struct symbol **make_symbol_overload_list_adl (struct type **arg_types,
114 int nargs,
115 const char *func_name);
116
117extern struct type *cp_lookup_rtti_type (const char *name,
118 struct block *block);
119
120/* Produce an unsigned hash value from SEARCH_NAME that is compatible
121 with cp_symbol_name_matches. Only the last component in
122 "foo::bar::function()" is considered for hashing purposes (i.e.,
123 the entire prefix is skipped), so that later on looking up for
124 "function" or "bar::function" in all namespaces is possible. */
125extern unsigned int cp_search_name_hash (const char *search_name);
126
127/* Implement the "la_get_symbol_name_matcher" language_defn method for
128 C++. */
129extern symbol_name_matcher_ftype *cp_get_symbol_name_matcher
130 (const lookup_name_info &lookup_name);
131
132/* Functions/variables from cp-namespace.c. */
133
134extern int cp_is_in_anonymous (const char *symbol_name);
135
136extern void cp_scan_for_anonymous_namespaces (struct buildsym_compunit *,
137 const struct symbol *symbol,
138 struct objfile *objfile);
139
140extern struct block_symbol cp_lookup_symbol_nonlocal
141 (const struct language_defn *langdef,
142 const char *name,
143 const struct block *block,
144 const domain_enum domain);
145
146extern struct block_symbol
147 cp_lookup_symbol_namespace (const char *the_namespace,
148 const char *name,
149 const struct block *block,
150 const domain_enum domain);
151
152extern struct block_symbol cp_lookup_symbol_imports_or_template
153 (const char *scope,
154 const char *name,
155 const struct block *block,
156 const domain_enum domain);
157
158extern struct block_symbol
159 cp_lookup_nested_symbol (struct type *parent_type,
160 const char *nested_name,
161 const struct block *block,
162 const domain_enum domain);
163
164struct type *cp_lookup_transparent_type (const char *name);
165
166/* See description in cp-namespace.c. */
167
168struct type *cp_find_type_baseclass_by_name (struct type *parent_type,
169 const char *name);
170
171/* Functions from cp-name-parser.y. */
172
173extern std::unique_ptr<demangle_parse_info> cp_demangled_name_to_comp
174 (const char *demangled_name, std::string *errmsg);
175
176extern gdb::unique_xmalloc_ptr<char> cp_comp_to_string
177 (struct demangle_component *result, int estimated_len);
178
179extern void cp_merge_demangle_parse_infos (struct demangle_parse_info *,
180 struct demangle_component *,
181 struct demangle_parse_info *);
182
183/* The list of "maint cplus" commands. */
184
185extern struct cmd_list_element *maint_cplus_cmd_list;
186
187/* A wrapper for bfd_demangle. */
188
189char *gdb_demangle (const char *name, int options);
190
191/* Like gdb_demangle, but suitable for use as la_sniff_from_mangled_name. */
192
193int gdb_sniff_from_mangled_name (const char *mangled, char **demangled);
194
195#endif /* CP_SUPPORT_H */
This page took 0.03647 seconds and 4 git commands to generate.