public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] typecheck: add is_primitive_type_kind helper
@ 2022-06-08 12:46 Thomas Schwinge
0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2022-06-08 12:46 UTC (permalink / raw)
To: gcc-cvs
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:
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-06-08 12:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-08 12:46 [gcc/devel/rust/master] typecheck: add is_primitive_type_kind helper Thomas Schwinge
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).