From: Jason Merrill <jason@redhat.com>
To: gcc-patches@gcc.gnu.org
Subject: [pushed] dwarf2: use DW_ATE_UTF for C++ char8_t
Date: Thu, 25 Aug 2022 17:02:47 -0400 [thread overview]
Message-ID: <20220825210247.2217333-1-jason@redhat.com> (raw)
While looking at the Rust changes to dwarf2out I noticed that this was
missing from the char8_t support.
gcc/ChangeLog:
* dwarf2out.cc (base_type_die): Also use DW_ATE_UTF for char8_t.
gcc/testsuite/ChangeLog:
* g++.dg/debug/dwarf2/utf-1.C: New test.
---
gcc/dwarf2out.cc | 1 +
gcc/testsuite/g++.dg/debug/dwarf2/utf-1.C | 9 +++++++++
2 files changed, 10 insertions(+)
create mode 100644 gcc/testsuite/g++.dg/debug/dwarf2/utf-1.C
diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc
index e3920c898f5..28a4ae08fe4 100644
--- a/gcc/dwarf2out.cc
+++ b/gcc/dwarf2out.cc
@@ -13210,6 +13210,7 @@ base_type_die (tree type, bool reverse)
{
const char *name = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)));
if (strcmp (name, "char16_t") == 0
+ || strcmp (name, "char8_t") == 0
|| strcmp (name, "char32_t") == 0)
{
encoding = DW_ATE_UTF;
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/utf-1.C b/gcc/testsuite/g++.dg/debug/dwarf2/utf-1.C
new file mode 100644
index 00000000000..43b354f1bb5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/utf-1.C
@@ -0,0 +1,9 @@
+// { dg-do compile { target c++20 } }
+// { dg-options { -gdwarf -dA } }
+
+// Test that all three use DW_ATE_UTF.
+// { dg-final { scan-assembler-times {DW_AT_encoding \(0x10\)} 3 } }
+
+char8_t c8;
+char16_t c16;
+char32_t c32;
base-commit: 585a21bab3ec688c2039bff2922cc372d8558283
--
2.31.1
reply other threads:[~2022-08-25 21:02 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220825210247.2217333-1-jason@redhat.com \
--to=jason@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).