Mercurial > hg > CbC > CbC_gcc
comparison include/demangle.h @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 84e7813d76e9 |
children |
comparison
equal
deleted
inserted
replaced
131:84e7813d76e9 | 145:1830386684a0 |
---|---|
1 /* Defs for interface to demanglers. | 1 /* Defs for interface to demanglers. |
2 Copyright (C) 1992-2018 Free Software Foundation, Inc. | 2 Copyright (C) 1992-2020 Free Software Foundation, Inc. |
3 | 3 |
4 This program is free software; you can redistribute it and/or | 4 This program is free software; you can redistribute it and/or |
5 modify it under the terms of the GNU Library General Public License | 5 modify it under the terms of the GNU Library General Public License |
6 as published by the Free Software Foundation; either version 2, or | 6 as published by the Free Software Foundation; either version 2, or |
7 (at your option) any later version. | 7 (at your option) any later version. |
51 types, even if present. It applies | 51 types, even if present. It applies |
52 only to the toplevel function type. | 52 only to the toplevel function type. |
53 */ | 53 */ |
54 | 54 |
55 #define DMGL_AUTO (1 << 8) | 55 #define DMGL_AUTO (1 << 8) |
56 #define DMGL_GNU (1 << 9) | |
57 #define DMGL_LUCID (1 << 10) | |
58 #define DMGL_ARM (1 << 11) | |
59 #define DMGL_HP (1 << 12) /* For the HP aCC compiler; | |
60 same as ARM except for | |
61 template arguments, etc. */ | |
62 #define DMGL_EDG (1 << 13) | |
63 #define DMGL_GNU_V3 (1 << 14) | 56 #define DMGL_GNU_V3 (1 << 14) |
64 #define DMGL_GNAT (1 << 15) | 57 #define DMGL_GNAT (1 << 15) |
65 #define DMGL_DLANG (1 << 16) | 58 #define DMGL_DLANG (1 << 16) |
66 #define DMGL_RUST (1 << 17) /* Rust wraps GNU_V3 style mangling. */ | 59 #define DMGL_RUST (1 << 17) /* Rust wraps GNU_V3 style mangling. */ |
67 | 60 |
68 /* If none of these are set, use 'current_demangling_style' as the default. */ | 61 /* If none of these are set, use 'current_demangling_style' as the default. */ |
69 #define DMGL_STYLE_MASK (DMGL_AUTO|DMGL_GNU|DMGL_LUCID|DMGL_ARM|DMGL_HP|DMGL_EDG|DMGL_GNU_V3|DMGL_JAVA|DMGL_GNAT|DMGL_DLANG|DMGL_RUST) | 62 #define DMGL_STYLE_MASK (DMGL_AUTO|DMGL_GNU_V3|DMGL_JAVA|DMGL_GNAT|DMGL_DLANG|DMGL_RUST) |
70 | 63 |
64 /* Disable a limit on the depth of recursion in mangled strings. | |
65 Note if this limit is disabled then stack exhaustion is possible when | |
66 demangling pathologically complicated strings. Bug reports about stack | |
67 exhaustion when the option is enabled will be rejected. */ | |
68 #define DMGL_NO_RECURSE_LIMIT (1 << 18) | |
69 | |
70 /* If DMGL_NO_RECURSE_LIMIT is not enabled, then this is the value used as | |
71 the maximum depth of recursion allowed. It should be enough for any | |
72 real-world mangled name. */ | |
73 #define DEMANGLE_RECURSION_LIMIT 2048 | |
74 | |
71 /* Enumeration of possible demangling styles. | 75 /* Enumeration of possible demangling styles. |
72 | 76 |
73 Lucid and ARM styles are still kept logically distinct, even though | 77 Lucid and ARM styles are still kept logically distinct, even though |
74 they now both behave identically. The resulting style is actual the | 78 they now both behave identically. The resulting style is actual the |
75 union of both. I.E. either style recognizes both "__pt__" and "__rf__" | 79 union of both. I.E. either style recognizes both "__pt__" and "__rf__" |
79 extern enum demangling_styles | 83 extern enum demangling_styles |
80 { | 84 { |
81 no_demangling = -1, | 85 no_demangling = -1, |
82 unknown_demangling = 0, | 86 unknown_demangling = 0, |
83 auto_demangling = DMGL_AUTO, | 87 auto_demangling = DMGL_AUTO, |
84 gnu_demangling = DMGL_GNU, | |
85 lucid_demangling = DMGL_LUCID, | |
86 arm_demangling = DMGL_ARM, | |
87 hp_demangling = DMGL_HP, | |
88 edg_demangling = DMGL_EDG, | |
89 gnu_v3_demangling = DMGL_GNU_V3, | 88 gnu_v3_demangling = DMGL_GNU_V3, |
90 java_demangling = DMGL_JAVA, | 89 java_demangling = DMGL_JAVA, |
91 gnat_demangling = DMGL_GNAT, | 90 gnat_demangling = DMGL_GNAT, |
92 dlang_demangling = DMGL_DLANG, | 91 dlang_demangling = DMGL_DLANG, |
93 rust_demangling = DMGL_RUST | 92 rust_demangling = DMGL_RUST |
95 | 94 |
96 /* Define string names for the various demangling styles. */ | 95 /* Define string names for the various demangling styles. */ |
97 | 96 |
98 #define NO_DEMANGLING_STYLE_STRING "none" | 97 #define NO_DEMANGLING_STYLE_STRING "none" |
99 #define AUTO_DEMANGLING_STYLE_STRING "auto" | 98 #define AUTO_DEMANGLING_STYLE_STRING "auto" |
100 #define GNU_DEMANGLING_STYLE_STRING "gnu" | |
101 #define LUCID_DEMANGLING_STYLE_STRING "lucid" | |
102 #define ARM_DEMANGLING_STYLE_STRING "arm" | |
103 #define HP_DEMANGLING_STYLE_STRING "hp" | |
104 #define EDG_DEMANGLING_STYLE_STRING "edg" | |
105 #define GNU_V3_DEMANGLING_STYLE_STRING "gnu-v3" | 99 #define GNU_V3_DEMANGLING_STYLE_STRING "gnu-v3" |
106 #define JAVA_DEMANGLING_STYLE_STRING "java" | 100 #define JAVA_DEMANGLING_STYLE_STRING "java" |
107 #define GNAT_DEMANGLING_STYLE_STRING "gnat" | 101 #define GNAT_DEMANGLING_STYLE_STRING "gnat" |
108 #define DLANG_DEMANGLING_STYLE_STRING "dlang" | 102 #define DLANG_DEMANGLING_STYLE_STRING "dlang" |
109 #define RUST_DEMANGLING_STYLE_STRING "rust" | 103 #define RUST_DEMANGLING_STYLE_STRING "rust" |
110 | 104 |
111 /* Some macros to test what demangling style is active. */ | 105 /* Some macros to test what demangling style is active. */ |
112 | 106 |
113 #define CURRENT_DEMANGLING_STYLE current_demangling_style | 107 #define CURRENT_DEMANGLING_STYLE current_demangling_style |
114 #define AUTO_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_AUTO) | 108 #define AUTO_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_AUTO) |
115 #define GNU_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNU) | |
116 #define LUCID_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_LUCID) | |
117 #define ARM_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_ARM) | |
118 #define HP_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_HP) | |
119 #define EDG_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_EDG) | |
120 #define GNU_V3_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNU_V3) | 109 #define GNU_V3_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNU_V3) |
121 #define JAVA_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_JAVA) | 110 #define JAVA_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_JAVA) |
122 #define GNAT_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNAT) | 111 #define GNAT_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNAT) |
123 #define DLANG_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_DLANG) | 112 #define DLANG_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_DLANG) |
124 #define RUST_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_RUST) | 113 #define RUST_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_RUST) |
134 } libiberty_demanglers[]; | 123 } libiberty_demanglers[]; |
135 | 124 |
136 extern char * | 125 extern char * |
137 cplus_demangle (const char *mangled, int options); | 126 cplus_demangle (const char *mangled, int options); |
138 | 127 |
139 extern int | |
140 cplus_demangle_opname (const char *opname, char *result, int options); | |
141 | |
142 extern const char * | |
143 cplus_mangle_opname (const char *opname, int options); | |
144 | |
145 /* Note: This sets global state. FIXME if you care about multi-threading. */ | 128 /* Note: This sets global state. FIXME if you care about multi-threading. */ |
146 | |
147 extern void | |
148 set_cplus_marker_for_demangling (int ch); | |
149 | 129 |
150 extern enum demangling_styles | 130 extern enum demangling_styles |
151 cplus_demangle_set_style (enum demangling_styles style); | 131 cplus_demangle_set_style (enum demangling_styles style); |
152 | 132 |
153 extern enum demangling_styles | 133 extern enum demangling_styles |
177 ada_demangle (const char *mangled, int options); | 157 ada_demangle (const char *mangled, int options); |
178 | 158 |
179 extern char * | 159 extern char * |
180 dlang_demangle (const char *mangled, int options); | 160 dlang_demangle (const char *mangled, int options); |
181 | 161 |
182 /* Returns non-zero iff MANGLED is a rust mangled symbol. MANGLED must | 162 extern int |
183 already have been demangled through cplus_demangle_v3. If this function | 163 rust_demangle_callback (const char *mangled, int options, |
184 returns non-zero then MANGLED can be demangled (in-place) using | 164 demangle_callbackref callback, void *opaque); |
185 RUST_DEMANGLE_SYM. */ | 165 |
186 extern int | 166 |
187 rust_is_mangled (const char *mangled); | |
188 | |
189 /* Demangles SYM (in-place) if RUST_IS_MANGLED returned non-zero for SYM. | |
190 If RUST_IS_MANGLED returned zero for SYM then RUST_DEMANGLE_SYM might | |
191 replace characters that cannot be demangled with '?' and might truncate | |
192 SYM. After calling RUST_DEMANGLE_SYM SYM might be shorter, but never | |
193 larger. */ | |
194 extern void | |
195 rust_demangle_sym (char *sym); | |
196 | |
197 /* Demangles MANGLED if it was GNU_V3 and then RUST mangled, otherwise | |
198 returns NULL. Uses CPLUS_DEMANGLE_V3, RUST_IS_MANGLED and | |
199 RUST_DEMANGLE_SYM. Returns a new string that is owned by the caller. */ | |
200 extern char * | 167 extern char * |
201 rust_demangle (const char *mangled, int options); | 168 rust_demangle (const char *mangled, int options); |
202 | 169 |
203 enum gnu_v3_ctor_kinds { | 170 enum gnu_v3_ctor_kinds { |
204 gnu_v3_complete_object_ctor = 1, | 171 gnu_v3_complete_object_ctor = 1, |
390 DEMANGLE_COMPONENT_ARGLIST, | 357 DEMANGLE_COMPONENT_ARGLIST, |
391 /* A template argument list. The left subtree is the current | 358 /* A template argument list. The left subtree is the current |
392 template argument, and the right subtree is either NULL or | 359 template argument, and the right subtree is either NULL or |
393 another TEMPLATE_ARGLIST node. */ | 360 another TEMPLATE_ARGLIST node. */ |
394 DEMANGLE_COMPONENT_TEMPLATE_ARGLIST, | 361 DEMANGLE_COMPONENT_TEMPLATE_ARGLIST, |
362 /* A template parameter object (C++20). The left subtree is the | |
363 corresponding template argument. */ | |
364 DEMANGLE_COMPONENT_TPARM_OBJ, | |
395 /* An initializer list. The left subtree is either an explicit type or | 365 /* An initializer list. The left subtree is either an explicit type or |
396 NULL, and the right subtree is a DEMANGLE_COMPONENT_ARGLIST. */ | 366 NULL, and the right subtree is a DEMANGLE_COMPONENT_ARGLIST. */ |
397 DEMANGLE_COMPONENT_INITIALIZER_LIST, | 367 DEMANGLE_COMPONENT_INITIALIZER_LIST, |
398 /* An operator. This holds information about a standard | 368 /* An operator. This holds information about a standard |
399 operator. */ | 369 operator. */ |
496 | 466 |
497 /* Guard against recursive component printing. | 467 /* Guard against recursive component printing. |
498 Initialize to zero. Private to d_print_comp. | 468 Initialize to zero. Private to d_print_comp. |
499 All other fields are final after initialization. */ | 469 All other fields are final after initialization. */ |
500 int d_printing; | 470 int d_printing; |
471 int d_counting; | |
501 | 472 |
502 union | 473 union |
503 { | 474 { |
504 /* For DEMANGLE_COMPONENT_NAME. */ | 475 /* For DEMANGLE_COMPONENT_NAME. */ |
505 struct | 476 struct |