aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbtypes.c
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2002-02-03 22:57:56 +0000
committerDaniel Jacobowitz <drow@false.org>2002-02-03 22:57:56 +0000
commitdd6bda650aa787d14496b8dc397895011faded80 (patch)
treeb1558c6016061f47715a53633ca2d051a9c8a391 /gdb/gdbtypes.c
parent88fe217c0b62e1905644d6eade1de32c22d2e735 (diff)
downloadgdb-dd6bda650aa787d14496b8dc397895011faded80.zip
gdb-dd6bda650aa787d14496b8dc397895011faded80.tar.gz
gdb-dd6bda650aa787d14496b8dc397895011faded80.tar.bz2
2002-02-01 Daniel Jacobowitz <drow@mvista.com>
PR gdb/280 * gdbtypes.c (replace_type): New function. * gdbtypes.h (replace_type): Add prototype. * stabsread.c (read_type): Use replace_type.
Diffstat (limited to 'gdb/gdbtypes.c')
-rw-r--r--gdb/gdbtypes.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index b6de34c..435718f 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -519,6 +519,32 @@ finish_cv_type (struct type *type)
}
}
+/* Replace the contents of ntype with the type *type.
+
+ This function should not be necessary, but is due to quirks in the stabs
+ reader. This should go away. It does not handle the replacement type
+ being cv-qualified; it could be easily fixed to, but it should go away,
+ remember? */
+void
+replace_type (struct type *ntype, struct type *type)
+{
+ struct type *cv_chain, *as_chain, *ptr, *ref;
+
+ cv_chain = TYPE_CV_TYPE (ntype);
+ as_chain = TYPE_AS_TYPE (ntype);
+ ptr = TYPE_POINTER_TYPE (ntype);
+ ref = TYPE_REFERENCE_TYPE (ntype);
+
+ *ntype = *type;
+
+ TYPE_POINTER_TYPE (ntype) = ptr;
+ TYPE_REFERENCE_TYPE (ntype) = ref;
+ TYPE_CV_TYPE (ntype) = cv_chain;
+ TYPE_AS_TYPE (ntype) = as_chain;
+
+ finish_cv_type (ntype);
+}
+
/* Implement direct support for MEMBER_TYPE in GNU C++.
May need to construct such a type if this is the first use.
The TYPE is the type of the member. The DOMAIN is the type