From: Owen Avery Date: Tue, 12 Sep 2023 16:52:25 +0000 (-0400) Subject: gccrs: Memoize Backend::wchar_type X-Git-Tag: basepoints/gcc-15~2125 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a05079fa6c7ef8a7d11f988164367f8a3588d0e9;p=thirdparty%2Fgcc.git gccrs: Memoize Backend::wchar_type gcc/rust/ChangeLog: * rust-gcc.cc (Backend::wchar_type): Store static wchar tree. Signed-off-by: Owen Avery --- diff --git a/gcc/rust/rust-gcc.cc b/gcc/rust/rust-gcc.cc index be6e4ae5498f..73c966a3320c 100644 --- a/gcc/rust/rust-gcc.cc +++ b/gcc/rust/rust-gcc.cc @@ -345,8 +345,14 @@ get_identifier_node (const std::string &str) tree wchar_type () { - tree wchar = make_unsigned_type (32); - TYPE_STRING_FLAG (wchar) = 1; + static tree wchar; + + if (wchar == NULL_TREE) + { + wchar = make_unsigned_type (32); + TYPE_STRING_FLAG (wchar) = 1; + } + return wchar; }