aboutsummaryrefslogtreecommitdiff
path: root/gdb/cp-support.c
diff options
context:
space:
mode:
authorKeith Seitz <keiths@redhat.com>2013-11-13 12:33:34 -0800
committerKeith Seitz <keiths@redhat.com>2013-11-13 12:33:34 -0800
commit74921315b6734554793a37f7a152878c45b7d4ac (patch)
treebb2e70a9c14020eb5f9649202abc23f5e332e95b /gdb/cp-support.c
parent793156e67263707a4184321d9154dea6ad99575a (diff)
downloadgdb-74921315b6734554793a37f7a152878c45b7d4ac.zip
gdb-74921315b6734554793a37f7a152878c45b7d4ac.tar.gz
gdb-74921315b6734554793a37f7a152878c45b7d4ac.tar.bz2
PR c++/7539
PR c++/10541 This patch fixes some namespace alias bugs reported in the above bugs. Links to all mailing list discussion: https://sourceware.org/ml/gdb-patches/2013-07/msg00649.html https://sourceware.org/ml/gdb-patches/2013-09/msg00557.html https://sourceware.org/ml/gdb-patches/2013-11/msg00156.html
Diffstat (limited to 'gdb/cp-support.c')
-rw-r--r--gdb/cp-support.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/gdb/cp-support.c b/gdb/cp-support.c
index 86f19de..b91bcdc 100644
--- a/gdb/cp-support.c
+++ b/gdb/cp-support.c
@@ -198,8 +198,9 @@ inspect_type (struct demangle_parse_info *info,
return 0;
}
- /* If the type is a typedef, replace it. */
- if (TYPE_CODE (otype) == TYPE_CODE_TYPEDEF)
+ /* If the type is a typedef or namespace alias, replace it. */
+ if (TYPE_CODE (otype) == TYPE_CODE_TYPEDEF
+ || TYPE_CODE (otype) == TYPE_CODE_NAMESPACE)
{
long len;
int is_anon;
@@ -210,6 +211,13 @@ inspect_type (struct demangle_parse_info *info,
/* Get the real type of the typedef. */
type = check_typedef (otype);
+ /* If the symbol is a namespace and its type name is no different
+ than the name we looked up, this symbol is not a namespace
+ alias and does not need to be substituted. */
+ if (TYPE_CODE (otype) == TYPE_CODE_NAMESPACE
+ && strcmp (TYPE_NAME (type), name) == 0)
+ return 0;
+
is_anon = (TYPE_TAG_NAME (type) == NULL
&& (TYPE_CODE (type) == TYPE_CODE_ENUM
|| TYPE_CODE (type) == TYPE_CODE_STRUCT