| OLD | NEW |
| 1 /* YACC parser for C++ names, for GDB. | 1 /* YACC parser for C++ names, for GDB. |
| 2 | 2 |
| 3 Copyright (C) 2003-2005, 2007-2012 Free Software Foundation, Inc. | 3 Copyright (C) 2003-2005, 2007-2012 Free Software Foundation, Inc. |
| 4 | 4 |
| 5 Parts of the lexer are based on c-exp.y from GDB. | 5 Parts of the lexer are based on c-exp.y from GDB. |
| 6 | 6 |
| 7 This file is part of GDB. | 7 This file is part of GDB. |
| 8 | 8 |
| 9 This program is free software; you can redistribute it and/or modify | 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 | 10 it under the terms of the GNU General Public License as published by |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 #define yyrule cpname_rule /* With YYDEBUG defined */ | 163 #define yyrule cpname_rule /* With YYDEBUG defined */ |
| 164 #define yylhs cpname_yylhs | 164 #define yylhs cpname_yylhs |
| 165 #define yylen cpname_yylen | 165 #define yylen cpname_yylen |
| 166 #define yydefred cpname_yydefred | 166 #define yydefred cpname_yydefred |
| 167 #define yydgoto cpname_yydgoto | 167 #define yydgoto cpname_yydgoto |
| 168 #define yysindex cpname_yysindex | 168 #define yysindex cpname_yysindex |
| 169 #define yyrindex cpname_yyrindex | 169 #define yyrindex cpname_yyrindex |
| 170 #define yygindex cpname_yygindex | 170 #define yygindex cpname_yygindex |
| 171 #define yytable cpname_yytable | 171 #define yytable cpname_yytable |
| 172 #define yycheck cpname_yycheck | 172 #define yycheck cpname_yycheck |
| 173 #define yyss cpname_yyss |
| 174 #define yysslim cpname_yysslim |
| 175 #define yyssp cpname_yyssp |
| 176 #define yystacksize cpname_yystacksize |
| 177 #define yyvs cpname_yyvs |
| 178 #define yyvsp cpname_yyvsp |
| 173 | 179 |
| 174 int yyparse (void); | 180 int yyparse (void); |
| 175 static int yylex (void); | 181 static int yylex (void); |
| 176 static void yyerror (char *); | 182 static void yyerror (char *); |
| 177 | 183 |
| 178 /* Enable yydebug for the stand-alone parser. */ | 184 /* Enable yydebug for the stand-alone parser. */ |
| 179 #ifdef TEST_CPNAMES | 185 #ifdef TEST_CPNAMES |
| 180 # define YYDEBUG 1 | 186 # define YYDEBUG 1 |
| 181 #endif | 187 #endif |
| 182 | 188 |
| 183 /* Helper functions. These wrap the demangler tree interface, handle | 189 /* Helper functions. These wrap the demangler tree interface, handle |
| 184 allocation from our global store, and return the allocated component. */ | 190 allocation from our global store, and return the allocated component. */ |
| 185 | 191 |
| 186 static struct demangle_component * | 192 static struct demangle_component * |
| 187 fill_comp (enum demangle_component_type d_type, struct demangle_component *lhs, | 193 fill_comp (enum demangle_component_type d_type, struct demangle_component *lhs, |
| 188 struct demangle_component *rhs) | 194 struct demangle_component *rhs) |
| 189 { | 195 { |
| 190 struct demangle_component *ret = d_grab (); | 196 struct demangle_component *ret = d_grab (); |
| 191 cplus_demangle_fill_component (ret, d_type, lhs, rhs); | 197 int i; |
| 198 |
| 199 i = cplus_demangle_fill_component (ret, d_type, lhs, rhs); |
| 200 gdb_assert (i); |
| 201 |
| 192 return ret; | 202 return ret; |
| 193 } | 203 } |
| 194 | 204 |
| 195 static struct demangle_component * | 205 static struct demangle_component * |
| 196 make_empty (enum demangle_component_type d_type) | 206 make_empty (enum demangle_component_type d_type) |
| 197 { | 207 { |
| 198 struct demangle_component *ret = d_grab (); | 208 struct demangle_component *ret = d_grab (); |
| 199 ret->type = d_type; | 209 ret->type = d_type; |
| 200 return ret; | 210 return ret; |
| 201 } | 211 } |
| 202 | 212 |
| 203 static struct demangle_component * | 213 static struct demangle_component * |
| 204 make_operator (const char *name, int args) | 214 make_operator (const char *name, int args) |
| 205 { | 215 { |
| 206 struct demangle_component *ret = d_grab (); | 216 struct demangle_component *ret = d_grab (); |
| 207 cplus_demangle_fill_operator (ret, name, args); | 217 int i; |
| 218 |
| 219 i = cplus_demangle_fill_operator (ret, name, args); |
| 220 gdb_assert (i); |
| 221 |
| 208 return ret; | 222 return ret; |
| 209 } | 223 } |
| 210 | 224 |
| 211 static struct demangle_component * | 225 static struct demangle_component * |
| 212 make_dtor (enum gnu_v3_dtor_kinds kind, struct demangle_component *name) | 226 make_dtor (enum gnu_v3_dtor_kinds kind, struct demangle_component *name) |
| 213 { | 227 { |
| 214 struct demangle_component *ret = d_grab (); | 228 struct demangle_component *ret = d_grab (); |
| 215 cplus_demangle_fill_dtor (ret, kind, name); | 229 int i; |
| 230 |
| 231 i = cplus_demangle_fill_dtor (ret, kind, name); |
| 232 gdb_assert (i); |
| 233 |
| 216 return ret; | 234 return ret; |
| 217 } | 235 } |
| 218 | 236 |
| 219 static struct demangle_component * | 237 static struct demangle_component * |
| 220 make_builtin_type (const char *name) | 238 make_builtin_type (const char *name) |
| 221 { | 239 { |
| 222 struct demangle_component *ret = d_grab (); | 240 struct demangle_component *ret = d_grab (); |
| 223 cplus_demangle_fill_builtin_type (ret, name); | 241 int i; |
| 242 |
| 243 i = cplus_demangle_fill_builtin_type (ret, name); |
| 244 gdb_assert (i); |
| 245 |
| 224 return ret; | 246 return ret; |
| 225 } | 247 } |
| 226 | 248 |
| 227 static struct demangle_component * | 249 static struct demangle_component * |
| 228 make_name (const char *name, int len) | 250 make_name (const char *name, int len) |
| 229 { | 251 { |
| 230 struct demangle_component *ret = d_grab (); | 252 struct demangle_component *ret = d_grab (); |
| 231 cplus_demangle_fill_name (ret, name, len); | 253 int i; |
| 254 |
| 255 i = cplus_demangle_fill_name (ret, name, len); |
| 256 gdb_assert (i); |
| 257 |
| 232 return ret; | 258 return ret; |
| 233 } | 259 } |
| 234 | 260 |
| 235 #define d_left(dc) (dc)->u.s_binary.left | 261 #define d_left(dc) (dc)->u.s_binary.left |
| 236 #define d_right(dc) (dc)->u.s_binary.right | 262 #define d_right(dc) (dc)->u.s_binary.right |
| 237 | 263 |
| 238 %} | 264 %} |
| 239 | 265 |
| 240 %union | 266 %union |
| 241 { | 267 { |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 if ($2.start) $$ = fill_comp (DEMANGLE_COMPONENT_LOCAL
_NAME, $$, $2.start); | 436 if ($2.start) $$ = fill_comp (DEMANGLE_COMPONENT_LOCAL
_NAME, $$, $2.start); |
| 411 } | 437 } |
| 412 ; | 438 ; |
| 413 | 439 |
| 414 demangler_special | 440 demangler_special |
| 415 : DEMANGLER_SPECIAL start | 441 : DEMANGLER_SPECIAL start |
| 416 { $$ = make_empty ($1); | 442 { $$ = make_empty ($1); |
| 417 d_left ($$) = $2; | 443 d_left ($$) = $2; |
| 418 d_right ($$) = NULL; } | 444 d_right ($$) = NULL; } |
| 419 | CONSTRUCTION_VTABLE start CONSTRUCTION_IN start | 445 | CONSTRUCTION_VTABLE start CONSTRUCTION_IN start |
error: old chunk mismatch |
None
| OLD | NEW |