public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Thomas Schwinge <tschwinge@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/rust/master] typecheck: add is_primitive_type_kind helper Date: Wed, 8 Jun 2022 12:46:15 +0000 (GMT) [thread overview] Message-ID: <20220608124615.C6832381D4B1@sourceware.org> (raw) https://gcc.gnu.org/g:502c8a859750064103bb71f4d559cef7b1c1b8af commit 502c8a859750064103bb71f4d559cef7b1c1b8af Author: David Faust <david.faust@oracle.com> Date: Tue May 10 11:19:40 2022 -0700 typecheck: add is_primitive_type_kind helper Diff: --- gcc/rust/typecheck/rust-tyty.cc | 20 ++++++++++++++++++++ gcc/rust/typecheck/rust-tyty.h | 3 +++ 2 files changed, 23 insertions(+) diff --git a/gcc/rust/typecheck/rust-tyty.cc b/gcc/rust/typecheck/rust-tyty.cc index 6b034ea63a7..d0e8b761622 100644 --- a/gcc/rust/typecheck/rust-tyty.cc +++ b/gcc/rust/typecheck/rust-tyty.cc @@ -113,6 +113,26 @@ TypeKindFormat::to_string (TypeKind kind) gcc_unreachable (); } +bool +is_primitive_type_kind (TypeKind kind) +{ + switch (kind) + { + case TypeKind::BOOL: + case TypeKind::CHAR: + case TypeKind::INT: + case TypeKind::UINT: + case TypeKind::ISIZE: + case TypeKind::USIZE: + case TypeKind::FLOAT: + case TypeKind::NEVER: + case TypeKind::STR: + return true; + default: + return false; + } +} + bool BaseType::satisfies_bound (const TypeBoundPredicate &predicate) const { diff --git a/gcc/rust/typecheck/rust-tyty.h b/gcc/rust/typecheck/rust-tyty.h index 5f35c320a5f..a2950e97b56 100644 --- a/gcc/rust/typecheck/rust-tyty.h +++ b/gcc/rust/typecheck/rust-tyty.h @@ -67,6 +67,9 @@ enum TypeKind ERROR }; +extern bool +is_primitive_type_kind (TypeKind kind); + class TypeKindFormat { public:
reply other threads:[~2022-06-08 12:46 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=20220608124615.C6832381D4B1@sourceware.org \ --to=tschwinge@gcc.gnu.org \ --cc=gcc-cvs@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: linkBe 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).