added is_type_enum()
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Sun, 31 Aug 2008 10:54:54 +0000 (10:54 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Sun, 31 Aug 2008 10:54:54 +0000 (10:54 +0000)
[r21575]

type.c
type.h

diff --git a/type.c b/type.c
index aaefda1..ed046c1 100644 (file)
--- a/type.c
+++ b/type.c
@@ -774,6 +774,18 @@ bool is_type_integer(const type_t *type)
        return test_atomic_type_flag(type->atomic.akind, ATOMIC_TYPE_FLAG_INTEGER);
 }
 
+/**
+ * Returns true if the given type is an enum type.
+ *
+ * @param type  The type to check.
+ * @return True if type is an enum type.
+ */
+bool is_type_enum(const type_t *type)
+{
+       assert(!is_typeref(type));
+       return type->kind == TYPE_ENUM;
+}
+
 /**
  * Returns true if the given type is an floating point type.
  *
@@ -837,6 +849,12 @@ bool is_type_arithmetic(const type_t *type)
        }
 }
 
+/**
+ * Returns true if the given type is an integer or float type.
+ *
+ * @param type  The type to check.
+ * @return True if type is an integer or float type.
+ */
 bool is_type_real(const type_t *type)
 {
        /* 6.2.5.17 */
diff --git a/type.h b/type.h
index 64d1742..1e6f13b 100644 (file)
--- a/type.h
+++ b/type.h
@@ -117,6 +117,11 @@ void inc_type_visited(void);
  */
 bool is_type_integer(const type_t *type);
 
+/**
+ * Returns true if the given type is an enum type.
+ */
+bool is_type_enum(const type_t *type);
+
 /**
  * return true if type contains signed numbers
  */