public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-2203] dwarf2: use DW_ATE_UTF for char8_t
@ 2022-08-25 21:03 Jason Merrill
  0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2022-08-25 21:03 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:30e160475489867a09ed89532cae135b5849cf98

commit r13-2203-g30e160475489867a09ed89532cae135b5849cf98
Author: Jason Merrill <jason@redhat.com>
Date:   Wed Aug 24 16:31:04 2022 -0400

    dwarf2: use DW_ATE_UTF for char8_t
    
    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.

Diff:
---
 gcc/dwarf2out.cc                          | 1 +
 gcc/testsuite/g++.dg/debug/dwarf2/utf-1.C | 9 +++++++++
 2 files changed, 10 insertions(+)

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;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-08-25 21:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-25 21:03 [gcc r13-2203] dwarf2: use DW_ATE_UTF for char8_t Jason Merrill

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).