diff options
author | Patrick Palka <ppalka@redhat.com> | 2023-06-03 09:03:27 -0400 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2023-06-03 09:03:27 -0400 |
commit | 999e617d3121b82921c8031ee695fd036f553f04 (patch) | |
tree | 1f8957c6a5818113623ea80228eeb55cb1480b82 /libiberty | |
parent | 38e88d41f50d844f1404172657ef7e8372014ef6 (diff) | |
download | gcc-999e617d3121b82921c8031ee695fd036f553f04.zip gcc-999e617d3121b82921c8031ee695fd036f553f04.tar.gz gcc-999e617d3121b82921c8031ee695fd036f553f04.tar.bz2 |
c++: mangle noexcept-expr [PR70790]
This implements noexcept(expr) mangling and demangling as per the
Itanium ABI.
PR c++/70790
gcc/cp/ChangeLog:
* mangle.cc (write_expression): Handle NOEXCEPT_EXPR.
libiberty/ChangeLog:
* cp-demangle.c (cplus_demangle_operators): Add the noexcept
operator.
(d_print_comp_inner) <case DEMANGLE_COMPONENT_UNARY>: Always
print parens around the operand of noexcept too.
* testsuite/demangle-expected: Test noexcept operator
demangling.
gcc/testsuite/ChangeLog:
* g++.dg/abi/mangle78.C: New test.
Diffstat (limited to 'libiberty')
-rw-r--r-- | libiberty/cp-demangle.c | 5 | ||||
-rw-r--r-- | libiberty/testsuite/demangle-expected | 3 |
2 files changed, 6 insertions, 2 deletions
diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index f2b36bc..18ab28f 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -1947,6 +1947,7 @@ const struct demangle_operator_info cplus_demangle_operators[] = { "ng", NL ("-"), 1 }, { "nt", NL ("!"), 1 }, { "nw", NL ("new"), 3 }, + { "nx", NL ("noexcept"), 1 }, { "oR", NL ("|="), 2 }, { "oo", NL ("||"), 2 }, { "or", NL ("|"), 2 }, @@ -5836,8 +5837,8 @@ d_print_comp_inner (struct d_print_info *dpi, int options, if (code && !strcmp (code, "gs")) /* Avoid parens after '::'. */ d_print_comp (dpi, options, operand); - else if (code && !strcmp (code, "st")) - /* Always print parens for sizeof (type). */ + else if (code && (!strcmp (code, "st") || !strcmp (code, "nx"))) + /* Always print parens for sizeof (type) and noexcept(expr). */ { d_append_char (dpi, '('); d_print_comp (dpi, options, operand); diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected index d9bc7ed..52dff88 100644 --- a/libiberty/testsuite/demangle-expected +++ b/libiberty/testsuite/demangle-expected @@ -1659,3 +1659,6 @@ auto f()::{lambda<typename $T0>(X<$T0>*, X<int>*)#1}::operator()<char>(X<char>*, _ZZN1XIiE1FEvENKUliE_clEi X<int>::F()::{lambda(int)#1}::operator()(int) const + +_Z1fIiEv1AIXnxtlT_EEE +void f<int>(A<noexcept(int{})>) |