diff options
author | Owen Avery <powerboat9.gamer@gmail.com> | 2023-09-12 12:52:25 -0400 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-01-16 19:04:36 +0100 |
commit | a05079fa6c7ef8a7d11f988164367f8a3588d0e9 (patch) | |
tree | e00d8b807537a779144e30274270c8165e3726f9 /gcc | |
parent | bf6fcd8790588d81c3634d4075691b8ac28135b4 (diff) | |
download | gcc-a05079fa6c7ef8a7d11f988164367f8a3588d0e9.zip gcc-a05079fa6c7ef8a7d11f988164367f8a3588d0e9.tar.gz gcc-a05079fa6c7ef8a7d11f988164367f8a3588d0e9.tar.bz2 |
gccrs: Memoize Backend::wchar_type
gcc/rust/ChangeLog:
* rust-gcc.cc
(Backend::wchar_type): Store static wchar tree.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/rust-gcc.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/rust/rust-gcc.cc b/gcc/rust/rust-gcc.cc index be6e4ae..73c966a 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; } |