llvm.org GIT mirror llvm / 902878b
Demangle: remove references to allocator for default allocator The demangler had stopped using a custom allocator but had not been updated to remove the use of the explicit allocator passing. This removes that as we do not need to do anything special here anymore. This just makes the code more compact. NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287472 91177308-0d34-0410-b5e6-96231b3b80d8 Saleem Abdulrasool 2 years ago
1 changed file(s) with 29 addition(s) and 50 deletion(s). Raw diff Collapse all Expand all
830830 t = parse_template_param(first, last, db);
831831 size_t k1 = db.names.size();
832832 if (t != first && k1 == k0 + 1) {
833 db.subs.push_back(
834 typename C::sub_type(1, db.names.back(), db.names.get_allocator()));
833 db.subs.push_back(typename C::sub_type(1, db.names.back()));
835834 first = t;
836835 } else {
837836 for (; k1 != k0; --k1)
844843 if (t != first) {
845844 if (db.names.empty())
846845 return first;
847 db.subs.push_back(
848 typename C::sub_type(1, db.names.back(), db.names.get_allocator()));
846 db.subs.push_back(typename C::sub_type(1, db.names.back()));
849847 first = t;
850848 }
851849 break;
860858 if (db.names.empty())
861859 return first;
862860 db.names.back().first.insert(0, "std::");
863 db.subs.push_back(typename C::sub_type(1, db.names.back(),
864 db.names.get_allocator()));
861 db.subs.push_back(typename C::sub_type(1, db.names.back()));
865862 first = t;
866863 }
867864 }
16621659 if (t1 != t) {
16631660 if (is_function)
16641661 db.subs.pop_back();
1665 db.subs.emplace_back(db.names.get_allocator());
1662 db.subs.emplace_back();
16661663 for (size_t k = k0; k < k1; ++k) {
16671664 if (is_function) {
16681665 size_t p = db.names[k].second.size();
17061703 if (db.names.empty())
17071704 return first;
17081705 first = t;
1709 db.subs.push_back(typename C::sub_type(1, db.names.back(),
1710 db.names.get_allocator()));
1706 db.subs.push_back(typename C::sub_type(1, db.names.back()));
17111707 }
17121708 break;
17131709 case 'C':
17171713 return first;
17181714 db.names.back().first.append(" complex");
17191715 first = t;
1720 db.subs.push_back(typename C::sub_type(1, db.names.back(),
1721 db.names.get_allocator()));
1716 db.subs.push_back(typename C::sub_type(1, db.names.back()));
17221717 }
17231718 break;
17241719 case 'F':
17271722 if (db.names.empty())
17281723 return first;
17291724 first = t;
1730 db.subs.push_back(typename C::sub_type(1, db.names.back(),
1731 db.names.get_allocator()));
1725 db.subs.push_back(typename C::sub_type(1, db.names.back()));
17321726 }
17331727 break;
17341728 case 'G':
17381732 return first;
17391733 db.names.back().first.append(" imaginary");
17401734 first = t;
1741 db.subs.push_back(typename C::sub_type(1, db.names.back(),
1742 db.names.get_allocator()));
1735 db.subs.push_back(typename C::sub_type(1, db.names.back()));
17431736 }
17441737 break;
17451738 case 'M':
17481741 if (db.names.empty())
17491742 return first;
17501743 first = t;
1751 db.subs.push_back(typename C::sub_type(1, db.names.back(),
1752 db.names.get_allocator()));
1744 db.subs.push_back(typename C::sub_type(1, db.names.back()));
17531745 }
17541746 break;
17551747 case 'O': {
17571749 t = parse_type(first + 1, last, db);
17581750 size_t k1 = db.names.size();
17591751 if (t != first + 1) {
1760 db.subs.emplace_back(db.names.get_allocator());
1752 db.subs.emplace_back();
17611753 for (size_t k = k0; k < k1; ++k) {
17621754 if (db.names[k].second.substr(0, 2) == " [") {
17631755 db.names[k].first += " (";
17791771 t = parse_type(first + 1, last, db);
17801772 size_t k1 = db.names.size();
17811773 if (t != first + 1) {
1782 db.subs.emplace_back(db.names.get_allocator());
1774 db.subs.emplace_back();
17831775 for (size_t k = k0; k < k1; ++k) {
17841776 if (db.names[k].second.substr(0, 2) == " [") {
17851777 db.names[k].first += " (";
18061798 t = parse_type(first + 1, last, db);
18071799 size_t k1 = db.names.size();
18081800 if (t != first + 1) {
1809 db.subs.emplace_back(db.names.get_allocator());
1801 db.subs.emplace_back();
18101802 for (size_t k = k0; k < k1; ++k) {
18111803 if (db.names[k].second.substr(0, 2) == " [") {
18121804 db.names[k].first += " (";
18281820 t = parse_template_param(first, last, db);
18291821 size_t k1 = db.names.size();
18301822 if (t != first) {
1831 db.subs.emplace_back(db.names.get_allocator());
1823 db.subs.emplace_back();
18321824 for (size_t k = k0; k < k1; ++k)
18331825 db.subs.back().push_back(db.names[k]);
18341826 if (db.try_to_parse_template_args && k1 == k0 + 1) {
18371829 auto args = db.names.back().move_full();
18381830 db.names.pop_back();
18391831 db.names.back().first += std::move(args);
1840 db.subs.push_back(typename C::sub_type(
1841 1, db.names.back(), db.names.get_allocator()));
1832 db.subs.push_back(typename C::sub_type(1, db.names.back()));
18421833 t = t1;
18431834 }
18441835 }
18701861 db.names.push_back(type + " " + proto);
18711862 }
18721863 }
1873 db.subs.push_back(typename C::sub_type(
1874 1, db.names.back(), db.names.get_allocator()));
1864 db.subs.push_back(typename C::sub_type(1, db.names.back()));
18751865 first = t2;
18761866 }
18771867 }
18831873 if (t != first) {
18841874 if (db.names.empty())
18851875 return first;
1886 db.subs.push_back(typename C::sub_type(1, db.names.back(),
1887 db.names.get_allocator()));
1876 db.subs.push_back(typename C::sub_type(1, db.names.back()));
18881877 first = t;
18891878 }
18901879 } else {
19021891 db.names.back().first += template_args;
19031892 // Need to create substitution for
19041893 //
1905 db.subs.push_back(typename C::sub_type(
1906 1, db.names.back(), db.names.get_allocator()));
1894 db.subs.push_back(typename C::sub_type(1, db.names.back()));
19071895 first = t;
19081896 }
19091897 }
19171905 t = parse_type(first + 2, last, db);
19181906 size_t k1 = db.names.size();
19191907 if (t != first + 2) {
1920 db.subs.emplace_back(db.names.get_allocator());
1908 db.subs.emplace_back();
19211909 for (size_t k = k0; k < k1; ++k)
19221910 db.subs.back().push_back(db.names[k]);
19231911 first = t;
19311919 if (t != first) {
19321920 if (db.names.empty())
19331921 return first;
1934 db.subs.push_back(typename C::sub_type(
1935 1, db.names.back(), db.names.get_allocator()));
1922 db.subs.push_back(typename C::sub_type(1, db.names.back()));
19361923 first = t;
19371924 return first;
19381925 }
19421929 if (t != first) {
19431930 if (db.names.empty())
19441931 return first;
1945 db.subs.push_back(typename C::sub_type(
1946 1, db.names.back(), db.names.get_allocator()));
1932 db.subs.push_back(typename C::sub_type(1, db.names.back()));
19471933 first = t;
19481934 return first;
19491935 }
19621948 if (t != first) {
19631949 if (db.names.empty())
19641950 return first;
1965 db.subs.push_back(typename C::sub_type(1, db.names.back(),
1966 db.names.get_allocator()));
1951 db.subs.push_back(typename C::sub_type(1, db.names.back()));
19671952 first = t;
19681953 }
19691954 }
34423427 std::string args("<");
34433428 while (*t != 'E') {
34443429 if (db.tag_templates)
3445 db.template_param.emplace_back(db.names.get_allocator());
3430 db.template_param.emplace_back();
34463431 size_t k0 = db.names.size();
34473432 const char *t1 = parse_template_arg(t, last, db);
34483433 size_t k1 = db.names.size();
34513436 if (t1 == t || t1 == last)
34523437 return first;
34533438 if (db.tag_templates) {
3454 db.template_param.back().emplace_back(db.names.get_allocator());
3439 db.template_param.back().emplace_back();
34553440 for (size_t k = k0; k < k1; ++k)
34563441 db.template_param.back().back().push_back(db.names[k]);
34573442 }
35353520 return first;
35363521 if (!db.names.back().first.empty()) {
35373522 db.names.back().first += "::" + name;
3538 db.subs.push_back(typename C::sub_type(1, db.names.back(),
3539 db.names.get_allocator()));
3523 db.subs.push_back(typename C::sub_type(1, db.names.back()));
35403524 } else
35413525 db.names.back().first = name;
35423526 pop_subs = true;
35553539 db.names.back().first += "::" + name;
35563540 else
35573541 db.names.back().first = name;
3558 db.subs.push_back(typename C::sub_type(1, db.names.back(),
3559 db.names.get_allocator()));
3542 db.subs.push_back(typename C::sub_type(1, db.names.back()));
35603543 pop_subs = true;
35613544 t0 = t1;
35623545 } else
35753558 db.names.back().first += "::" + name;
35763559 else
35773560 db.names.back().first = name;
3578 db.subs.push_back(typename C::sub_type(1, db.names.back(),
3579 db.names.get_allocator()));
3561 db.subs.push_back(typename C::sub_type(1, db.names.back()));
35803562 pop_subs = true;
35813563 t0 = t1;
35823564 } else
35903572 if (db.names.empty())
35913573 return first;
35923574 db.names.back().first += name;
3593 db.subs.push_back(typename C::sub_type(1, db.names.back(),
3594 db.names.get_allocator()));
3575 db.subs.push_back(typename C::sub_type(1, db.names.back()));
35953576 t0 = t1;
35963577 component_ends_with_template_args = true;
35973578 } else
36133594 db.names.back().first += "::" + name;
36143595 else
36153596 db.names.back().first = name;
3616 db.subs.push_back(typename C::sub_type(1, db.names.back(),
3617 db.names.get_allocator()));
3597 db.subs.push_back(typename C::sub_type(1, db.names.back()));
36183598 pop_subs = true;
36193599 t0 = t1;
36203600 } else
37593739 {
37603740 if (db.names.empty())
37613741 return first;
3762 db.subs.push_back(typename C::sub_type(1, db.names.back(),
3763 db.names.get_allocator()));
3742 db.subs.push_back(typename C::sub_type(1, db.names.back()));
37643743 t0 = t1;
37653744 t1 = parse_template_args(t0, last, db);
37663745 if (t1 != t0) {