extern ssize_t ctf_type_size (ctf_file_t *, ctf_id_t);
extern ssize_t ctf_type_align (ctf_file_t *, ctf_id_t);
extern int ctf_type_kind (ctf_file_t *, ctf_id_t);
+extern int ctf_type_kind_forwarded (ctf_file_t *, ctf_id_t);
extern ctf_id_t ctf_type_reference (ctf_file_t *, ctf_id_t);
extern ctf_id_t ctf_type_pointer (ctf_file_t *, ctf_id_t);
extern int ctf_type_encoding (ctf_file_t *, ctf_id_t, ctf_encoding_t *);
return kind;
}
+/* Return the kind of this type, except, for forwards, return the kind of thing
+ this is a forward to. */
+int
+ctf_type_kind_forwarded (ctf_file_t *fp, ctf_id_t type)
+{
+ int kind;
+ const ctf_type_t *tp;
+
+ if ((kind = ctf_type_kind (fp, type)) < 0)
+ return -1; /* errno is set for us. */
+
+ if (kind != CTF_K_FORWARD)
+ return kind;
+
+ if ((tp = ctf_lookup_by_id (&fp, type)) == NULL)
+ return -1; /* errno is set for us. */
+
+ return tp->ctt_type;
+}
+
/* If the type is one that directly references another type (such as POINTER),
then return the ID of the type to which it refers. */