Lines Matching full:first
40 static const char *parse_type(const char *first, const char *last, C &db);
42 static const char *parse_encoding(const char *first, const char *last, C &db);
44 static const char *parse_name(const char *first, const char *last, C &db,
47 static const char *parse_expression(const char *first, const char *last, C &db);
49 static const char *parse_template_args(const char *first, const char *last,
52 static const char *parse_operator_name(const char *first, const char *last,
55 static const char *parse_unqualified_name(const char *first, const char *last,
58 static const char *parse_decltype(const char *first, const char *last, C &db);
62 static const char *parse_number(const char *first, const char *last) { in parse_number() argument
63 if (first != last) { in parse_number()
64 const char *t = first; in parse_number()
69 first = t + 1; in parse_number()
71 first = t + 1; in parse_number()
72 while (first != last && std::isdigit(*first)) in parse_number()
73 ++first; in parse_number()
77 return first; in parse_number()
116 static const char *parse_floating_number(const char *first, const char *last, in parse_floating_number() argument
119 if (static_cast<std::size_t>(last - first) > N) { in parse_floating_number()
120 last = first + N; in parse_floating_number()
125 const char *t = first; in parse_floating_number()
129 return first; in parse_floating_number()
144 return first; in parse_floating_number()
146 first = t + 1; in parse_floating_number()
149 return first; in parse_floating_number()
155 static const char *parse_source_name(const char *first, const char *last, in parse_source_name() argument
157 if (first != last) { in parse_source_name()
158 char c = *first; in parse_source_name()
159 if (isdigit(c) && first + 1 != last) { in parse_source_name()
160 const char *t = first + 1; in parse_source_name()
165 return first; in parse_source_name()
173 first = t + n; in parse_source_name()
177 return first; in parse_source_name()
192 static const char *parse_substitution(const char *first, const char *last, in parse_substitution() argument
194 if (last - first >= 2) { in parse_substitution()
195 if (*first == 'S') { in parse_substitution()
196 switch (first[1]) { in parse_substitution()
199 first += 2; in parse_substitution()
203 first += 2; in parse_substitution()
207 first += 2; in parse_substitution()
211 first += 2; in parse_substitution()
215 first += 2; in parse_substitution()
219 first += 2; in parse_substitution()
225 first += 2; in parse_substitution()
229 if (std::isdigit(first[1]) || std::isupper(first[1])) { in parse_substitution()
231 const char *t = first + 1; in parse_substitution()
244 return first; in parse_substitution()
249 first = t + 1; in parse_substitution()
256 return first; in parse_substitution()
292 static const char *parse_builtin_type(const char *first, const char *last, in parse_builtin_type() argument
294 if (first != last) { in parse_builtin_type()
295 switch (*first) { in parse_builtin_type()
298 ++first; in parse_builtin_type()
302 ++first; in parse_builtin_type()
306 ++first; in parse_builtin_type()
310 ++first; in parse_builtin_type()
314 ++first; in parse_builtin_type()
318 ++first; in parse_builtin_type()
322 ++first; in parse_builtin_type()
326 ++first; in parse_builtin_type()
330 ++first; in parse_builtin_type()
334 ++first; in parse_builtin_type()
338 ++first; in parse_builtin_type()
342 ++first; in parse_builtin_type()
346 ++first; in parse_builtin_type()
350 ++first; in parse_builtin_type()
354 ++first; in parse_builtin_type()
358 ++first; in parse_builtin_type()
362 ++first; in parse_builtin_type()
366 ++first; in parse_builtin_type()
370 ++first; in parse_builtin_type()
374 ++first; in parse_builtin_type()
378 ++first; in parse_builtin_type()
381 const char *t = parse_source_name(first + 1, last, db); in parse_builtin_type()
382 if (t != first + 1) in parse_builtin_type()
383 first = t; in parse_builtin_type()
386 if (first + 1 != last) { in parse_builtin_type()
387 switch (first[1]) { in parse_builtin_type()
390 first += 2; in parse_builtin_type()
394 first += 2; in parse_builtin_type()
398 first += 2; in parse_builtin_type()
402 first += 2; in parse_builtin_type()
406 first += 2; in parse_builtin_type()
410 first += 2; in parse_builtin_type()
414 first += 2; in parse_builtin_type()
418 first += 2; in parse_builtin_type()
422 first += 2; in parse_builtin_type()
429 return first; in parse_builtin_type()
434 static const char *parse_cv_qualifiers(const char *first, const char *last, in parse_cv_qualifiers() argument
437 if (first != last) { in parse_cv_qualifiers()
438 if (*first == 'r') { in parse_cv_qualifiers()
440 ++first; in parse_cv_qualifiers()
442 if (*first == 'V') { in parse_cv_qualifiers()
444 ++first; in parse_cv_qualifiers()
446 if (*first == 'K') { in parse_cv_qualifiers()
448 ++first; in parse_cv_qualifiers()
451 return first; in parse_cv_qualifiers()
454 // <template-param> ::= T_ # first template parameter
458 static const char *parse_template_param(const char *first, const char *last, in parse_template_param() argument
460 if (last - first >= 2) { in parse_template_param()
461 if (*first == 'T') { in parse_template_param()
462 if (first[1] == '_') { in parse_template_param()
464 return first; in parse_template_param()
468 first += 2; in parse_template_param()
471 first += 2; in parse_template_param()
474 } else if (isdigit(first[1])) { in parse_template_param()
475 const char *t = first + 1; in parse_template_param()
482 return first; in parse_template_param()
487 first = t + 1; in parse_template_param()
489 db.names.push_back(std::string(first, t + 1)); in parse_template_param()
490 first = t + 1; in parse_template_param()
496 return first; in parse_template_param()
503 static const char *parse_const_cast_expr(const char *first, const char *last, in parse_const_cast_expr() argument
505 if (last - first >= 3 && first[0] == 'c' && first[1] == 'c') { in parse_const_cast_expr()
506 const char *t = parse_type(first + 2, last, db); in parse_const_cast_expr()
507 if (t != first + 2) { in parse_const_cast_expr()
511 return first; in parse_const_cast_expr()
515 return first; in parse_const_cast_expr()
518 first = t1; in parse_const_cast_expr()
522 return first; in parse_const_cast_expr()
529 static const char *parse_dynamic_cast_expr(const char *first, const char *last, in parse_dynamic_cast_expr() argument
531 if (last - first >= 3 && first[0] == 'd' && first[1] == 'c') { in parse_dynamic_cast_expr()
532 const char *t = parse_type(first + 2, last, db); in parse_dynamic_cast_expr()
533 if (t != first + 2) { in parse_dynamic_cast_expr()
537 return first; in parse_dynamic_cast_expr()
541 return first; in parse_dynamic_cast_expr()
544 first = t1; in parse_dynamic_cast_expr()
548 return first; in parse_dynamic_cast_expr()
555 static const char *parse_reinterpret_cast_expr(const char *first, in parse_reinterpret_cast_expr() argument
557 if (last - first >= 3 && first[0] == 'r' && first[1] == 'c') { in parse_reinterpret_cast_expr()
558 const char *t = parse_type(first + 2, last, db); in parse_reinterpret_cast_expr()
559 if (t != first + 2) { in parse_reinterpret_cast_expr()
563 return first; in parse_reinterpret_cast_expr()
567 return first; in parse_reinterpret_cast_expr()
570 first = t1; in parse_reinterpret_cast_expr()
574 return first; in parse_reinterpret_cast_expr()
581 static const char *parse_static_cast_expr(const char *first, const char *last, in parse_static_cast_expr() argument
583 if (last - first >= 3 && first[0] == 's' && first[1] == 'c') { in parse_static_cast_expr()
584 const char *t = parse_type(first + 2, last, db); in parse_static_cast_expr()
585 if (t != first + 2) { in parse_static_cast_expr()
589 return first; in parse_static_cast_expr()
594 first = t1; in parse_static_cast_expr()
598 return first; in parse_static_cast_expr()
604 static const char *parse_pack_expansion(const char *first, const char *last, in parse_pack_expansion() argument
606 if (last - first >= 3 && first[0] == 's' && first[1] == 'p') { in parse_pack_expansion()
607 const char *t = parse_expression(first + 2, last, db); in parse_pack_expansion()
608 if (t != first + 2) in parse_pack_expansion()
609 first = t; in parse_pack_expansion()
611 return first; in parse_pack_expansion()
617 static const char *parse_sizeof_type_expr(const char *first, const char *last, in parse_sizeof_type_expr() argument
619 if (last - first >= 3 && first[0] == 's' && first[1] == 't') { in parse_sizeof_type_expr()
620 const char *t = parse_type(first + 2, last, db); in parse_sizeof_type_expr()
621 if (t != first + 2) { in parse_sizeof_type_expr()
623 return first; in parse_sizeof_type_expr()
625 first = t; in parse_sizeof_type_expr()
628 return first; in parse_sizeof_type_expr()
634 static const char *parse_sizeof_expr_expr(const char *first, const char *last, in parse_sizeof_expr_expr() argument
636 if (last - first >= 3 && first[0] == 's' && first[1] == 'z') { in parse_sizeof_expr_expr()
637 const char *t = parse_expression(first + 2, last, db); in parse_sizeof_expr_expr()
638 if (t != first + 2) { in parse_sizeof_expr_expr()
640 return first; in parse_sizeof_expr_expr()
642 first = t; in parse_sizeof_expr_expr()
645 return first; in parse_sizeof_expr_expr()
652 static const char *parse_sizeof_param_pack_expr(const char *first, in parse_sizeof_param_pack_expr() argument
654 if (last - first >= 3 && first[0] == 's' && first[1] == 'Z' && in parse_sizeof_param_pack_expr()
655 first[2] == 'T') { in parse_sizeof_param_pack_expr()
657 const char *t = parse_template_param(first + 2, last, db); in parse_sizeof_param_pack_expr()
659 if (t != first + 2) { in parse_sizeof_param_pack_expr()
671 first = t; in parse_sizeof_param_pack_expr()
674 return first; in parse_sizeof_param_pack_expr()
677 // <function-param> ::= fp <top-level CV-qualifiers> _ # L == 0, first parameter
681 // _ # L > 0, first parameter
687 static const char *parse_function_param(const char *first, const char *last, in parse_function_param() argument
689 if (last - first >= 3 && *first == 'f') { in parse_function_param()
690 if (first[1] == 'p') { in parse_function_param()
692 const char *t = parse_cv_qualifiers(first + 2, last, cv); in parse_function_param()
696 first = t1 + 1; in parse_function_param()
698 } else if (first[1] == 'L') { in parse_function_param()
700 const char *t0 = parse_number(first + 2, last); in parse_function_param()
707 first = t1 + 1; in parse_function_param()
712 return first; in parse_function_param()
719 static const char *parse_sizeof_function_param_pack_expr(const char *first, in parse_sizeof_function_param_pack_expr() argument
722 if (last - first >= 3 && first[0] == 's' && first[1] == 'Z' && in parse_sizeof_function_param_pack_expr()
723 first[2] == 'f') { in parse_sizeof_function_param_pack_expr()
724 const char *t = parse_function_param(first + 2, last, db); in parse_sizeof_function_param_pack_expr()
725 if (t != first + 2) { in parse_sizeof_function_param_pack_expr()
727 return first; in parse_sizeof_function_param_pack_expr()
729 first = t; in parse_sizeof_function_param_pack_expr()
732 return first; in parse_sizeof_function_param_pack_expr()
739 static const char *parse_typeid_expr(const char *first, const char *last, in parse_typeid_expr() argument
741 if (last - first >= 3 && first[0] == 't' && in parse_typeid_expr()
742 (first[1] == 'e' || first[1] == 'i')) { in parse_typeid_expr()
744 if (first[1] == 'e') in parse_typeid_expr()
745 t = parse_expression(first + 2, last, db); in parse_typeid_expr()
747 t = parse_type(first + 2, last, db); in parse_typeid_expr()
748 if (t != first + 2) { in parse_typeid_expr()
750 return first; in parse_typeid_expr()
752 first = t; in parse_typeid_expr()
755 return first; in parse_typeid_expr()
761 static const char *parse_throw_expr(const char *first, const char *last, in parse_throw_expr() argument
763 if (last - first >= 3 && first[0] == 't' && first[1] == 'w') { in parse_throw_expr()
764 const char *t = parse_expression(first + 2, last, db); in parse_throw_expr()
765 if (t != first + 2) { in parse_throw_expr()
767 return first; in parse_throw_expr()
769 first = t; in parse_throw_expr()
772 return first; in parse_throw_expr()
778 static const char *parse_dot_star_expr(const char *first, const char *last, in parse_dot_star_expr() argument
780 if (last - first >= 3 && first[0] == 'd' && first[1] == 's') { in parse_dot_star_expr()
781 const char *t = parse_expression(first + 2, last, db); in parse_dot_star_expr()
782 if (t != first + 2) { in parse_dot_star_expr()
786 return first; in parse_dot_star_expr()
789 db.names.back().first += ".*" + expr; in parse_dot_star_expr()
790 first = t1; in parse_dot_star_expr()
794 return first; in parse_dot_star_expr()
800 static const char *parse_simple_id(const char *first, const char *last, C &db) { in parse_simple_id() argument
801 if (first != last) { in parse_simple_id()
802 const char *t = parse_source_name(first, last, db); in parse_simple_id()
803 if (t != first) { in parse_simple_id()
807 return first; in parse_simple_id()
810 db.names.back().first += std::move(args); in parse_simple_id()
812 first = t1; in parse_simple_id()
814 first = t; in parse_simple_id()
816 return first; in parse_simple_id()
824 static const char *parse_unresolved_type(const char *first, const char *last, in parse_unresolved_type() argument
826 if (first != last) { in parse_unresolved_type()
827 const char *t = first; in parse_unresolved_type()
828 switch (*first) { in parse_unresolved_type()
831 t = parse_template_param(first, last, db); in parse_unresolved_type()
833 if (t != first && k1 == k0 + 1) { in parse_unresolved_type()
835 first = t; in parse_unresolved_type()
843 t = parse_decltype(first, last, db); in parse_unresolved_type()
844 if (t != first) { in parse_unresolved_type()
846 return first; in parse_unresolved_type()
848 first = t; in parse_unresolved_type()
852 t = parse_substitution(first, last, db); in parse_unresolved_type()
853 if (t != first) in parse_unresolved_type()
854 first = t; in parse_unresolved_type()
856 if (last - first > 2 && first[1] == 't') { in parse_unresolved_type()
857 t = parse_unqualified_name(first + 2, last, db); in parse_unresolved_type()
858 if (t != first + 2) { in parse_unresolved_type()
860 return first; in parse_unresolved_type()
861 db.names.back().first.insert(0, "std::"); in parse_unresolved_type()
863 first = t; in parse_unresolved_type()
870 return first; in parse_unresolved_type()
879 static const char *parse_destructor_name(const char *first, const char *last, in parse_destructor_name() argument
881 if (first != last) { in parse_destructor_name()
882 const char *t = parse_unresolved_type(first, last, db); in parse_destructor_name()
883 if (t == first) in parse_destructor_name()
884 t = parse_simple_id(first, last, db); in parse_destructor_name()
885 if (t != first) { in parse_destructor_name()
887 return first; in parse_destructor_name()
888 db.names.back().first.insert(0, "~"); in parse_destructor_name()
889 first = t; in parse_destructor_name()
892 return first; in parse_destructor_name()
913 static const char *parse_base_unresolved_name(const char *first, in parse_base_unresolved_name() argument
915 if (last - first >= 2) { in parse_base_unresolved_name()
916 if ((first[0] == 'o' || first[0] == 'd') && first[1] == 'n') { in parse_base_unresolved_name()
917 if (first[0] == 'o') { in parse_base_unresolved_name()
918 const char *t = parse_operator_name(first + 2, last, db); in parse_base_unresolved_name()
919 if (t != first + 2) { in parse_base_unresolved_name()
920 first = parse_template_args(t, last, db); in parse_base_unresolved_name()
921 if (first != t) { in parse_base_unresolved_name()
923 return first; in parse_base_unresolved_name()
926 db.names.back().first += std::move(args); in parse_base_unresolved_name()
930 const char *t = parse_destructor_name(first + 2, last, db); in parse_base_unresolved_name()
931 if (t != first + 2) in parse_base_unresolved_name()
932 first = t; in parse_base_unresolved_name()
935 const char *t = parse_simple_id(first, last, db); in parse_base_unresolved_name()
936 if (t == first) { in parse_base_unresolved_name()
937 t = parse_operator_name(first, last, db); in parse_base_unresolved_name()
938 if (t != first) { in parse_base_unresolved_name()
939 first = parse_template_args(t, last, db); in parse_base_unresolved_name()
940 if (first != t) { in parse_base_unresolved_name()
942 return first; in parse_base_unresolved_name()
945 db.names.back().first += std::move(args); in parse_base_unresolved_name()
949 first = t; in parse_base_unresolved_name()
952 return first; in parse_base_unresolved_name()
958 static const char *parse_unresolved_qualifier_level(const char *first, in parse_unresolved_qualifier_level() argument
960 return parse_simple_id(first, last, db); in parse_unresolved_qualifier_level()
988 static const char *parse_unresolved_name(const char *first, const char *last, in parse_unresolved_name() argument
990 if (last - first > 2) { in parse_unresolved_name()
991 const char *t = first; in parse_unresolved_name()
1001 return first; in parse_unresolved_name()
1002 db.names.back().first.insert(0, "::"); in parse_unresolved_name()
1004 first = t2; in parse_unresolved_name()
1010 return first; in parse_unresolved_name()
1015 return first; in parse_unresolved_name()
1018 db.names.back().first += std::move(args); in parse_unresolved_name()
1022 return first; in parse_unresolved_name()
1028 return first; in parse_unresolved_name()
1031 db.names.back().first += "::" + std::move(s); in parse_unresolved_name()
1039 return first; in parse_unresolved_name()
1042 return first; in parse_unresolved_name()
1045 db.names.back().first += "::" + std::move(s); in parse_unresolved_name()
1046 first = t1; in parse_unresolved_name()
1055 return first; in parse_unresolved_name()
1058 db.names.back().first += std::move(args); in parse_unresolved_name()
1065 return first; in parse_unresolved_name()
1068 return first; in parse_unresolved_name()
1071 db.names.back().first += "::" + std::move(s); in parse_unresolved_name()
1072 first = t1; in parse_unresolved_name()
1076 return first; in parse_unresolved_name()
1080 return first; in parse_unresolved_name()
1081 db.names.back().first.insert(0, "::"); in parse_unresolved_name()
1086 return first; in parse_unresolved_name()
1089 db.names.back().first += "::" + std::move(s); in parse_unresolved_name()
1097 return first; in parse_unresolved_name()
1100 return first; in parse_unresolved_name()
1103 db.names.back().first += "::" + std::move(s); in parse_unresolved_name()
1104 first = t1; in parse_unresolved_name()
1109 return first; in parse_unresolved_name()
1115 static const char *parse_dot_expr(const char *first, const char *last, C &db) { in parse_dot_expr() argument
1116 if (last - first >= 3 && first[0] == 'd' && first[1] == 't') { in parse_dot_expr()
1117 const char *t = parse_expression(first + 2, last, db); in parse_dot_expr()
1118 if (t != first + 2) { in parse_dot_expr()
1122 return first; in parse_dot_expr()
1126 return first; in parse_dot_expr()
1127 db.names.back().first += "." + name; in parse_dot_expr()
1128 first = t1; in parse_dot_expr()
1132 return first; in parse_dot_expr()
1138 static const char *parse_call_expr(const char *first, const char *last, C &db) { in parse_call_expr() argument
1139 if (last - first >= 4 && first[0] == 'c' && first[1] == 'l') { in parse_call_expr()
1140 const char *t = parse_expression(first + 2, last, db); in parse_call_expr()
1141 if (t != first + 2) { in parse_call_expr()
1143 return first; in parse_call_expr()
1145 return first; in parse_call_expr()
1146 db.names.back().first += db.names.back().second; in parse_call_expr()
1148 db.names.back().first.append("("); in parse_call_expr()
1153 return first; in parse_call_expr()
1155 return first; in parse_call_expr()
1160 return first; in parse_call_expr()
1162 db.names.back().first.append(", "); in parse_call_expr()
1165 db.names.back().first.append(tmp); in parse_call_expr()
1171 return first; in parse_call_expr()
1172 db.names.back().first.append(")"); in parse_call_expr()
1173 first = t; in parse_call_expr()
1176 return first; in parse_call_expr()
1189 static const char *parse_new_expr(const char *first, const char *last, C &db) { in parse_new_expr() argument
1190 if (last - first >= 4) { in parse_new_expr()
1191 const char *t = first; in parse_new_expr()
1201 return first; in parse_new_expr()
1207 return first; in parse_new_expr()
1211 return first; in parse_new_expr()
1216 return first; in parse_new_expr()
1217 db.names.back().first.append(", "); in parse_new_expr()
1218 db.names.back().first.append(tmp); in parse_new_expr()
1227 return first; in parse_new_expr()
1237 return first; in parse_new_expr()
1240 return first; in parse_new_expr()
1245 return first; in parse_new_expr()
1246 db.names.back().first.append(", "); in parse_new_expr()
1247 db.names.back().first.append(tmp); in parse_new_expr()
1255 return first; in parse_new_expr()
1259 return first; in parse_new_expr()
1264 return first; in parse_new_expr()
1270 return first; in parse_new_expr()
1287 first = t + 1; in parse_new_expr()
1290 return first; in parse_new_expr()
1299 static const char *parse_conversion_expr(const char *first, const char *last, in parse_conversion_expr() argument
1301 if (last - first >= 3 && first[0] == 'c' && first[1] == 'v') { in parse_conversion_expr()
1304 const char *t = parse_type(first + 2, last, db); in parse_conversion_expr()
1306 if (t != first + 2 && t != last) { in parse_conversion_expr()
1310 return first; in parse_conversion_expr()
1315 return first; in parse_conversion_expr()
1323 return first; in parse_conversion_expr()
1326 return first; in parse_conversion_expr()
1331 return first; in parse_conversion_expr()
1332 db.names.back().first.append(", "); in parse_conversion_expr()
1333 db.names.back().first.append(tmp); in parse_conversion_expr()
1343 return first; in parse_conversion_expr()
1347 first = t; in parse_conversion_expr()
1350 return first; in parse_conversion_expr()
1356 static const char *parse_arrow_expr(const char *first, const char *last, in parse_arrow_expr() argument
1358 if (last - first >= 3 && first[0] == 'p' && first[1] == 't') { in parse_arrow_expr()
1359 const char *t = parse_expression(first + 2, last, db); in parse_arrow_expr()
1360 if (t != first + 2) { in parse_arrow_expr()
1364 return first; in parse_arrow_expr()
1367 db.names.back().first += "->"; in parse_arrow_expr()
1368 db.names.back().first += tmp; in parse_arrow_expr()
1369 first = t1; in parse_arrow_expr()
1373 return first; in parse_arrow_expr()
1382 static const char *parse_function_type(const char *first, const char *last, in parse_function_type() argument
1384 if (first != last && *first == 'F') { in parse_function_type()
1385 const char *t = first + 1; in parse_function_type()
1390 return first; in parse_function_type()
1400 return first; in parse_function_type()
1424 return first; in parse_function_type()
1444 return first; in parse_function_type()
1445 db.names.back().first += " "; in parse_function_type()
1447 first = t; in parse_function_type()
1451 return first; in parse_function_type()
1457 static const char *parse_pointer_to_member_type(const char *first, in parse_pointer_to_member_type() argument
1459 if (first != last && *first == 'M') { in parse_pointer_to_member_type()
1460 const char *t = parse_type(first + 1, last, db); in parse_pointer_to_member_type()
1461 if (t != first + 1) { in parse_pointer_to_member_type()
1465 return first; in parse_pointer_to_member_type()
1470 db.names.back().first = in parse_pointer_to_member_type()
1471 std::move(func.first) + "(" + class_type.move_full() + "::*"; in parse_pointer_to_member_type()
1474 db.names.back().first = in parse_pointer_to_member_type()
1475 std::move(func.first) + " " + class_type.move_full() + "::*"; in parse_pointer_to_member_type()
1478 first = t2; in parse_pointer_to_member_type()
1482 return first; in parse_pointer_to_member_type()
1489 static const char *parse_array_type(const char *first, const char *last, in parse_array_type() argument
1491 if (first != last && *first == 'A' && first + 1 != last) { in parse_array_type()
1492 if (first[1] == '_') { in parse_array_type()
1493 const char *t = parse_type(first + 2, last, db); in parse_array_type()
1494 if (t != first + 2) { in parse_array_type()
1496 return first; in parse_array_type()
1500 first = t; in parse_array_type()
1502 } else if ('1' <= first[1] && first[1] <= '9') { in parse_array_type()
1503 const char *t = parse_number(first + 1, last); in parse_array_type()
1508 return first; in parse_array_type()
1512 " [" + std::string(first + 1, t) + "]"); in parse_array_type()
1513 first = t2; in parse_array_type()
1517 const char *t = parse_expression(first + 1, last, db); in parse_array_type()
1518 if (t != first + 1 && t != last && *t == '_') { in parse_array_type()
1522 return first; in parse_array_type()
1526 db.names.back().first = std::move(type.first); in parse_array_type()
1531 first = t2; in parse_array_type()
1536 return first; in parse_array_type()
1544 static const char *parse_decltype(const char *first, const char *last, C &db) { in parse_decltype() argument
1545 if (last - first >= 4 && first[0] == 'D') { in parse_decltype()
1546 switch (first[1]) { in parse_decltype()
1549 const char *t = parse_expression(first + 2, last, db); in parse_decltype()
1550 if (t != first + 2 && t != last && *t == 'E') { in parse_decltype()
1552 return first; in parse_decltype()
1554 first = t + 1; in parse_decltype()
1559 return first; in parse_decltype()
1570 static const char *parse_vector_type(const char *first, const char *last, in parse_vector_type() argument
1572 if (last - first > 3 && first[0] == 'D' && first[1] == 'v') { in parse_vector_type()
1573 if ('1' <= first[2] && first[2] <= '9') { in parse_vector_type()
1574 const char *t = parse_number(first + 2, last); in parse_vector_type()
1576 return first; in parse_vector_type()
1577 const char *num = first + 2; in parse_vector_type()
1584 return first; in parse_vector_type()
1585 db.names.back().first += " vector[" + std::string(num, sz) + "]"; in parse_vector_type()
1586 first = t1; in parse_vector_type()
1591 first = t; in parse_vector_type()
1596 const char *t1 = first + 2; in parse_vector_type()
1601 return first; in parse_vector_type()
1611 return first; in parse_vector_type()
1612 db.names.back().first += " vector[" + num + "]"; in parse_vector_type()
1613 first = t; in parse_vector_type()
1618 return first; in parse_vector_type()
1647 static const char *parse_type(const char *first, const char *last, C &db) { in parse_type() argument
1648 if (first != last) { in parse_type()
1649 switch (*first) { in parse_type()
1654 const char *t = parse_cv_qualifiers(first, last, cv); in parse_type()
1655 if (t != first) { in parse_type()
1683 db.names[k].first.append(" const"); in parse_type()
1685 db.names[k].first.append(" volatile"); in parse_type()
1687 db.names[k].first.append(" restrict"); in parse_type()
1691 first = t1; in parse_type()
1696 const char *t = parse_builtin_type(first, last, db); in parse_type()
1697 if (t != first) { in parse_type()
1698 first = t; in parse_type()
1700 switch (*first) { in parse_type()
1702 t = parse_array_type(first, last, db); in parse_type()
1703 if (t != first) { in parse_type()
1705 return first; in parse_type()
1706 first = t; in parse_type()
1711 t = parse_type(first + 1, last, db); in parse_type()
1712 if (t != first + 1) { in parse_type()
1714 return first; in parse_type()
1715 db.names.back().first.append(" complex"); in parse_type()
1716 first = t; in parse_type()
1721 t = parse_function_type(first, last, db); in parse_type()
1722 if (t != first) { in parse_type()
1724 return first; in parse_type()
1725 first = t; in parse_type()
1730 t = parse_type(first + 1, last, db); in parse_type()
1731 if (t != first + 1) { in parse_type()
1733 return first; in parse_type()
1734 db.names.back().first.append(" imaginary"); in parse_type()
1735 first = t; in parse_type()
1740 t = parse_pointer_to_member_type(first, last, db); in parse_type()
1741 if (t != first) { in parse_type()
1743 return first; in parse_type()
1744 first = t; in parse_type()
1750 t = parse_type(first + 1, last, db); in parse_type()
1752 if (t != first + 1) { in parse_type()
1756 db.names[k].first += " ("; in parse_type()
1760 db.names[k].first += "("; in parse_type()
1763 db.names[k].first.append("&&"); in parse_type()
1766 first = t; in parse_type()
1772 t = parse_type(first + 1, last, db); in parse_type()
1774 if (t != first + 1) { in parse_type()
1778 db.names[k].first += " ("; in parse_type()
1782 db.names[k].first += "("; in parse_type()
1785 if (first[1] != 'U' || in parse_type()
1786 db.names[k].first.substr(0, 12) != "objc_object<") { in parse_type()
1787 db.names[k].first.append("*"); in parse_type()
1789 db.names[k].first.replace(0, 11, "id"); in parse_type()
1793 first = t; in parse_type()
1799 t = parse_type(first + 1, last, db); in parse_type()
1801 if (t != first + 1) { in parse_type()
1805 db.names[k].first += " ("; in parse_type()
1809 db.names[k].first += "("; in parse_type()
1812 db.names[k].first.append("&"); in parse_type()
1815 first = t; in parse_type()
1821 t = parse_template_param(first, last, db); in parse_type()
1823 if (t != first) { in parse_type()
1832 db.names.back().first += std::move(args); in parse_type()
1837 first = t; in parse_type()
1842 if (first + 1 != last) { in parse_type()
1843 t = parse_source_name(first + 1, last, db); in parse_type()
1844 if (t != first + 1) { in parse_type()
1848 return first; in parse_type()
1851 if (db.names.back().first.substr(0, 9) != "objcproto") { in parse_type()
1866 first = t2; in parse_type()
1872 if (first + 1 != last && first[1] == 't') { in parse_type()
1873 t = parse_name(first, last, db); in parse_type()
1874 if (t != first) { in parse_type()
1876 return first; in parse_type()
1878 first = t; in parse_type()
1881 t = parse_substitution(first, last, db); in parse_type()
1882 if (t != first) { in parse_type()
1883 first = t; in parse_type()
1886 t = parse_template_args(first, last, db); in parse_type()
1887 if (t != first) { in parse_type()
1889 return first; in parse_type()
1892 db.names.back().first += template_args; in parse_type()
1896 first = t; in parse_type()
1902 if (first + 1 != last) { in parse_type()
1903 switch (first[1]) { in parse_type()
1906 t = parse_type(first + 2, last, db); in parse_type()
1908 if (t != first + 2) { in parse_type()
1912 first = t; in parse_type()
1913 return first; in parse_type()
1919 t = parse_decltype(first, last, db); in parse_type()
1920 if (t != first) { in parse_type()
1922 return first; in parse_type()
1924 first = t; in parse_type()
1925 return first; in parse_type()
1929 t = parse_vector_type(first, last, db); in parse_type()
1930 if (t != first) { in parse_type()
1932 return first; in parse_type()
1934 first = t; in parse_type()
1935 return first; in parse_type()
1944 t = parse_builtin_type(first, last, db); in parse_type()
1945 if (t != first) { in parse_type()
1946 first = t; in parse_type()
1948 t = parse_name(first, last, db); in parse_type()
1949 if (t != first) { in parse_type()
1951 return first; in parse_type()
1953 first = t; in parse_type()
1963 return first; in parse_type()
2020 static const char *parse_operator_name(const char *first, const char *last, in parse_operator_name() argument
2022 if (last - first >= 2) { in parse_operator_name()
2023 switch (first[0]) { in parse_operator_name()
2025 switch (first[1]) { in parse_operator_name()
2028 first += 2; in parse_operator_name()
2033 first += 2; in parse_operator_name()
2037 first += 2; in parse_operator_name()
2041 first += 2; in parse_operator_name()
2046 switch (first[1]) { in parse_operator_name()
2049 first += 2; in parse_operator_name()
2053 first += 2; in parse_operator_name()
2057 first += 2; in parse_operator_name()
2062 const char *t = parse_type(first + 2, last, db); in parse_operator_name()
2064 if (t != first + 2) { in parse_operator_name()
2066 return first; in parse_operator_name()
2067 db.names.back().first.insert(0, "operator "); in parse_operator_name()
2069 first = t; in parse_operator_name()
2075 switch (first[1]) { in parse_operator_name()
2078 first += 2; in parse_operator_name()
2082 first += 2; in parse_operator_name()
2086 first += 2; in parse_operator_name()
2090 first += 2; in parse_operator_name()
2094 first += 2; in parse_operator_name()
2099 switch (first[1]) { in parse_operator_name()
2102 first += 2; in parse_operator_name()
2106 first += 2; in parse_operator_name()
2110 first += 2; in parse_operator_name()
2115 switch (first[1]) { in parse_operator_name()
2118 first += 2; in parse_operator_name()
2122 first += 2; in parse_operator_name()
2127 if (first[1] == 'x') { in parse_operator_name()
2129 first += 2; in parse_operator_name()
2133 switch (first[1]) { in parse_operator_name()
2136 first += 2; in parse_operator_name()
2139 const char *t = parse_source_name(first + 2, last, db); in parse_operator_name()
2140 if (t != first + 2) { in parse_operator_name()
2142 return first; in parse_operator_name()
2143 db.names.back().first.insert(0, "operator\"\" "); in parse_operator_name()
2144 first = t; in parse_operator_name()
2149 first += 2; in parse_operator_name()
2153 first += 2; in parse_operator_name()
2157 first += 2; in parse_operator_name()
2162 switch (first[1]) { in parse_operator_name()
2165 first += 2; in parse_operator_name()
2169 first += 2; in parse_operator_name()
2173 first += 2; in parse_operator_name()
2177 first += 2; in parse_operator_name()
2181 first += 2; in parse_operator_name()
2186 switch (first[1]) { in parse_operator_name()
2189 first += 2; in parse_operator_name()
2193 first += 2; in parse_operator_name()
2197 first += 2; in parse_operator_name()
2201 first += 2; in parse_operator_name()
2205 first += 2; in parse_operator_name()
2210 switch (first[1]) { in parse_operator_name()
2213 first += 2; in parse_operator_name()
2217 first += 2; in parse_operator_name()
2221 first += 2; in parse_operator_name()
2226 switch (first[1]) { in parse_operator_name()
2229 first += 2; in parse_operator_name()
2233 first += 2; in parse_operator_name()
2237 first += 2; in parse_operator_name()
2241 first += 2; in parse_operator_name()
2245 first += 2; in parse_operator_name()
2249 first += 2; in parse_operator_name()
2254 if (first[1] == 'u') { in parse_operator_name()
2256 first += 2; in parse_operator_name()
2260 switch (first[1]) { in parse_operator_name()
2263 first += 2; in parse_operator_name()
2267 first += 2; in parse_operator_name()
2271 first += 2; in parse_operator_name()
2275 first += 2; in parse_operator_name()
2280 if (std::isdigit(first[1])) { in parse_operator_name()
2281 const char *t = parse_source_name(first + 2, last, db); in parse_operator_name()
2282 if (t != first + 2) { in parse_operator_name()
2284 return first; in parse_operator_name()
2285 db.names.back().first.insert(0, "operator "); in parse_operator_name()
2286 first = t; in parse_operator_name()
2292 return first; in parse_operator_name()
2296 static const char *parse_integer_literal(const char *first, const char *last, in parse_integer_literal() argument
2298 const char *t = parse_number(first, last); in parse_integer_literal()
2299 if (t != first && t != last && *t == 'E') { in parse_integer_literal()
2304 if (*first == 'n') { in parse_integer_literal()
2305 db.names.back().first += '-'; in parse_integer_literal()
2306 ++first; in parse_integer_literal()
2308 db.names.back().first.append(first, t); in parse_integer_literal()
2310 db.names.back().first += lit; in parse_integer_literal()
2311 first = t + 1; in parse_integer_literal()
2313 return first; in parse_integer_literal()
2330 static const char *parse_expr_primary(const char *first, const char *last, in parse_expr_primary() argument
2332 if (last - first >= 4 && *first == 'L') { in parse_expr_primary()
2333 switch (first[1]) { in parse_expr_primary()
2335 const char *t = parse_integer_literal(first + 2, last, "wchar_t", db); in parse_expr_primary()
2336 if (t != first + 2) in parse_expr_primary()
2337 first = t; in parse_expr_primary()
2340 if (first[3] == 'E') { in parse_expr_primary()
2341 switch (first[2]) { in parse_expr_primary()
2344 first += 4; in parse_expr_primary()
2348 first += 4; in parse_expr_primary()
2354 const char *t = parse_integer_literal(first + 2, last, "char", db); in parse_expr_primary()
2355 if (t != first + 2) in parse_expr_primary()
2356 first = t; in parse_expr_primary()
2359 const char *t = parse_integer_literal(first + 2, last, "signed char", db); in parse_expr_primary()
2360 if (t != first + 2) in parse_expr_primary()
2361 first = t; in parse_expr_primary()
2365 parse_integer_literal(first + 2, last, "unsigned char", db); in parse_expr_primary()
2366 if (t != first + 2) in parse_expr_primary()
2367 first = t; in parse_expr_primary()
2370 const char *t = parse_integer_literal(first + 2, last, "short", db); in parse_expr_primary()
2371 if (t != first + 2) in parse_expr_primary()
2372 first = t; in parse_expr_primary()
2376 parse_integer_literal(first + 2, last, "unsigned short", db); in parse_expr_primary()
2377 if (t != first + 2) in parse_expr_primary()
2378 first = t; in parse_expr_primary()
2381 const char *t = parse_integer_literal(first + 2, last, "", db); in parse_expr_primary()
2382 if (t != first + 2) in parse_expr_primary()
2383 first = t; in parse_expr_primary()
2386 const char *t = parse_integer_literal(first + 2, last, "u", db); in parse_expr_primary()
2387 if (t != first + 2) in parse_expr_primary()
2388 first = t; in parse_expr_primary()
2391 const char *t = parse_integer_literal(first + 2, last, "l", db); in parse_expr_primary()
2392 if (t != first + 2) in parse_expr_primary()
2393 first = t; in parse_expr_primary()
2396 const char *t = parse_integer_literal(first + 2, last, "ul", db); in parse_expr_primary()
2397 if (t != first + 2) in parse_expr_primary()
2398 first = t; in parse_expr_primary()
2401 const char *t = parse_integer_literal(first + 2, last, "ll", db); in parse_expr_primary()
2402 if (t != first + 2) in parse_expr_primary()
2403 first = t; in parse_expr_primary()
2406 const char *t = parse_integer_literal(first + 2, last, "ull", db); in parse_expr_primary()
2407 if (t != first + 2) in parse_expr_primary()
2408 first = t; in parse_expr_primary()
2411 const char *t = parse_integer_literal(first + 2, last, "__int128", db); in parse_expr_primary()
2412 if (t != first + 2) in parse_expr_primary()
2413 first = t; in parse_expr_primary()
2417 parse_integer_literal(first + 2, last, "unsigned __int128", db); in parse_expr_primary()
2418 if (t != first + 2) in parse_expr_primary()
2419 first = t; in parse_expr_primary()
2422 const char *t = parse_floating_number<float>(first + 2, last, db); in parse_expr_primary()
2423 if (t != first + 2) in parse_expr_primary()
2424 first = t; in parse_expr_primary()
2427 const char *t = parse_floating_number<double>(first + 2, last, db); in parse_expr_primary()
2428 if (t != first + 2) in parse_expr_primary()
2429 first = t; in parse_expr_primary()
2432 const char *t = parse_floating_number<long double>(first + 2, last, db); in parse_expr_primary()
2433 if (t != first + 2) in parse_expr_primary()
2434 first = t; in parse_expr_primary()
2437 if (first[2] == 'Z') { in parse_expr_primary()
2438 const char *t = parse_encoding(first + 3, last, db); in parse_expr_primary()
2439 if (t != first + 3 && t != last && *t == 'E') in parse_expr_primary()
2440 first = t + 1; in parse_expr_primary()
2449 const char *t = parse_type(first + 1, last, db); in parse_expr_primary()
2450 if (t != first + 1 && t != last) { in parse_expr_primary()
2457 return first; in parse_expr_primary()
2460 first = n + 1; in parse_expr_primary()
2464 first = t + 1; in parse_expr_primary()
2471 return first; in parse_expr_primary()
2532 static const char *parse_ctor_dtor_name(const char *first, const char *last, in parse_ctor_dtor_name() argument
2534 if (last - first >= 2 && !db.names.empty()) { in parse_ctor_dtor_name()
2535 switch (first[0]) { in parse_ctor_dtor_name()
2537 switch (first[1]) { in parse_ctor_dtor_name()
2543 return first; in parse_ctor_dtor_name()
2544 db.names.push_back(base_name(db.names.back().first)); in parse_ctor_dtor_name()
2545 first += 2; in parse_ctor_dtor_name()
2551 switch (first[1]) { in parse_ctor_dtor_name()
2557 return first; in parse_ctor_dtor_name()
2558 db.names.push_back("~" + base_name(db.names.back().first)); in parse_ctor_dtor_name()
2559 first += 2; in parse_ctor_dtor_name()
2566 return first; in parse_ctor_dtor_name()
2578 static const char *parse_unnamed_type_name(const char *first, const char *last, in parse_unnamed_type_name() argument
2580 if (last - first > 2 && first[0] == 'U') { in parse_unnamed_type_name()
2581 char type = first[1]; in parse_unnamed_type_name()
2585 const char *t0 = first + 2; in parse_unnamed_type_name()
2588 return first; in parse_unnamed_type_name()
2594 db.names.back().first.append(t0, t1); in parse_unnamed_type_name()
2597 db.names.back().first.push_back('\''); in parse_unnamed_type_name()
2600 return first; in parse_unnamed_type_name()
2602 first = t0 + 1; in parse_unnamed_type_name()
2606 const char *t0 = first + 2; in parse_unnamed_type_name()
2607 if (first[2] == 'v') { in parse_unnamed_type_name()
2608 db.names.back().first += ')'; in parse_unnamed_type_name()
2615 return first; in parse_unnamed_type_name()
2618 return first; in parse_unnamed_type_name()
2621 db.names.back().first.append(tmp); in parse_unnamed_type_name()
2628 return first; in parse_unnamed_type_name()
2632 db.names.back().first.append(", "); in parse_unnamed_type_name()
2633 db.names.back().first.append(tmp); in parse_unnamed_type_name()
2638 return first; in parse_unnamed_type_name()
2639 db.names.back().first.append(")"); in parse_unnamed_type_name()
2644 return first; in parse_unnamed_type_name()
2650 return first; in parse_unnamed_type_name()
2656 db.names.back().first.insert(db.names.back().first.begin() + 7, t0, t1); in parse_unnamed_type_name()
2662 return first; in parse_unnamed_type_name()
2664 first = t0 + 1; in parse_unnamed_type_name()
2668 return first; in parse_unnamed_type_name()
2677 static const char *parse_unqualified_name(const char *first, const char *last, in parse_unqualified_name() argument
2679 if (first != last) { in parse_unqualified_name()
2681 switch (*first) { in parse_unqualified_name()
2684 t = parse_ctor_dtor_name(first, last, db); in parse_unqualified_name()
2685 if (t != first) in parse_unqualified_name()
2686 first = t; in parse_unqualified_name()
2689 t = parse_unnamed_type_name(first, last, db); in parse_unqualified_name()
2690 if (t != first) in parse_unqualified_name()
2691 first = t; in parse_unqualified_name()
2702 t = parse_source_name(first, last, db); in parse_unqualified_name()
2703 if (t != first) in parse_unqualified_name()
2704 first = t; in parse_unqualified_name()
2707 t = parse_operator_name(first, last, db); in parse_unqualified_name()
2708 if (t != first) in parse_unqualified_name()
2709 first = t; in parse_unqualified_name()
2713 return first; in parse_unqualified_name()
2721 static const char *parse_unscoped_name(const char *first, const char *last, in parse_unscoped_name() argument
2723 if (last - first >= 2) { in parse_unscoped_name()
2724 const char *t0 = first; in parse_unscoped_name()
2726 if (first[0] == 'S' && first[1] == 't') { in parse_unscoped_name()
2736 return first; in parse_unscoped_name()
2737 db.names.back().first.insert(0, "std::"); in parse_unscoped_name()
2739 first = t1; in parse_unscoped_name()
2742 return first; in parse_unscoped_name()
2748 static const char *parse_alignof_type(const char *first, const char *last, in parse_alignof_type() argument
2750 if (last - first >= 3 && first[0] == 'a' && first[1] == 't') { in parse_alignof_type()
2751 const char *t = parse_type(first + 2, last, db); in parse_alignof_type()
2752 if (t != first + 2) { in parse_alignof_type()
2754 return first; in parse_alignof_type()
2755 db.names.back().first = "alignof (" + db.names.back().move_full() + ")"; in parse_alignof_type()
2756 first = t; in parse_alignof_type()
2759 return first; in parse_alignof_type()
2766 static const char *parse_alignof_expr(const char *first, const char *last, in parse_alignof_expr() argument
2768 if (last - first >= 3 && first[0] == 'a' && first[1] == 'z') { in parse_alignof_expr()
2769 const char *t = parse_expression(first + 2, last, db); in parse_alignof_expr()
2770 if (t != first + 2) { in parse_alignof_expr()
2772 return first; in parse_alignof_expr()
2773 db.names.back().first = "alignof (" + db.names.back().move_full() + ")"; in parse_alignof_expr()
2774 first = t; in parse_alignof_expr()
2777 return first; in parse_alignof_expr()
2781 static const char *parse_noexcept_expression(const char *first, in parse_noexcept_expression() argument
2783 const char *t1 = parse_expression(first, last, db); in parse_noexcept_expression()
2784 if (t1 != first) { in parse_noexcept_expression()
2786 return first; in parse_noexcept_expression()
2787 db.names.back().first = "noexcept (" + db.names.back().move_full() + ")"; in parse_noexcept_expression()
2788 first = t1; in parse_noexcept_expression()
2790 return first; in parse_noexcept_expression()
2794 static const char *parse_prefix_expression(const char *first, const char *last, in parse_prefix_expression() argument
2797 const char *t1 = parse_expression(first, last, db); in parse_prefix_expression()
2798 if (t1 != first) { in parse_prefix_expression()
2800 return first; in parse_prefix_expression()
2801 db.names.back().first = op + "(" + db.names.back().move_full() + ")"; in parse_prefix_expression()
2802 first = t1; in parse_prefix_expression()
2804 return first; in parse_prefix_expression()
2808 static const char *parse_binary_expression(const char *first, const char *last, in parse_binary_expression() argument
2811 const char *t1 = parse_expression(first, last, db); in parse_binary_expression()
2812 if (t1 != first) { in parse_binary_expression()
2816 return first; in parse_binary_expression()
2820 auto &nm = db.names.back().first; in parse_binary_expression()
2827 first = t2; in parse_binary_expression()
2831 return first; in parse_binary_expression()
2915 static const char *parse_expression(const char *first, const char *last, in parse_expression() argument
2917 if (last - first >= 2) { in parse_expression()
2918 const char *t = first; in parse_expression()
2920 if (last - first >= 4 && t[0] == 'g' && t[1] == 's') { in parse_expression()
2926 first = parse_expr_primary(first, last, db); in parse_expression()
2929 first = parse_template_param(first, last, db); in parse_expression()
2932 first = parse_function_param(first, last, db); in parse_expression()
2937 t = parse_binary_expression(first + 2, last, "&&", db); in parse_expression()
2938 if (t != first + 2) in parse_expression()
2939 first = t; in parse_expression()
2942 t = parse_prefix_expression(first + 2, last, "&", db); in parse_expression()
2943 if (t != first + 2) in parse_expression()
2944 first = t; in parse_expression()
2947 t = parse_binary_expression(first + 2, last, "&", db); in parse_expression()
2948 if (t != first + 2) in parse_expression()
2949 first = t; in parse_expression()
2952 t = parse_binary_expression(first + 2, last, "&=", db); in parse_expression()
2953 if (t != first + 2) in parse_expression()
2954 first = t; in parse_expression()
2957 t = parse_binary_expression(first + 2, last, "=", db); in parse_expression()
2958 if (t != first + 2) in parse_expression()
2959 first = t; in parse_expression()
2962 first = parse_alignof_type(first, last, db); in parse_expression()
2965 first = parse_alignof_expr(first, last, db); in parse_expression()
2972 first = parse_const_cast_expr(first, last, db); in parse_expression()
2975 first = parse_call_expr(first, last, db); in parse_expression()
2978 t = parse_binary_expression(first + 2, last, ",", db); in parse_expression()
2979 if (t != first + 2) in parse_expression()
2980 first = t; in parse_expression()
2983 t = parse_prefix_expression(first + 2, last, "~", db); in parse_expression()
2984 if (t != first + 2) in parse_expression()
2985 first = t; in parse_expression()
2988 first = parse_conversion_expr(first, last, db); in parse_expression()
2998 return first; in parse_expression()
2999 db.names.back().first = in parse_expression()
3002 first = t1; in parse_expression()
3006 first = parse_dynamic_cast_expr(first, last, db); in parse_expression()
3009 t = parse_prefix_expression(first + 2, last, "*", db); in parse_expression()
3010 if (t != first + 2) in parse_expression()
3011 first = t; in parse_expression()
3017 return first; in parse_expression()
3018 db.names.back().first = in parse_expression()
3021 first = t1; in parse_expression()
3025 return parse_unresolved_name(first, last, db); in parse_expression()
3027 first = parse_dot_star_expr(first, last, db); in parse_expression()
3030 first = parse_dot_expr(first, last, db); in parse_expression()
3033 t = parse_binary_expression(first + 2, last, "/", db); in parse_expression()
3034 if (t != first + 2) in parse_expression()
3035 first = t; in parse_expression()
3038 t = parse_binary_expression(first + 2, last, "/=", db); in parse_expression()
3039 if (t != first + 2) in parse_expression()
3040 first = t; in parse_expression()
3047 t = parse_binary_expression(first + 2, last, "^", db); in parse_expression()
3048 if (t != first + 2) in parse_expression()
3049 first = t; in parse_expression()
3052 t = parse_binary_expression(first + 2, last, "^=", db); in parse_expression()
3053 if (t != first + 2) in parse_expression()
3054 first = t; in parse_expression()
3057 t = parse_binary_expression(first + 2, last, "==", db); in parse_expression()
3058 if (t != first + 2) in parse_expression()
3059 first = t; in parse_expression()
3066 t = parse_binary_expression(first + 2, last, ">=", db); in parse_expression()
3067 if (t != first + 2) in parse_expression()
3068 first = t; in parse_expression()
3071 t = parse_binary_expression(first + 2, last, ">", db); in parse_expression()
3072 if (t != first + 2) in parse_expression()
3073 first = t; in parse_expression()
3079 const char *t1 = parse_expression(first + 2, last, db); in parse_expression()
3080 if (t1 != first + 2) { in parse_expression()
3084 return first; in parse_expression()
3089 first = t2; in parse_expression()
3098 t = parse_binary_expression(first + 2, last, "<=", db); in parse_expression()
3099 if (t != first + 2) in parse_expression()
3100 first = t; in parse_expression()
3103 t = parse_binary_expression(first + 2, last, "<<", db); in parse_expression()
3104 if (t != first + 2) in parse_expression()
3105 first = t; in parse_expression()
3108 t = parse_binary_expression(first + 2, last, "<<=", db); in parse_expression()
3109 if (t != first + 2) in parse_expression()
3110 first = t; in parse_expression()
3113 t = parse_binary_expression(first + 2, last, "<", db); in parse_expression()
3114 if (t != first + 2) in parse_expression()
3115 first = t; in parse_expression()
3122 t = parse_binary_expression(first + 2, last, "-", db); in parse_expression()
3123 if (t != first + 2) in parse_expression()
3124 first = t; in parse_expression()
3127 t = parse_binary_expression(first + 2, last, "-=", db); in parse_expression()
3128 if (t != first + 2) in parse_expression()
3129 first = t; in parse_expression()
3132 t = parse_binary_expression(first + 2, last, "*", db); in parse_expression()
3133 if (t != first + 2) in parse_expression()
3134 first = t; in parse_expression()
3137 t = parse_binary_expression(first + 2, last, "*=", db); in parse_expression()
3138 if (t != first + 2) in parse_expression()
3139 first = t; in parse_expression()
3142 if (first + 2 != last && first[2] == '_') { in parse_expression()
3143 t = parse_prefix_expression(first + 3, last, "--", db); in parse_expression()
3144 if (t != first + 3) in parse_expression()
3145 first = t; in parse_expression()
3147 const char *t1 = parse_expression(first + 2, last, db); in parse_expression()
3148 if (t1 != first + 2) { in parse_expression()
3150 return first; in parse_expression()
3152 first = t1; in parse_expression()
3162 first = parse_new_expr(first, last, db); in parse_expression()
3165 t = parse_binary_expression(first + 2, last, "!=", db); in parse_expression()
3166 if (t != first + 2) in parse_expression()
3167 first = t; in parse_expression()
3170 t = parse_prefix_expression(first + 2, last, "-", db); in parse_expression()
3171 if (t != first + 2) in parse_expression()
3172 first = t; in parse_expression()
3175 t = parse_prefix_expression(first + 2, last, "!", db); in parse_expression()
3176 if (t != first + 2) in parse_expression()
3177 first = t; in parse_expression()
3180 t = parse_noexcept_expression(first + 2, last, db); in parse_expression()
3181 if (t != first + 2) in parse_expression()
3182 first = t; in parse_expression()
3189 return parse_unresolved_name(first, last, db); in parse_expression()
3191 t = parse_binary_expression(first + 2, last, "||", db); in parse_expression()
3192 if (t != first + 2) in parse_expression()
3193 first = t; in parse_expression()
3196 t = parse_binary_expression(first + 2, last, "|", db); in parse_expression()
3197 if (t != first + 2) in parse_expression()
3198 first = t; in parse_expression()
3201 t = parse_binary_expression(first + 2, last, "|=", db); in parse_expression()
3202 if (t != first + 2) in parse_expression()
3203 first = t; in parse_expression()
3210 t = parse_binary_expression(first + 2, last, "->*", db); in parse_expression()
3211 if (t != first + 2) in parse_expression()
3212 first = t; in parse_expression()
3215 t = parse_binary_expression(first + 2, last, "+", db); in parse_expression()
3216 if (t != first + 2) in parse_expression()
3217 first = t; in parse_expression()
3220 t = parse_binary_expression(first + 2, last, "+=", db); in parse_expression()
3221 if (t != first + 2) in parse_expression()
3222 first = t; in parse_expression()
3225 if (first + 2 != last && first[2] == '_') { in parse_expression()
3226 t = parse_prefix_expression(first + 3, last, "++", db); in parse_expression()
3227 if (t != first + 3) in parse_expression()
3228 first = t; in parse_expression()
3230 const char *t1 = parse_expression(first + 2, last, db); in parse_expression()
3231 if (t1 != first + 2) { in parse_expression()
3233 return first; in parse_expression()
3235 first = t1; in parse_expression()
3240 t = parse_prefix_expression(first + 2, last, "+", db); in parse_expression()
3241 if (t != first + 2) in parse_expression()
3242 first = t; in parse_expression()
3245 first = parse_arrow_expr(first, last, db); in parse_expression()
3251 const char *t1 = parse_expression(first + 2, last, db); in parse_expression()
3252 if (t1 != first + 2) { in parse_expression()
3258 return first; in parse_expression()
3265 first = t3; in parse_expression()
3268 return first; in parse_expression()
3280 first = parse_reinterpret_cast_expr(first, last, db); in parse_expression()
3283 t = parse_binary_expression(first + 2, last, "%", db); in parse_expression()
3284 if (t != first + 2) in parse_expression()
3285 first = t; in parse_expression()
3288 t = parse_binary_expression(first + 2, last, "%=", db); in parse_expression()
3289 if (t != first + 2) in parse_expression()
3290 first = t; in parse_expression()
3293 t = parse_binary_expression(first + 2, last, ">>", db); in parse_expression()
3294 if (t != first + 2) in parse_expression()
3295 first = t; in parse_expression()
3298 t = parse_binary_expression(first + 2, last, ">>=", db); in parse_expression()
3299 if (t != first + 2) in parse_expression()
3300 first = t; in parse_expression()
3307 first = parse_static_cast_expr(first, last, db); in parse_expression()
3310 first = parse_pack_expansion(first, last, db); in parse_expression()
3313 return parse_unresolved_name(first, last, db); in parse_expression()
3315 first = parse_sizeof_type_expr(first, last, db); in parse_expression()
3318 first = parse_sizeof_expr_expr(first, last, db); in parse_expression()
3324 first = parse_sizeof_param_pack_expr(first, last, db); in parse_expression()
3327 first = parse_sizeof_function_param_pack_expr(first, last, db); in parse_expression()
3338 first = parse_typeid_expr(first, last, db); in parse_expression()
3342 first += 2; in parse_expression()
3345 first = parse_throw_expr(first, last, db); in parse_expression()
3358 return parse_unresolved_name(first, last, db); in parse_expression()
3361 return first; in parse_expression()
3376 static const char *parse_template_arg(const char *first, const char *last, in parse_template_arg() argument
3378 if (first != last) { in parse_template_arg()
3380 switch (*first) { in parse_template_arg()
3382 t = parse_expression(first + 1, last, db); in parse_template_arg()
3383 if (t != first + 1) { in parse_template_arg()
3385 first = t + 1; in parse_template_arg()
3389 t = first + 1; in parse_template_arg()
3391 return first; in parse_template_arg()
3395 return first; in parse_template_arg()
3398 first = t + 1; in parse_template_arg()
3402 if (first + 1 != last && first[1] == 'Z') { in parse_template_arg()
3403 t = parse_encoding(first + 2, last, db); in parse_template_arg()
3404 if (t != first + 2 && t != last && *t == 'E') in parse_template_arg()
3405 first = t + 1; in parse_template_arg()
3407 first = parse_expr_primary(first, last, db); in parse_template_arg()
3411 first = parse_type(first, last, db); in parse_template_arg()
3415 return first; in parse_template_arg()
3422 static const char *parse_template_args(const char *first, const char *last, in parse_template_args() argument
3424 if (last - first >= 2 && *first == 'I') { in parse_template_args()
3427 const char *t = first + 1; in parse_template_args()
3438 return first; in parse_template_args()
3454 first = t + 1; in parse_template_args()
3461 return first; in parse_template_args()
3483 static const char *parse_nested_name(const char *first, const char *last, C &db, in parse_nested_name() argument
3485 if (first != last && *first == 'N') { in parse_nested_name()
3487 const char *t0 = parse_cv_qualifiers(first + 1, last, cv); in parse_nested_name()
3489 return first; in parse_nested_name()
3501 db.names.back().first = "std"; in parse_nested_name()
3505 return first; in parse_nested_name()
3521 return first; in parse_nested_name()
3522 if (!db.names.back().first.empty()) { in parse_nested_name()
3523 db.names.back().first += "::" + name; in parse_nested_name()
3526 db.names.back().first = name; in parse_nested_name()
3530 return first; in parse_nested_name()
3538 return first; in parse_nested_name()
3539 if (!db.names.back().first.empty()) in parse_nested_name()
3540 db.names.back().first += "::" + name; in parse_nested_name()
3542 db.names.back().first = name; in parse_nested_name()
3547 return first; in parse_nested_name()
3557 return first; in parse_nested_name()
3558 if (!db.names.back().first.empty()) in parse_nested_name()
3559 db.names.back().first += "::" + name; in parse_nested_name()
3561 db.names.back().first = name; in parse_nested_name()
3566 return first; in parse_nested_name()
3574 return first; in parse_nested_name()
3575 db.names.back().first += name; in parse_nested_name()
3580 return first; in parse_nested_name()
3584 return first; in parse_nested_name()
3593 return first; in parse_nested_name()
3594 if (!db.names.back().first.empty()) in parse_nested_name()
3595 db.names.back().first += "::" + name; in parse_nested_name()
3597 db.names.back().first = name; in parse_nested_name()
3602 return first; in parse_nested_name()
3605 first = t0 + 1; in parse_nested_name()
3612 return first; in parse_nested_name()
3619 static const char *parse_discriminator(const char *first, const char *last) { in parse_discriminator() argument
3621 if (first != last) { in parse_discriminator()
3622 if (*first == '_') { in parse_discriminator()
3623 const char *t1 = first + 1; in parse_discriminator()
3626 first = t1 + 1; in parse_discriminator()
3631 first = t1 + 1; in parse_discriminator()
3634 } else if (std::isdigit(*first)) { in parse_discriminator()
3635 const char *t1 = first + 1; in parse_discriminator()
3639 first = last; in parse_discriminator()
3642 return first; in parse_discriminator()
3651 static const char *parse_local_name(const char *first, const char *last, C &db, in parse_local_name() argument
3653 if (first != last && *first == 'Z') { in parse_local_name()
3654 const char *t = parse_encoding(first + 1, last, db); in parse_local_name()
3655 if (t != first + 1 && t != last && *t == 'E' && ++t != last) { in parse_local_name()
3658 first = parse_discriminator(t + 1, last); in parse_local_name()
3660 return first; in parse_local_name()
3661 db.names.back().first.append("::string literal"); in parse_local_name()
3671 return first; in parse_local_name()
3675 return first; in parse_local_name()
3676 db.names.back().first.append("::"); in parse_local_name()
3677 db.names.back().first.append(name); in parse_local_name()
3678 first = t1; in parse_local_name()
3688 first = parse_discriminator(t1, last); in parse_local_name()
3690 return first; in parse_local_name()
3694 return first; in parse_local_name()
3695 db.names.back().first.append("::"); in parse_local_name()
3696 db.names.back().first.append(name); in parse_local_name()
3703 return first; in parse_local_name()
3715 static const char *parse_name(const char *first, const char *last, C &db, in parse_name() argument
3717 if (last - first >= 2) { in parse_name()
3718 const char *t0 = first; in parse_name()
3726 first = t1; in parse_name()
3732 first = t1; in parse_name()
3742 return first; in parse_name()
3748 return first; in parse_name()
3752 return first; in parse_name()
3753 db.names.back().first += tmp; in parse_name()
3754 first = t1; in parse_name()
3759 first = t1; in parse_name()
3767 return first; in parse_name()
3771 return first; in parse_name()
3772 db.names.back().first += tmp; in parse_name()
3773 first = t1; in parse_name()
3783 return first; in parse_name()
3795 static const char *parse_call_offset(const char *first, const char *last) { in parse_call_offset() argument
3796 if (first != last) { in parse_call_offset()
3797 switch (*first) { in parse_call_offset()
3799 const char *t = parse_number(first + 1, last); in parse_call_offset()
3800 if (t != first + 1 && t != last && *t == '_') in parse_call_offset()
3801 first = t + 1; in parse_call_offset()
3804 const char *t = parse_number(first + 1, last); in parse_call_offset()
3805 if (t != first + 1 && t != last && *t == '_') { in parse_call_offset()
3808 first = t2 + 1; in parse_call_offset()
3813 return first; in parse_call_offset()
3822 // # first call-offset is 'this' adjustment
3829 // extension ::= TC <first type> <number> _ <second type> # construction
3830 // vtable for second-in-first
3834 static const char *parse_special_name(const char *first, const char *last, in parse_special_name() argument
3836 if (last - first > 2) { in parse_special_name()
3838 switch (*first) { in parse_special_name()
3840 switch (first[1]) { in parse_special_name()
3843 t = parse_type(first + 2, last, db); in parse_special_name()
3844 if (t != first + 2) { in parse_special_name()
3846 return first; in parse_special_name()
3847 db.names.back().first.insert(0, "vtable for "); in parse_special_name()
3848 first = t; in parse_special_name()
3853 t = parse_type(first + 2, last, db); in parse_special_name()
3854 if (t != first + 2) { in parse_special_name()
3856 return first; in parse_special_name()
3857 db.names.back().first.insert(0, "VTT for "); in parse_special_name()
3858 first = t; in parse_special_name()
3863 t = parse_type(first + 2, last, db); in parse_special_name()
3864 if (t != first + 2) { in parse_special_name()
3866 return first; in parse_special_name()
3867 db.names.back().first.insert(0, "typeinfo for "); in parse_special_name()
3868 first = t; in parse_special_name()
3873 t = parse_type(first + 2, last, db); in parse_special_name()
3874 if (t != first + 2) { in parse_special_name()
3876 return first; in parse_special_name()
3877 db.names.back().first.insert(0, "typeinfo name for "); in parse_special_name()
3878 first = t; in parse_special_name()
3884 const char *t0 = parse_call_offset(first + 2, last); in parse_special_name()
3885 if (t0 == first + 2) in parse_special_name()
3893 return first; in parse_special_name()
3894 db.names.back().first.insert(0, "covariant return thunk to "); in parse_special_name()
3895 first = t; in parse_special_name()
3900 // extension ::= TC <first type> <number> _ <second type> # construction in parse_special_name()
3901 // vtable for second-in-first in parse_special_name()
3902 t = parse_type(first + 2, last, db); in parse_special_name()
3903 if (t != first + 2) { in parse_special_name()
3909 return first; in parse_special_name()
3913 return first; in parse_special_name()
3914 db.names.back().first = "construction vtable for " + in parse_special_name()
3917 first = t1; in parse_special_name()
3925 const char *t0 = parse_call_offset(first + 1, last); in parse_special_name()
3926 if (t0 == first + 1) in parse_special_name()
3931 return first; in parse_special_name()
3932 if (first[1] == 'v') { in parse_special_name()
3933 db.names.back().first.insert(0, "virtual thunk to "); in parse_special_name()
3934 first = t; in parse_special_name()
3936 db.names.back().first.insert(0, "non-virtual thunk to "); in parse_special_name()
3937 first = t; in parse_special_name()
3945 switch (first[1]) { in parse_special_name()
3948 t = parse_name(first + 2, last, db); in parse_special_name()
3949 if (t != first + 2) { in parse_special_name()
3951 return first; in parse_special_name()
3952 db.names.back().first.insert(0, "guard variable for "); in parse_special_name()
3953 first = t; in parse_special_name()
3958 t = parse_name(first + 2, last, db); in parse_special_name()
3959 if (t != first + 2) { in parse_special_name()
3961 return first; in parse_special_name()
3962 db.names.back().first.insert(0, "reference temporary for "); in parse_special_name()
3963 first = t; in parse_special_name()
3970 return first; in parse_special_name()
3993 static const char *parse_encoding(const char *first, const char *last, C &db) { in parse_encoding() argument
3994 if (first != last) { in parse_encoding()
4000 switch (*first) { in parse_encoding()
4003 first = parse_special_name(first, last, db); in parse_encoding()
4007 const char *t = parse_name(first, last, db, &ends_with_template_args); in parse_encoding()
4010 if (t != first) { in parse_encoding()
4017 return first; in parse_encoding()
4018 const std::string &nm = db.names.back().first; in parse_encoding()
4020 return first; in parse_encoding()
4024 return first; in parse_encoding()
4026 return first; in parse_encoding()
4027 auto ret1 = std::move(db.names.back().first); in parse_encoding()
4033 return first; in parse_encoding()
4035 db.names.back().first.insert(0, ret1); in parse_encoding()
4038 db.names.back().first += '('; in parse_encoding()
4058 return first; in parse_encoding()
4063 return first; in parse_encoding()
4065 db.names.back().first += ", "; in parse_encoding()
4068 db.names.back().first += tmp; in parse_encoding()
4075 return first; in parse_encoding()
4076 db.names.back().first += ')'; in parse_encoding()
4078 db.names.back().first.append(" const"); in parse_encoding()
4080 db.names.back().first.append(" volatile"); in parse_encoding()
4082 db.names.back().first.append(" restrict"); in parse_encoding()
4084 db.names.back().first.append(" &"); in parse_encoding()
4086 db.names.back().first.append(" &&"); in parse_encoding()
4087 db.names.back().first += ret2; in parse_encoding()
4088 first = t; in parse_encoding()
4090 first = t; in parse_encoding()
4096 return first; in parse_encoding()
4104 static const char *parse_block_invoke(const char *first, const char *last, in parse_block_invoke() argument
4106 if (last - first >= 13) { in parse_block_invoke()
4108 const char *t = first; in parse_block_invoke()
4111 return first; in parse_block_invoke()
4117 return first; in parse_block_invoke()
4125 return first; in parse_block_invoke()
4126 db.names.back().first.insert(0, "invocation function for block in "); in parse_block_invoke()
4127 first = t; in parse_block_invoke()
4129 return first; in parse_block_invoke()
4136 static const char *parse_dot_suffix(const char *first, const char *last, in parse_dot_suffix() argument
4138 if (first != last && *first == '.') { in parse_dot_suffix()
4140 return first; in parse_dot_suffix()
4141 db.names.back().first += " (" + std::string(first, last) + ")"; in parse_dot_suffix()
4142 first = last; in parse_dot_suffix()
4144 return first; in parse_dot_suffix()
4154 static void demangle(const char *first, const char *last, C &db, int &status) { in demangle() argument
4155 if (first >= last) { in demangle()
4159 if (*first == '_') { in demangle()
4160 if (last - first >= 4) { in demangle()
4161 if (first[1] == 'Z') { in demangle()
4162 const char *t = parse_encoding(first + 2, last, db); in demangle()
4163 if (t != first + 2 && t != last && *t == '.') in demangle()
4167 } else if (first[1] == '_' && first[2] == '_' && first[3] == 'Z') { in demangle()
4168 const char *t = parse_encoding(first + 4, last, db); in demangle()
4169 if (t != first + 4 && t != last) { in demangle()
4180 const char *t = parse_type(first, last, db); in demangle()
4190 StrT first; member
4194 string_pair(StrT f) : first(std::move(f)) {} in string_pair()
4195 string_pair(StrT f, StrT s) : first(std::move(f)), second(std::move(s)) {} in string_pair()
4196 template <size_t N> string_pair(const char (&s)[N]) : first(s, N - 1) {} in string_pair()
4198 size_t size() const { return first.size() + second.size(); } in size()
4199 StrT full() const { return first + second; } in full()
4200 StrT move_full() { return std::move(first) + std::move(second); } in move_full()
4267 db.names.back().first += db.names.back().second; in itaniumDemangle()
4268 std::memcpy(buf, db.names.back().first.data(), sz - 1); in itaniumDemangle()