]>
Commit | Line | Data |
---|---|---|
252b5132 | 1 | /* Defs for interface to demanglers. |
4f1d9bd8 NC |
2 | Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000 |
3 | Free Software Foundation, Inc. | |
252b5132 RH |
4 | |
5 | This program is free software; you can redistribute it and/or modify | |
6 | it under the terms of the GNU General Public License as published by | |
7 | the Free Software Foundation; either version 2, or (at your option) | |
8 | any later version. | |
9 | ||
10 | This program is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | GNU General Public License for more details. | |
14 | ||
15 | You should have received a copy of the GNU General Public License | |
16 | along with this program; if not, write to the Free Software | |
17 | Foundation, Inc., 59 Temple Place - Suite 330, | |
18 | Boston, MA 02111-1307, USA. */ | |
19 | ||
20 | ||
21 | #if !defined (DEMANGLE_H) | |
22 | #define DEMANGLE_H | |
23 | ||
24 | #include <ansidecl.h> | |
25 | ||
26 | /* Options passed to cplus_demangle (in 2nd parameter). */ | |
27 | ||
b8cdcddf L |
28 | #define DMGL_NO_OPTS 0 /* For readability... */ |
29 | #define DMGL_PARAMS (1 << 0) /* Include function args */ | |
30 | #define DMGL_ANSI (1 << 1) /* Include const, volatile, etc */ | |
31 | #define DMGL_JAVA (1 << 2) /* Demangle as Java rather than C++. */ | |
32 | ||
33 | #define DMGL_AUTO (1 << 8) | |
34 | #define DMGL_GNU (1 << 9) | |
35 | #define DMGL_LUCID (1 << 10) | |
36 | #define DMGL_ARM (1 << 11) | |
37 | #define DMGL_HP (1 << 12) /* For the HP aCC compiler; | |
38 | same as ARM except for | |
39 | template arguments, etc. */ | |
40 | #define DMGL_EDG (1 << 13) | |
f93eaf70 | 41 | #define DMGL_GNU_V3 (1 << 14) |
4cabd1d1 | 42 | #define DMGL_GNAT (1 << 15) |
252b5132 RH |
43 | |
44 | /* If none of these are set, use 'current_demangling_style' as the default. */ | |
f93eaf70 | 45 | #define DMGL_STYLE_MASK (DMGL_AUTO|DMGL_GNU|DMGL_LUCID|DMGL_ARM|DMGL_HP|DMGL_EDG|DMGL_GNU_V3|DMGL_JAVA|DMGL_GNAT) |
252b5132 RH |
46 | |
47 | /* Enumeration of possible demangling styles. | |
48 | ||
49 | Lucid and ARM styles are still kept logically distinct, even though | |
50 | they now both behave identically. The resulting style is actual the | |
51 | union of both. I.E. either style recognizes both "__pt__" and "__rf__" | |
52 | for operator "->", even though the first is lucid style and the second | |
53 | is ARM style. (FIXME?) */ | |
54 | ||
55 | extern enum demangling_styles | |
56 | { | |
57 | unknown_demangling = 0, | |
58 | auto_demangling = DMGL_AUTO, | |
59 | gnu_demangling = DMGL_GNU, | |
60 | lucid_demangling = DMGL_LUCID, | |
61 | arm_demangling = DMGL_ARM, | |
62 | hp_demangling = DMGL_HP, | |
b8cdcddf | 63 | edg_demangling = DMGL_EDG, |
f93eaf70 | 64 | gnu_v3_demangling = DMGL_GNU_V3, |
4cabd1d1 HPN |
65 | java_demangling = DMGL_JAVA, |
66 | gnat_demangling = DMGL_GNAT | |
252b5132 RH |
67 | } current_demangling_style; |
68 | ||
69 | /* Define string names for the various demangling styles. */ | |
70 | ||
b8cdcddf L |
71 | #define AUTO_DEMANGLING_STYLE_STRING "auto" |
72 | #define GNU_DEMANGLING_STYLE_STRING "gnu" | |
73 | #define LUCID_DEMANGLING_STYLE_STRING "lucid" | |
74 | #define ARM_DEMANGLING_STYLE_STRING "arm" | |
75 | #define HP_DEMANGLING_STYLE_STRING "hp" | |
76 | #define EDG_DEMANGLING_STYLE_STRING "edg" | |
f93eaf70 | 77 | #define GNU_V3_DEMANGLING_STYLE_STRING "gnu-v3" |
4cabd1d1 HPN |
78 | #define JAVA_DEMANGLING_STYLE_STRING "java" |
79 | #define GNAT_DEMANGLING_STYLE_STRING "gnat" | |
252b5132 RH |
80 | |
81 | /* Some macros to test what demangling style is active. */ | |
82 | ||
83 | #define CURRENT_DEMANGLING_STYLE current_demangling_style | |
84 | #define AUTO_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_AUTO) | |
85 | #define GNU_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNU) | |
86 | #define LUCID_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_LUCID) | |
87 | #define ARM_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_ARM) | |
88 | #define HP_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_HP) | |
89 | #define EDG_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_EDG) | |
f93eaf70 | 90 | #define GNU_V3_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNU_V3) |
4cabd1d1 HPN |
91 | #define JAVA_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_JAVA) |
92 | #define GNAT_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNAT) | |
b8cdcddf L |
93 | |
94 | /* Provide information about the available demangle styles. This code is | |
95 | pulled from gdb into libiberty because it is useful to binutils also. */ | |
96 | ||
97 | extern struct demangler_engine | |
98 | { | |
99 | const char *demangling_style_name; | |
100 | enum demangling_styles demangling_style; | |
101 | const char *demangling_style_doc; | |
102 | } libiberty_demanglers[]; | |
252b5132 RH |
103 | |
104 | extern char * | |
105 | cplus_demangle PARAMS ((const char *mangled, int options)); | |
106 | ||
107 | extern int | |
108 | cplus_demangle_opname PARAMS ((const char *opname, char *result, int options)); | |
109 | ||
110 | extern const char * | |
111 | cplus_mangle_opname PARAMS ((const char *opname, int options)); | |
112 | ||
113 | /* Note: This sets global state. FIXME if you care about multi-threading. */ | |
114 | ||
115 | extern void | |
116 | set_cplus_marker_for_demangling PARAMS ((int ch)); | |
117 | ||
b8cdcddf L |
118 | extern enum demangling_styles |
119 | cplus_demangle_set_style PARAMS ((enum demangling_styles style)); | |
120 | ||
121 | extern enum demangling_styles | |
122 | cplus_demangle_name_to_style PARAMS ((const char *name)); | |
123 | ||
bc9bf259 | 124 | /* V3 ABI demangling entry points, defined in cp-demangle.c. */ |
b8cdcddf | 125 | extern char* |
f93eaf70 | 126 | cplus_demangle_v3 PARAMS ((const char* mangled)); |
b8cdcddf | 127 | |
bc9bf259 DD |
128 | extern char* |
129 | java_demangle_v3 PARAMS ((const char* mangled)); | |
130 | ||
e61231f1 JB |
131 | |
132 | enum gnu_v3_ctor_kinds { | |
133 | gnu_v3_complete_object_ctor = 1, | |
134 | gnu_v3_base_object_ctor, | |
135 | gnu_v3_complete_object_allocating_ctor | |
136 | }; | |
137 | ||
138 | /* Return non-zero iff NAME is the mangled form of a constructor name | |
139 | in the G++ V3 ABI demangling style. Specifically, return an `enum | |
140 | gnu_v3_ctor_kinds' value indicating what kind of constructor | |
141 | it is. */ | |
457161bf DD |
142 | extern enum gnu_v3_ctor_kinds |
143 | is_gnu_v3_mangled_ctor PARAMS ((const char *name)); | |
e61231f1 JB |
144 | |
145 | ||
146 | enum gnu_v3_dtor_kinds { | |
147 | gnu_v3_deleting_dtor = 1, | |
148 | gnu_v3_complete_object_dtor, | |
149 | gnu_v3_base_object_dtor | |
150 | }; | |
151 | ||
152 | /* Return non-zero iff NAME is the mangled form of a destructor name | |
153 | in the G++ V3 ABI demangling style. Specifically, return an `enum | |
154 | gnu_v3_dtor_kinds' value, indicating what kind of destructor | |
155 | it is. */ | |
457161bf DD |
156 | extern enum gnu_v3_dtor_kinds |
157 | is_gnu_v3_mangled_dtor PARAMS ((const char *name)); | |
e61231f1 | 158 | |
252b5132 | 159 | #endif /* DEMANGLE_H */ |