1a1ba9ba4Schristos /* Defs for interface to demanglers.
2*184b2d41Schristos    Copyright (C) 1992-2020 Free Software Foundation, Inc.
3a1ba9ba4Schristos 
4a1ba9ba4Schristos    This program is free software; you can redistribute it and/or
5a1ba9ba4Schristos    modify it under the terms of the GNU Library General Public License
6a1ba9ba4Schristos    as published by the Free Software Foundation; either version 2, or
7a1ba9ba4Schristos    (at your option) any later version.
8a1ba9ba4Schristos 
9a1ba9ba4Schristos    In addition to the permissions in the GNU Library General Public
10a1ba9ba4Schristos    License, the Free Software Foundation gives you unlimited
11a1ba9ba4Schristos    permission to link the compiled version of this file into
12a1ba9ba4Schristos    combinations with other programs, and to distribute those
13a1ba9ba4Schristos    combinations without any restriction coming from the use of this
14a1ba9ba4Schristos    file.  (The Library Public License restrictions do apply in other
15a1ba9ba4Schristos    respects; for example, they cover modification of the file, and
16a1ba9ba4Schristos    distribution when not linked into a combined executable.)
17a1ba9ba4Schristos 
18a1ba9ba4Schristos    This program is distributed in the hope that it will be useful, but
19a1ba9ba4Schristos    WITHOUT ANY WARRANTY; without even the implied warranty of
20a1ba9ba4Schristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21a1ba9ba4Schristos    Library General Public License for more details.
22a1ba9ba4Schristos 
23a1ba9ba4Schristos    You should have received a copy of the GNU Library General Public
24a1ba9ba4Schristos    License along with this program; if not, write to the Free Software
25a1ba9ba4Schristos    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
26a1ba9ba4Schristos    02110-1301, USA.  */
27a1ba9ba4Schristos 
28a1ba9ba4Schristos 
29a1ba9ba4Schristos #if !defined (DEMANGLE_H)
30a1ba9ba4Schristos #define DEMANGLE_H
31a1ba9ba4Schristos 
32a1ba9ba4Schristos #include "libiberty.h"
33a1ba9ba4Schristos 
34a1ba9ba4Schristos #ifdef __cplusplus
35a1ba9ba4Schristos extern "C" {
36a1ba9ba4Schristos #endif /* __cplusplus */
37a1ba9ba4Schristos 
38a1ba9ba4Schristos /* Options passed to cplus_demangle (in 2nd parameter). */
39a1ba9ba4Schristos 
40a1ba9ba4Schristos #define DMGL_NO_OPTS	 0		/* For readability... */
41a1ba9ba4Schristos #define DMGL_PARAMS	 (1 << 0)	/* Include function args */
42a1ba9ba4Schristos #define DMGL_ANSI	 (1 << 1)	/* Include const, volatile, etc */
43a1ba9ba4Schristos #define DMGL_JAVA	 (1 << 2)	/* Demangle as Java rather than C++. */
44a1ba9ba4Schristos #define DMGL_VERBOSE	 (1 << 3)	/* Include implementation details.  */
45a1ba9ba4Schristos #define DMGL_TYPES	 (1 << 4)	/* Also try to demangle type encodings.  */
46a1ba9ba4Schristos #define DMGL_RET_POSTFIX (1 << 5)       /* Print function return types (when
47a1ba9ba4Schristos 					   present) after function signature.
48a1ba9ba4Schristos 					   It applies only to the toplevel
49a1ba9ba4Schristos 					   function type.  */
50a1ba9ba4Schristos #define DMGL_RET_DROP	 (1 << 6)       /* Suppress printing function return
51a1ba9ba4Schristos 					   types, even if present.  It applies
52a1ba9ba4Schristos 					   only to the toplevel function type.
53a1ba9ba4Schristos 					   */
54a1ba9ba4Schristos 
55a1ba9ba4Schristos #define DMGL_AUTO	 (1 << 8)
56a1ba9ba4Schristos #define DMGL_GNU_V3	 (1 << 14)
57a1ba9ba4Schristos #define DMGL_GNAT	 (1 << 15)
58a1ba9ba4Schristos #define DMGL_DLANG	 (1 << 16)
5915d8e94aSchristos #define DMGL_RUST	 (1 << 17)	/* Rust wraps GNU_V3 style mangling.  */
60a1ba9ba4Schristos 
61a1ba9ba4Schristos /* If none of these are set, use 'current_demangling_style' as the default. */
62dc268d07Schristos #define DMGL_STYLE_MASK (DMGL_AUTO|DMGL_GNU_V3|DMGL_JAVA|DMGL_GNAT|DMGL_DLANG|DMGL_RUST)
63dc268d07Schristos 
64dc268d07Schristos /* Disable a limit on the depth of recursion in mangled strings.
65dc268d07Schristos    Note if this limit is disabled then stack exhaustion is possible when
66dc268d07Schristos    demangling pathologically complicated strings.  Bug reports about stack
67dc268d07Schristos    exhaustion when the option is enabled will be rejected.  */
68dc268d07Schristos #define DMGL_NO_RECURSE_LIMIT (1 << 18)
69dc268d07Schristos 
70dc268d07Schristos /* If DMGL_NO_RECURSE_LIMIT is not enabled, then this is the value used as
71dc268d07Schristos    the maximum depth of recursion allowed.  It should be enough for any
72dc268d07Schristos    real-world mangled name.  */
73dc268d07Schristos #define DEMANGLE_RECURSION_LIMIT 2048
74a1ba9ba4Schristos 
75a1ba9ba4Schristos /* Enumeration of possible demangling styles.
76a1ba9ba4Schristos 
77a1ba9ba4Schristos    Lucid and ARM styles are still kept logically distinct, even though
78a1ba9ba4Schristos    they now both behave identically.  The resulting style is actual the
79a1ba9ba4Schristos    union of both.  I.E. either style recognizes both "__pt__" and "__rf__"
80a1ba9ba4Schristos    for operator "->", even though the first is lucid style and the second
81a1ba9ba4Schristos    is ARM style. (FIXME?) */
82a1ba9ba4Schristos 
83a1ba9ba4Schristos extern enum demangling_styles
84a1ba9ba4Schristos {
85a1ba9ba4Schristos   no_demangling = -1,
86a1ba9ba4Schristos   unknown_demangling = 0,
87a1ba9ba4Schristos   auto_demangling = DMGL_AUTO,
88a1ba9ba4Schristos   gnu_v3_demangling = DMGL_GNU_V3,
89a1ba9ba4Schristos   java_demangling = DMGL_JAVA,
90a1ba9ba4Schristos   gnat_demangling = DMGL_GNAT,
9115d8e94aSchristos   dlang_demangling = DMGL_DLANG,
9215d8e94aSchristos   rust_demangling = DMGL_RUST
93a1ba9ba4Schristos } current_demangling_style;
94a1ba9ba4Schristos 
95a1ba9ba4Schristos /* Define string names for the various demangling styles. */
96a1ba9ba4Schristos 
97a1ba9ba4Schristos #define NO_DEMANGLING_STYLE_STRING            "none"
98a1ba9ba4Schristos #define AUTO_DEMANGLING_STYLE_STRING	      "auto"
99a1ba9ba4Schristos #define GNU_V3_DEMANGLING_STYLE_STRING        "gnu-v3"
100a1ba9ba4Schristos #define JAVA_DEMANGLING_STYLE_STRING          "java"
101a1ba9ba4Schristos #define GNAT_DEMANGLING_STYLE_STRING          "gnat"
102a1ba9ba4Schristos #define DLANG_DEMANGLING_STYLE_STRING         "dlang"
10315d8e94aSchristos #define RUST_DEMANGLING_STYLE_STRING          "rust"
104a1ba9ba4Schristos 
105a1ba9ba4Schristos /* Some macros to test what demangling style is active. */
106a1ba9ba4Schristos 
107a1ba9ba4Schristos #define CURRENT_DEMANGLING_STYLE current_demangling_style
108a1ba9ba4Schristos #define AUTO_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_AUTO)
109a1ba9ba4Schristos #define GNU_V3_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNU_V3)
110a1ba9ba4Schristos #define JAVA_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_JAVA)
111a1ba9ba4Schristos #define GNAT_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNAT)
112a1ba9ba4Schristos #define DLANG_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_DLANG)
11315d8e94aSchristos #define RUST_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_RUST)
114a1ba9ba4Schristos 
115a1ba9ba4Schristos /* Provide information about the available demangle styles. This code is
116a1ba9ba4Schristos    pulled from gdb into libiberty because it is useful to binutils also.  */
117a1ba9ba4Schristos 
118a1ba9ba4Schristos extern const struct demangler_engine
119a1ba9ba4Schristos {
120a1ba9ba4Schristos   const char *const demangling_style_name;
121a1ba9ba4Schristos   const enum demangling_styles demangling_style;
122a1ba9ba4Schristos   const char *const demangling_style_doc;
123a1ba9ba4Schristos } libiberty_demanglers[];
124a1ba9ba4Schristos 
125a1ba9ba4Schristos extern char *
126a1ba9ba4Schristos cplus_demangle (const char *mangled, int options);
127a1ba9ba4Schristos 
128a1ba9ba4Schristos /* Note: This sets global state.  FIXME if you care about multi-threading. */
129a1ba9ba4Schristos 
130a1ba9ba4Schristos extern enum demangling_styles
131a1ba9ba4Schristos cplus_demangle_set_style (enum demangling_styles style);
132a1ba9ba4Schristos 
133a1ba9ba4Schristos extern enum demangling_styles
134a1ba9ba4Schristos cplus_demangle_name_to_style (const char *name);
135a1ba9ba4Schristos 
136a1ba9ba4Schristos /* Callback typedef for allocation-less demangler interfaces. */
137a1ba9ba4Schristos typedef void (*demangle_callbackref) (const char *, size_t, void *);
138a1ba9ba4Schristos 
139a1ba9ba4Schristos /* V3 ABI demangling entry points, defined in cp-demangle.c.  Callback
140a1ba9ba4Schristos    variants return non-zero on success, zero on error.  char* variants
141a1ba9ba4Schristos    return a string allocated by malloc on success, NULL on error.  */
142a1ba9ba4Schristos extern int
143a1ba9ba4Schristos cplus_demangle_v3_callback (const char *mangled, int options,
144a1ba9ba4Schristos                             demangle_callbackref callback, void *opaque);
145a1ba9ba4Schristos 
146a1ba9ba4Schristos extern char*
147a1ba9ba4Schristos cplus_demangle_v3 (const char *mangled, int options);
148a1ba9ba4Schristos 
149a1ba9ba4Schristos extern int
150a1ba9ba4Schristos java_demangle_v3_callback (const char *mangled,
151a1ba9ba4Schristos                            demangle_callbackref callback, void *opaque);
152a1ba9ba4Schristos 
153a1ba9ba4Schristos extern char*
154a1ba9ba4Schristos java_demangle_v3 (const char *mangled);
155a1ba9ba4Schristos 
156a1ba9ba4Schristos char *
157a1ba9ba4Schristos ada_demangle (const char *mangled, int options);
158a1ba9ba4Schristos 
159a1ba9ba4Schristos extern char *
160a1ba9ba4Schristos dlang_demangle (const char *mangled, int options);
161a1ba9ba4Schristos 
16215d8e94aSchristos extern int
163*184b2d41Schristos rust_demangle_callback (const char *mangled, int options,
164*184b2d41Schristos                         demangle_callbackref callback, void *opaque);
16515d8e94aSchristos 
16615d8e94aSchristos 
16715d8e94aSchristos extern char *
16815d8e94aSchristos rust_demangle (const char *mangled, int options);
16915d8e94aSchristos 
170a1ba9ba4Schristos enum gnu_v3_ctor_kinds {
171a1ba9ba4Schristos   gnu_v3_complete_object_ctor = 1,
172a1ba9ba4Schristos   gnu_v3_base_object_ctor,
173a1ba9ba4Schristos   gnu_v3_complete_object_allocating_ctor,
174a1ba9ba4Schristos   /* These are not part of the V3 ABI.  Unified constructors are generated
175a1ba9ba4Schristos      as a speed-for-space optimization when the -fdeclone-ctor-dtor option
176a1ba9ba4Schristos      is used, and are always internal symbols.  */
177a1ba9ba4Schristos   gnu_v3_unified_ctor,
178a1ba9ba4Schristos   gnu_v3_object_ctor_group
179a1ba9ba4Schristos };
180a1ba9ba4Schristos 
181a1ba9ba4Schristos /* Return non-zero iff NAME is the mangled form of a constructor name
182a1ba9ba4Schristos    in the G++ V3 ABI demangling style.  Specifically, return an `enum
183a1ba9ba4Schristos    gnu_v3_ctor_kinds' value indicating what kind of constructor
184a1ba9ba4Schristos    it is.  */
185a1ba9ba4Schristos extern enum gnu_v3_ctor_kinds
186a1ba9ba4Schristos 	is_gnu_v3_mangled_ctor (const char *name);
187a1ba9ba4Schristos 
188a1ba9ba4Schristos 
189a1ba9ba4Schristos enum gnu_v3_dtor_kinds {
190a1ba9ba4Schristos   gnu_v3_deleting_dtor = 1,
191a1ba9ba4Schristos   gnu_v3_complete_object_dtor,
192a1ba9ba4Schristos   gnu_v3_base_object_dtor,
193a1ba9ba4Schristos   /* These are not part of the V3 ABI.  Unified destructors are generated
194a1ba9ba4Schristos      as a speed-for-space optimization when the -fdeclone-ctor-dtor option
195a1ba9ba4Schristos      is used, and are always internal symbols.  */
196a1ba9ba4Schristos   gnu_v3_unified_dtor,
197a1ba9ba4Schristos   gnu_v3_object_dtor_group
198a1ba9ba4Schristos };
199a1ba9ba4Schristos 
200a1ba9ba4Schristos /* Return non-zero iff NAME is the mangled form of a destructor name
201a1ba9ba4Schristos    in the G++ V3 ABI demangling style.  Specifically, return an `enum
202a1ba9ba4Schristos    gnu_v3_dtor_kinds' value, indicating what kind of destructor
203a1ba9ba4Schristos    it is.  */
204a1ba9ba4Schristos extern enum gnu_v3_dtor_kinds
205a1ba9ba4Schristos 	is_gnu_v3_mangled_dtor (const char *name);
206a1ba9ba4Schristos 
207a1ba9ba4Schristos /* The V3 demangler works in two passes.  The first pass builds a tree
208a1ba9ba4Schristos    representation of the mangled name, and the second pass turns the
209a1ba9ba4Schristos    tree representation into a demangled string.  Here we define an
210a1ba9ba4Schristos    interface to permit a caller to build their own tree
211a1ba9ba4Schristos    representation, which they can pass to the demangler to get a
212a1ba9ba4Schristos    demangled string.  This can be used to canonicalize user input into
213a1ba9ba4Schristos    something which the demangler might output.  It could also be used
214a1ba9ba4Schristos    by other demanglers in the future.  */
215a1ba9ba4Schristos 
216a1ba9ba4Schristos /* These are the component types which may be found in the tree.  Many
217a1ba9ba4Schristos    component types have one or two subtrees, referred to as left and
218a1ba9ba4Schristos    right (a component type with only one subtree puts it in the left
219a1ba9ba4Schristos    subtree).  */
220a1ba9ba4Schristos 
221a1ba9ba4Schristos enum demangle_component_type
222a1ba9ba4Schristos {
223a1ba9ba4Schristos   /* A name, with a length and a pointer to a string.  */
224a1ba9ba4Schristos   DEMANGLE_COMPONENT_NAME,
225a1ba9ba4Schristos   /* A qualified name.  The left subtree is a class or namespace or
226a1ba9ba4Schristos      some such thing, and the right subtree is a name qualified by
227a1ba9ba4Schristos      that class.  */
228a1ba9ba4Schristos   DEMANGLE_COMPONENT_QUAL_NAME,
229a1ba9ba4Schristos   /* A local name.  The left subtree describes a function, and the
230a1ba9ba4Schristos      right subtree is a name which is local to that function.  */
231a1ba9ba4Schristos   DEMANGLE_COMPONENT_LOCAL_NAME,
232a1ba9ba4Schristos   /* A typed name.  The left subtree is a name, and the right subtree
233a1ba9ba4Schristos      describes that name as a function.  */
234a1ba9ba4Schristos   DEMANGLE_COMPONENT_TYPED_NAME,
235a1ba9ba4Schristos   /* A template.  The left subtree is a template name, and the right
236a1ba9ba4Schristos      subtree is a template argument list.  */
237a1ba9ba4Schristos   DEMANGLE_COMPONENT_TEMPLATE,
238a1ba9ba4Schristos   /* A template parameter.  This holds a number, which is the template
239a1ba9ba4Schristos      parameter index.  */
240a1ba9ba4Schristos   DEMANGLE_COMPONENT_TEMPLATE_PARAM,
241a1ba9ba4Schristos   /* A function parameter.  This holds a number, which is the index.  */
242a1ba9ba4Schristos   DEMANGLE_COMPONENT_FUNCTION_PARAM,
243a1ba9ba4Schristos   /* A constructor.  This holds a name and the kind of
244a1ba9ba4Schristos      constructor.  */
245a1ba9ba4Schristos   DEMANGLE_COMPONENT_CTOR,
246a1ba9ba4Schristos   /* A destructor.  This holds a name and the kind of destructor.  */
247a1ba9ba4Schristos   DEMANGLE_COMPONENT_DTOR,
248a1ba9ba4Schristos   /* A vtable.  This has one subtree, the type for which this is a
249a1ba9ba4Schristos      vtable.  */
250a1ba9ba4Schristos   DEMANGLE_COMPONENT_VTABLE,
251a1ba9ba4Schristos   /* A VTT structure.  This has one subtree, the type for which this
252a1ba9ba4Schristos      is a VTT.  */
253a1ba9ba4Schristos   DEMANGLE_COMPONENT_VTT,
254a1ba9ba4Schristos   /* A construction vtable.  The left subtree is the type for which
255a1ba9ba4Schristos      this is a vtable, and the right subtree is the derived type for
256a1ba9ba4Schristos      which this vtable is built.  */
257a1ba9ba4Schristos   DEMANGLE_COMPONENT_CONSTRUCTION_VTABLE,
258a1ba9ba4Schristos   /* A typeinfo structure.  This has one subtree, the type for which
259a1ba9ba4Schristos      this is the tpeinfo structure.  */
260a1ba9ba4Schristos   DEMANGLE_COMPONENT_TYPEINFO,
261a1ba9ba4Schristos   /* A typeinfo name.  This has one subtree, the type for which this
262a1ba9ba4Schristos      is the typeinfo name.  */
263a1ba9ba4Schristos   DEMANGLE_COMPONENT_TYPEINFO_NAME,
264a1ba9ba4Schristos   /* A typeinfo function.  This has one subtree, the type for which
265a1ba9ba4Schristos      this is the tpyeinfo function.  */
266a1ba9ba4Schristos   DEMANGLE_COMPONENT_TYPEINFO_FN,
267a1ba9ba4Schristos   /* A thunk.  This has one subtree, the name for which this is a
268a1ba9ba4Schristos      thunk.  */
269a1ba9ba4Schristos   DEMANGLE_COMPONENT_THUNK,
270a1ba9ba4Schristos   /* A virtual thunk.  This has one subtree, the name for which this
271a1ba9ba4Schristos      is a virtual thunk.  */
272a1ba9ba4Schristos   DEMANGLE_COMPONENT_VIRTUAL_THUNK,
273a1ba9ba4Schristos   /* A covariant thunk.  This has one subtree, the name for which this
274a1ba9ba4Schristos      is a covariant thunk.  */
275a1ba9ba4Schristos   DEMANGLE_COMPONENT_COVARIANT_THUNK,
276a1ba9ba4Schristos   /* A Java class.  This has one subtree, the type.  */
277a1ba9ba4Schristos   DEMANGLE_COMPONENT_JAVA_CLASS,
278a1ba9ba4Schristos   /* A guard variable.  This has one subtree, the name for which this
279a1ba9ba4Schristos      is a guard variable.  */
280a1ba9ba4Schristos   DEMANGLE_COMPONENT_GUARD,
281a1ba9ba4Schristos   /* The init and wrapper functions for C++11 thread_local variables.  */
282a1ba9ba4Schristos   DEMANGLE_COMPONENT_TLS_INIT,
283a1ba9ba4Schristos   DEMANGLE_COMPONENT_TLS_WRAPPER,
284a1ba9ba4Schristos   /* A reference temporary.  This has one subtree, the name for which
285a1ba9ba4Schristos      this is a temporary.  */
286a1ba9ba4Schristos   DEMANGLE_COMPONENT_REFTEMP,
287a1ba9ba4Schristos   /* A hidden alias.  This has one subtree, the encoding for which it
288a1ba9ba4Schristos      is providing alternative linkage.  */
289a1ba9ba4Schristos   DEMANGLE_COMPONENT_HIDDEN_ALIAS,
290a1ba9ba4Schristos   /* A standard substitution.  This holds the name of the
291a1ba9ba4Schristos      substitution.  */
292a1ba9ba4Schristos   DEMANGLE_COMPONENT_SUB_STD,
293a1ba9ba4Schristos   /* The restrict qualifier.  The one subtree is the type which is
294a1ba9ba4Schristos      being qualified.  */
295a1ba9ba4Schristos   DEMANGLE_COMPONENT_RESTRICT,
296a1ba9ba4Schristos   /* The volatile qualifier.  The one subtree is the type which is
297a1ba9ba4Schristos      being qualified.  */
298a1ba9ba4Schristos   DEMANGLE_COMPONENT_VOLATILE,
299a1ba9ba4Schristos   /* The const qualifier.  The one subtree is the type which is being
300a1ba9ba4Schristos      qualified.  */
301a1ba9ba4Schristos   DEMANGLE_COMPONENT_CONST,
302a1ba9ba4Schristos   /* The restrict qualifier modifying a member function.  The one
303a1ba9ba4Schristos      subtree is the type which is being qualified.  */
304a1ba9ba4Schristos   DEMANGLE_COMPONENT_RESTRICT_THIS,
305a1ba9ba4Schristos   /* The volatile qualifier modifying a member function.  The one
306a1ba9ba4Schristos      subtree is the type which is being qualified.  */
307a1ba9ba4Schristos   DEMANGLE_COMPONENT_VOLATILE_THIS,
308a1ba9ba4Schristos   /* The const qualifier modifying a member function.  The one subtree
309a1ba9ba4Schristos      is the type which is being qualified.  */
310a1ba9ba4Schristos   DEMANGLE_COMPONENT_CONST_THIS,
311a1ba9ba4Schristos   /* C++11 A reference modifying a member function.  The one subtree is the
312a1ba9ba4Schristos      type which is being referenced.  */
313a1ba9ba4Schristos   DEMANGLE_COMPONENT_REFERENCE_THIS,
314a1ba9ba4Schristos   /* C++11: An rvalue reference modifying a member function.  The one
315a1ba9ba4Schristos      subtree is the type which is being referenced.  */
316a1ba9ba4Schristos   DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS,
317a1ba9ba4Schristos   /* A vendor qualifier.  The left subtree is the type which is being
318a1ba9ba4Schristos      qualified, and the right subtree is the name of the
319a1ba9ba4Schristos      qualifier.  */
320a1ba9ba4Schristos   DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL,
321a1ba9ba4Schristos   /* A pointer.  The one subtree is the type which is being pointed
322a1ba9ba4Schristos      to.  */
323a1ba9ba4Schristos   DEMANGLE_COMPONENT_POINTER,
324a1ba9ba4Schristos   /* A reference.  The one subtree is the type which is being
325a1ba9ba4Schristos      referenced.  */
326a1ba9ba4Schristos   DEMANGLE_COMPONENT_REFERENCE,
327a1ba9ba4Schristos   /* C++0x: An rvalue reference.  The one subtree is the type which is
328a1ba9ba4Schristos      being referenced.  */
329a1ba9ba4Schristos   DEMANGLE_COMPONENT_RVALUE_REFERENCE,
330a1ba9ba4Schristos   /* A complex type.  The one subtree is the base type.  */
331a1ba9ba4Schristos   DEMANGLE_COMPONENT_COMPLEX,
332a1ba9ba4Schristos   /* An imaginary type.  The one subtree is the base type.  */
333a1ba9ba4Schristos   DEMANGLE_COMPONENT_IMAGINARY,
334a1ba9ba4Schristos   /* A builtin type.  This holds the builtin type information.  */
335a1ba9ba4Schristos   DEMANGLE_COMPONENT_BUILTIN_TYPE,
336a1ba9ba4Schristos   /* A vendor's builtin type.  This holds the name of the type.  */
337a1ba9ba4Schristos   DEMANGLE_COMPONENT_VENDOR_TYPE,
338a1ba9ba4Schristos   /* A function type.  The left subtree is the return type.  The right
339a1ba9ba4Schristos      subtree is a list of ARGLIST nodes.  Either or both may be
340a1ba9ba4Schristos      NULL.  */
341a1ba9ba4Schristos   DEMANGLE_COMPONENT_FUNCTION_TYPE,
342a1ba9ba4Schristos   /* An array type.  The left subtree is the dimension, which may be
343a1ba9ba4Schristos      NULL, or a string (represented as DEMANGLE_COMPONENT_NAME), or an
344a1ba9ba4Schristos      expression.  The right subtree is the element type.  */
345a1ba9ba4Schristos   DEMANGLE_COMPONENT_ARRAY_TYPE,
346a1ba9ba4Schristos   /* A pointer to member type.  The left subtree is the class type,
347a1ba9ba4Schristos      and the right subtree is the member type.  CV-qualifiers appear
348a1ba9ba4Schristos      on the latter.  */
349a1ba9ba4Schristos   DEMANGLE_COMPONENT_PTRMEM_TYPE,
350a1ba9ba4Schristos   /* A fixed-point type.  */
351a1ba9ba4Schristos   DEMANGLE_COMPONENT_FIXED_TYPE,
352a1ba9ba4Schristos   /* A vector type.  The left subtree is the number of elements,
353a1ba9ba4Schristos      the right subtree is the element type.  */
354a1ba9ba4Schristos   DEMANGLE_COMPONENT_VECTOR_TYPE,
355a1ba9ba4Schristos   /* An argument list.  The left subtree is the current argument, and
356a1ba9ba4Schristos      the right subtree is either NULL or another ARGLIST node.  */
357a1ba9ba4Schristos   DEMANGLE_COMPONENT_ARGLIST,
358a1ba9ba4Schristos   /* A template argument list.  The left subtree is the current
359a1ba9ba4Schristos      template argument, and the right subtree is either NULL or
360a1ba9ba4Schristos      another TEMPLATE_ARGLIST node.  */
361a1ba9ba4Schristos   DEMANGLE_COMPONENT_TEMPLATE_ARGLIST,
362dc268d07Schristos   /* A template parameter object (C++20).  The left subtree is the
363dc268d07Schristos      corresponding template argument.  */
364dc268d07Schristos   DEMANGLE_COMPONENT_TPARM_OBJ,
365a1ba9ba4Schristos   /* An initializer list.  The left subtree is either an explicit type or
366a1ba9ba4Schristos      NULL, and the right subtree is a DEMANGLE_COMPONENT_ARGLIST.  */
367a1ba9ba4Schristos   DEMANGLE_COMPONENT_INITIALIZER_LIST,
368a1ba9ba4Schristos   /* An operator.  This holds information about a standard
369a1ba9ba4Schristos      operator.  */
370a1ba9ba4Schristos   DEMANGLE_COMPONENT_OPERATOR,
371a1ba9ba4Schristos   /* An extended operator.  This holds the number of arguments, and
372a1ba9ba4Schristos      the name of the extended operator.  */
373a1ba9ba4Schristos   DEMANGLE_COMPONENT_EXTENDED_OPERATOR,
374a1ba9ba4Schristos   /* A typecast, represented as a unary operator.  The one subtree is
375a1ba9ba4Schristos      the type to which the argument should be cast.  */
376a1ba9ba4Schristos   DEMANGLE_COMPONENT_CAST,
377a1ba9ba4Schristos   /* A conversion operator, represented as a unary operator.  The one
378a1ba9ba4Schristos      subtree is the type to which the argument should be converted
379a1ba9ba4Schristos      to.  */
380a1ba9ba4Schristos   DEMANGLE_COMPONENT_CONVERSION,
381a1ba9ba4Schristos   /* A nullary expression.  The left subtree is the operator.  */
382a1ba9ba4Schristos   DEMANGLE_COMPONENT_NULLARY,
383a1ba9ba4Schristos   /* A unary expression.  The left subtree is the operator, and the
384a1ba9ba4Schristos      right subtree is the single argument.  */
385a1ba9ba4Schristos   DEMANGLE_COMPONENT_UNARY,
386a1ba9ba4Schristos   /* A binary expression.  The left subtree is the operator, and the
387a1ba9ba4Schristos      right subtree is a BINARY_ARGS.  */
388a1ba9ba4Schristos   DEMANGLE_COMPONENT_BINARY,
389a1ba9ba4Schristos   /* Arguments to a binary expression.  The left subtree is the first
390a1ba9ba4Schristos      argument, and the right subtree is the second argument.  */
391a1ba9ba4Schristos   DEMANGLE_COMPONENT_BINARY_ARGS,
392a1ba9ba4Schristos   /* A trinary expression.  The left subtree is the operator, and the
393a1ba9ba4Schristos      right subtree is a TRINARY_ARG1.  */
394a1ba9ba4Schristos   DEMANGLE_COMPONENT_TRINARY,
395a1ba9ba4Schristos   /* Arguments to a trinary expression.  The left subtree is the first
396a1ba9ba4Schristos      argument, and the right subtree is a TRINARY_ARG2.  */
397a1ba9ba4Schristos   DEMANGLE_COMPONENT_TRINARY_ARG1,
398a1ba9ba4Schristos   /* More arguments to a trinary expression.  The left subtree is the
399a1ba9ba4Schristos      second argument, and the right subtree is the third argument.  */
400a1ba9ba4Schristos   DEMANGLE_COMPONENT_TRINARY_ARG2,
401a1ba9ba4Schristos   /* A literal.  The left subtree is the type, and the right subtree
402a1ba9ba4Schristos      is the value, represented as a DEMANGLE_COMPONENT_NAME.  */
403a1ba9ba4Schristos   DEMANGLE_COMPONENT_LITERAL,
404a1ba9ba4Schristos   /* A negative literal.  Like LITERAL, but the value is negated.
405a1ba9ba4Schristos      This is a minor hack: the NAME used for LITERAL points directly
406a1ba9ba4Schristos      to the mangled string, but since negative numbers are mangled
407a1ba9ba4Schristos      using 'n' instead of '-', we want a way to indicate a negative
408a1ba9ba4Schristos      number which involves neither modifying the mangled string nor
409a1ba9ba4Schristos      allocating a new copy of the literal in memory.  */
410a1ba9ba4Schristos   DEMANGLE_COMPONENT_LITERAL_NEG,
411a1ba9ba4Schristos   /* A libgcj compiled resource.  The left subtree is the name of the
412a1ba9ba4Schristos      resource.  */
413a1ba9ba4Schristos   DEMANGLE_COMPONENT_JAVA_RESOURCE,
414a1ba9ba4Schristos   /* A name formed by the concatenation of two parts.  The left
415a1ba9ba4Schristos      subtree is the first part and the right subtree the second.  */
416a1ba9ba4Schristos   DEMANGLE_COMPONENT_COMPOUND_NAME,
417a1ba9ba4Schristos   /* A name formed by a single character.  */
418a1ba9ba4Schristos   DEMANGLE_COMPONENT_CHARACTER,
419a1ba9ba4Schristos   /* A number.  */
420a1ba9ba4Schristos   DEMANGLE_COMPONENT_NUMBER,
421a1ba9ba4Schristos   /* A decltype type.  */
422a1ba9ba4Schristos   DEMANGLE_COMPONENT_DECLTYPE,
423a1ba9ba4Schristos   /* Global constructors keyed to name.  */
424a1ba9ba4Schristos   DEMANGLE_COMPONENT_GLOBAL_CONSTRUCTORS,
425a1ba9ba4Schristos   /* Global destructors keyed to name.  */
426a1ba9ba4Schristos   DEMANGLE_COMPONENT_GLOBAL_DESTRUCTORS,
427a1ba9ba4Schristos   /* A lambda closure type.  */
428a1ba9ba4Schristos   DEMANGLE_COMPONENT_LAMBDA,
429a1ba9ba4Schristos   /* A default argument scope.  */
430a1ba9ba4Schristos   DEMANGLE_COMPONENT_DEFAULT_ARG,
431a1ba9ba4Schristos   /* An unnamed type.  */
432a1ba9ba4Schristos   DEMANGLE_COMPONENT_UNNAMED_TYPE,
433a1ba9ba4Schristos   /* A transactional clone.  This has one subtree, the encoding for
434a1ba9ba4Schristos      which it is providing alternative linkage.  */
435a1ba9ba4Schristos   DEMANGLE_COMPONENT_TRANSACTION_CLONE,
436a1ba9ba4Schristos   /* A non-transactional clone entry point.  In the i386/x86_64 abi,
437a1ba9ba4Schristos      the unmangled symbol of a tm_callable becomes a thunk and the
438a1ba9ba4Schristos      non-transactional function version is mangled thus.  */
439a1ba9ba4Schristos   DEMANGLE_COMPONENT_NONTRANSACTION_CLONE,
440a1ba9ba4Schristos   /* A pack expansion.  */
441a1ba9ba4Schristos   DEMANGLE_COMPONENT_PACK_EXPANSION,
442a1ba9ba4Schristos   /* A name with an ABI tag.  */
443a1ba9ba4Schristos   DEMANGLE_COMPONENT_TAGGED_NAME,
444a1ba9ba4Schristos   /* A transaction-safe function type.  */
445a1ba9ba4Schristos   DEMANGLE_COMPONENT_TRANSACTION_SAFE,
446a1ba9ba4Schristos   /* A cloned function.  */
44715d8e94aSchristos   DEMANGLE_COMPONENT_CLONE,
44815d8e94aSchristos   DEMANGLE_COMPONENT_NOEXCEPT,
44915d8e94aSchristos   DEMANGLE_COMPONENT_THROW_SPEC
450a1ba9ba4Schristos };
451a1ba9ba4Schristos 
452a1ba9ba4Schristos /* Types which are only used internally.  */
453a1ba9ba4Schristos 
454a1ba9ba4Schristos struct demangle_operator_info;
455a1ba9ba4Schristos struct demangle_builtin_type_info;
456a1ba9ba4Schristos 
457a1ba9ba4Schristos /* A node in the tree representation is an instance of a struct
458a1ba9ba4Schristos    demangle_component.  Note that the field names of the struct are
459a1ba9ba4Schristos    not well protected against macros defined by the file including
460a1ba9ba4Schristos    this one.  We can fix this if it ever becomes a problem.  */
461a1ba9ba4Schristos 
462a1ba9ba4Schristos struct demangle_component
463a1ba9ba4Schristos {
464a1ba9ba4Schristos   /* The type of this component.  */
465a1ba9ba4Schristos   enum demangle_component_type type;
466a1ba9ba4Schristos 
46715d8e94aSchristos   /* Guard against recursive component printing.
46815d8e94aSchristos      Initialize to zero.  Private to d_print_comp.
46915d8e94aSchristos      All other fields are final after initialization.  */
47015d8e94aSchristos   int d_printing;
471*184b2d41Schristos   int d_counting;
47215d8e94aSchristos 
473a1ba9ba4Schristos   union
474a1ba9ba4Schristos   {
475a1ba9ba4Schristos     /* For DEMANGLE_COMPONENT_NAME.  */
476a1ba9ba4Schristos     struct
477a1ba9ba4Schristos     {
478a1ba9ba4Schristos       /* A pointer to the name (which need not NULL terminated) and
479a1ba9ba4Schristos 	 its length.  */
480a1ba9ba4Schristos       const char *s;
481a1ba9ba4Schristos       int len;
482a1ba9ba4Schristos     } s_name;
483a1ba9ba4Schristos 
484a1ba9ba4Schristos     /* For DEMANGLE_COMPONENT_OPERATOR.  */
485a1ba9ba4Schristos     struct
486a1ba9ba4Schristos     {
487a1ba9ba4Schristos       /* Operator.  */
488a1ba9ba4Schristos       const struct demangle_operator_info *op;
489a1ba9ba4Schristos     } s_operator;
490a1ba9ba4Schristos 
491a1ba9ba4Schristos     /* For DEMANGLE_COMPONENT_EXTENDED_OPERATOR.  */
492a1ba9ba4Schristos     struct
493a1ba9ba4Schristos     {
494a1ba9ba4Schristos       /* Number of arguments.  */
495a1ba9ba4Schristos       int args;
496a1ba9ba4Schristos       /* Name.  */
497a1ba9ba4Schristos       struct demangle_component *name;
498a1ba9ba4Schristos     } s_extended_operator;
499a1ba9ba4Schristos 
500a1ba9ba4Schristos     /* For DEMANGLE_COMPONENT_FIXED_TYPE.  */
501a1ba9ba4Schristos     struct
502a1ba9ba4Schristos     {
503a1ba9ba4Schristos       /* The length, indicated by a C integer type name.  */
504a1ba9ba4Schristos       struct demangle_component *length;
505a1ba9ba4Schristos       /* _Accum or _Fract?  */
506a1ba9ba4Schristos       short accum;
507a1ba9ba4Schristos       /* Saturating or not?  */
508a1ba9ba4Schristos       short sat;
509a1ba9ba4Schristos     } s_fixed;
510a1ba9ba4Schristos 
511a1ba9ba4Schristos     /* For DEMANGLE_COMPONENT_CTOR.  */
512a1ba9ba4Schristos     struct
513a1ba9ba4Schristos     {
514a1ba9ba4Schristos       /* Kind of constructor.  */
515a1ba9ba4Schristos       enum gnu_v3_ctor_kinds kind;
516a1ba9ba4Schristos       /* Name.  */
517a1ba9ba4Schristos       struct demangle_component *name;
518a1ba9ba4Schristos     } s_ctor;
519a1ba9ba4Schristos 
520a1ba9ba4Schristos     /* For DEMANGLE_COMPONENT_DTOR.  */
521a1ba9ba4Schristos     struct
522a1ba9ba4Schristos     {
523a1ba9ba4Schristos       /* Kind of destructor.  */
524a1ba9ba4Schristos       enum gnu_v3_dtor_kinds kind;
525a1ba9ba4Schristos       /* Name.  */
526a1ba9ba4Schristos       struct demangle_component *name;
527a1ba9ba4Schristos     } s_dtor;
528a1ba9ba4Schristos 
529a1ba9ba4Schristos     /* For DEMANGLE_COMPONENT_BUILTIN_TYPE.  */
530a1ba9ba4Schristos     struct
531a1ba9ba4Schristos     {
532a1ba9ba4Schristos       /* Builtin type.  */
533a1ba9ba4Schristos       const struct demangle_builtin_type_info *type;
534a1ba9ba4Schristos     } s_builtin;
535a1ba9ba4Schristos 
536a1ba9ba4Schristos     /* For DEMANGLE_COMPONENT_SUB_STD.  */
537a1ba9ba4Schristos     struct
538a1ba9ba4Schristos     {
539a1ba9ba4Schristos       /* Standard substitution string.  */
540a1ba9ba4Schristos       const char* string;
541a1ba9ba4Schristos       /* Length of string.  */
542a1ba9ba4Schristos       int len;
543a1ba9ba4Schristos     } s_string;
544a1ba9ba4Schristos 
545a1ba9ba4Schristos     /* For DEMANGLE_COMPONENT_*_PARAM.  */
546a1ba9ba4Schristos     struct
547a1ba9ba4Schristos     {
548a1ba9ba4Schristos       /* Parameter index.  */
549a1ba9ba4Schristos       long number;
550a1ba9ba4Schristos     } s_number;
551a1ba9ba4Schristos 
552a1ba9ba4Schristos     /* For DEMANGLE_COMPONENT_CHARACTER.  */
553a1ba9ba4Schristos     struct
554a1ba9ba4Schristos     {
555a1ba9ba4Schristos       int character;
556a1ba9ba4Schristos     } s_character;
557a1ba9ba4Schristos 
558a1ba9ba4Schristos     /* For other types.  */
559a1ba9ba4Schristos     struct
560a1ba9ba4Schristos     {
561a1ba9ba4Schristos       /* Left (or only) subtree.  */
562a1ba9ba4Schristos       struct demangle_component *left;
563a1ba9ba4Schristos       /* Right subtree.  */
564a1ba9ba4Schristos       struct demangle_component *right;
565a1ba9ba4Schristos     } s_binary;
566a1ba9ba4Schristos 
567a1ba9ba4Schristos     struct
568a1ba9ba4Schristos     {
569a1ba9ba4Schristos       /* subtree, same place as d_left.  */
570a1ba9ba4Schristos       struct demangle_component *sub;
571a1ba9ba4Schristos       /* integer.  */
572a1ba9ba4Schristos       int num;
573a1ba9ba4Schristos     } s_unary_num;
574a1ba9ba4Schristos 
575a1ba9ba4Schristos   } u;
576a1ba9ba4Schristos };
577a1ba9ba4Schristos 
578a1ba9ba4Schristos /* People building mangled trees are expected to allocate instances of
579a1ba9ba4Schristos    struct demangle_component themselves.  They can then call one of
580a1ba9ba4Schristos    the following functions to fill them in.  */
581a1ba9ba4Schristos 
582a1ba9ba4Schristos /* Fill in most component types with a left subtree and a right
583a1ba9ba4Schristos    subtree.  Returns non-zero on success, zero on failure, such as an
584a1ba9ba4Schristos    unrecognized or inappropriate component type.  */
585a1ba9ba4Schristos 
586a1ba9ba4Schristos extern int
587a1ba9ba4Schristos cplus_demangle_fill_component (struct demangle_component *fill,
588a1ba9ba4Schristos                                enum demangle_component_type,
589a1ba9ba4Schristos                                struct demangle_component *left,
590a1ba9ba4Schristos                                struct demangle_component *right);
591a1ba9ba4Schristos 
592a1ba9ba4Schristos /* Fill in a DEMANGLE_COMPONENT_NAME.  Returns non-zero on success,
593a1ba9ba4Schristos    zero for bad arguments.  */
594a1ba9ba4Schristos 
595a1ba9ba4Schristos extern int
596a1ba9ba4Schristos cplus_demangle_fill_name (struct demangle_component *fill,
597a1ba9ba4Schristos                           const char *, int);
598a1ba9ba4Schristos 
599a1ba9ba4Schristos /* Fill in a DEMANGLE_COMPONENT_BUILTIN_TYPE, using the name of the
600a1ba9ba4Schristos    builtin type (e.g., "int", etc.).  Returns non-zero on success,
601a1ba9ba4Schristos    zero if the type is not recognized.  */
602a1ba9ba4Schristos 
603a1ba9ba4Schristos extern int
604a1ba9ba4Schristos cplus_demangle_fill_builtin_type (struct demangle_component *fill,
605a1ba9ba4Schristos                                   const char *type_name);
606a1ba9ba4Schristos 
607a1ba9ba4Schristos /* Fill in a DEMANGLE_COMPONENT_OPERATOR, using the name of the
608a1ba9ba4Schristos    operator and the number of arguments which it takes (the latter is
609a1ba9ba4Schristos    used to disambiguate operators which can be both binary and unary,
610a1ba9ba4Schristos    such as '-').  Returns non-zero on success, zero if the operator is
611a1ba9ba4Schristos    not recognized.  */
612a1ba9ba4Schristos 
613a1ba9ba4Schristos extern int
614a1ba9ba4Schristos cplus_demangle_fill_operator (struct demangle_component *fill,
615a1ba9ba4Schristos                               const char *opname, int args);
616a1ba9ba4Schristos 
617a1ba9ba4Schristos /* Fill in a DEMANGLE_COMPONENT_EXTENDED_OPERATOR, providing the
618a1ba9ba4Schristos    number of arguments and the name.  Returns non-zero on success,
619a1ba9ba4Schristos    zero for bad arguments.  */
620a1ba9ba4Schristos 
621a1ba9ba4Schristos extern int
622a1ba9ba4Schristos cplus_demangle_fill_extended_operator (struct demangle_component *fill,
623a1ba9ba4Schristos                                        int numargs,
624a1ba9ba4Schristos                                        struct demangle_component *nm);
625a1ba9ba4Schristos 
626a1ba9ba4Schristos /* Fill in a DEMANGLE_COMPONENT_CTOR.  Returns non-zero on success,
627a1ba9ba4Schristos    zero for bad arguments.  */
628a1ba9ba4Schristos 
629a1ba9ba4Schristos extern int
630a1ba9ba4Schristos cplus_demangle_fill_ctor (struct demangle_component *fill,
631a1ba9ba4Schristos                           enum gnu_v3_ctor_kinds kind,
632a1ba9ba4Schristos                           struct demangle_component *name);
633a1ba9ba4Schristos 
634a1ba9ba4Schristos /* Fill in a DEMANGLE_COMPONENT_DTOR.  Returns non-zero on success,
635a1ba9ba4Schristos    zero for bad arguments.  */
636a1ba9ba4Schristos 
637a1ba9ba4Schristos extern int
638a1ba9ba4Schristos cplus_demangle_fill_dtor (struct demangle_component *fill,
639a1ba9ba4Schristos                           enum gnu_v3_dtor_kinds kind,
640a1ba9ba4Schristos                           struct demangle_component *name);
641a1ba9ba4Schristos 
642a1ba9ba4Schristos /* This function translates a mangled name into a struct
643a1ba9ba4Schristos    demangle_component tree.  The first argument is the mangled name.
644a1ba9ba4Schristos    The second argument is DMGL_* options.  This returns a pointer to a
645a1ba9ba4Schristos    tree on success, or NULL on failure.  On success, the third
646a1ba9ba4Schristos    argument is set to a block of memory allocated by malloc.  This
647a1ba9ba4Schristos    block should be passed to free when the tree is no longer
648a1ba9ba4Schristos    needed.  */
649a1ba9ba4Schristos 
650a1ba9ba4Schristos extern struct demangle_component *
651a1ba9ba4Schristos cplus_demangle_v3_components (const char *mangled, int options, void **mem);
652a1ba9ba4Schristos 
653a1ba9ba4Schristos /* This function takes a struct demangle_component tree and returns
654a1ba9ba4Schristos    the corresponding demangled string.  The first argument is DMGL_*
655a1ba9ba4Schristos    options.  The second is the tree to demangle.  The third is a guess
656a1ba9ba4Schristos    at the length of the demangled string, used to initially allocate
657a1ba9ba4Schristos    the return buffer.  The fourth is a pointer to a size_t.  On
658a1ba9ba4Schristos    success, this function returns a buffer allocated by malloc(), and
659a1ba9ba4Schristos    sets the size_t pointed to by the fourth argument to the size of
660a1ba9ba4Schristos    the allocated buffer (not the length of the returned string).  On
661a1ba9ba4Schristos    failure, this function returns NULL, and sets the size_t pointed to
662a1ba9ba4Schristos    by the fourth argument to 0 for an invalid tree, or to 1 for a
663a1ba9ba4Schristos    memory allocation error.  */
664a1ba9ba4Schristos 
665a1ba9ba4Schristos extern char *
666a1ba9ba4Schristos cplus_demangle_print (int options,
66715d8e94aSchristos                       struct demangle_component *tree,
668a1ba9ba4Schristos                       int estimated_length,
669a1ba9ba4Schristos                       size_t *p_allocated_size);
670a1ba9ba4Schristos 
671a1ba9ba4Schristos /* This function takes a struct demangle_component tree and passes back
672a1ba9ba4Schristos    a demangled string in one or more calls to a callback function.
673a1ba9ba4Schristos    The first argument is DMGL_* options.  The second is the tree to
674a1ba9ba4Schristos    demangle.  The third is a pointer to a callback function; on each call
675a1ba9ba4Schristos    this receives an element of the demangled string, its length, and an
676a1ba9ba4Schristos    opaque value.  The fourth is the opaque value passed to the callback.
677a1ba9ba4Schristos    The callback is called once or more to return the full demangled
678a1ba9ba4Schristos    string.  The demangled element string is always nul-terminated, though
679a1ba9ba4Schristos    its length is also provided for convenience.  In contrast to
680a1ba9ba4Schristos    cplus_demangle_print(), this function does not allocate heap memory
681a1ba9ba4Schristos    to grow output strings (except perhaps where alloca() is implemented
682a1ba9ba4Schristos    by malloc()), and so is normally safe for use where the heap has been
683a1ba9ba4Schristos    corrupted.  On success, this function returns 1; on failure, 0.  */
684a1ba9ba4Schristos 
685a1ba9ba4Schristos extern int
686a1ba9ba4Schristos cplus_demangle_print_callback (int options,
68715d8e94aSchristos                                struct demangle_component *tree,
688a1ba9ba4Schristos                                demangle_callbackref callback, void *opaque);
689a1ba9ba4Schristos 
690a1ba9ba4Schristos #ifdef __cplusplus
691a1ba9ba4Schristos }
692a1ba9ba4Schristos #endif /* __cplusplus */
693a1ba9ba4Schristos 
694a1ba9ba4Schristos #endif	/* DEMANGLE_H */
695