[v2,04/14] add make_unqualified_type

Message ID 1403279874-23781-5-git-send-email-tromey@redhat.com
State New, archived
Headers

Commit Message

Tom Tromey June 20, 2014, 3:57 p.m. UTC
  There's seemingly no function to get the unqualified variant of a
type, so this patch adds one.  This new function will be used in the
final patch.

2014-06-20  Tom Tromey  <tromey@redhat.com>

	* gdbtypes.h (make_unqualified_type): Declare.
	* gdbtypes.c (make_unqualified_type): New function.
---
 gdb/ChangeLog  |  5 +++++
 gdb/gdbtypes.c | 13 +++++++++++++
 gdb/gdbtypes.h |  2 ++
 3 files changed, 20 insertions(+)
  

Patch

diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index d0c002f..453342a 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -706,6 +706,19 @@  make_restrict_type (struct type *type)
 			      NULL);
 }
 
+/* Make a type without const, volatile, or restrict.  */
+
+struct type *
+make_unqualified_type (struct type *type)
+{
+  return make_qualified_type (type,
+			      (TYPE_INSTANCE_FLAGS (type)
+			       & ~(TYPE_INSTANCE_FLAG_CONST
+				   | TYPE_INSTANCE_FLAG_VOLATILE
+				   | TYPE_INSTANCE_FLAG_RESTRICT)),
+			      NULL);
+}
+
 /* Replace the contents of ntype with the type *type.  This changes the
    contents, rather than the pointer for TYPE_MAIN_TYPE (ntype); thus
    the changes are propogated to all types in the TYPE_CHAIN.
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index bb6352d..3303c13 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -1627,6 +1627,8 @@  extern struct type *make_cv_type (int, int, struct type *, struct type **);
 
 extern struct type *make_restrict_type (struct type *);
 
+extern struct type *make_unqualified_type (struct type *);
+
 extern void replace_type (struct type *, struct type *);
 
 extern int address_space_name_to_int (struct gdbarch *, char *);