aboutsummaryrefslogtreecommitdiff
path: root/gdb/cp-namespace.c
diff options
context:
space:
mode:
authorKeith Seitz <keiths@redhat.com>2013-11-25 13:37:08 -0800
committerKeith Seitz <keiths@redhat.com>2013-11-25 13:37:08 -0800
commitf7e3ecae9ff55b69aab93af61a7f7ca272d03d0a (patch)
tree8b09679efbdab89ae85dbbb6a03d9890ff0433c2 /gdb/cp-namespace.c
parentb02677b9040a23788b4e07c7cfbf75eca0aa2775 (diff)
downloadgdb-f7e3ecae9ff55b69aab93af61a7f7ca272d03d0a.zip
gdb-f7e3ecae9ff55b69aab93af61a7f7ca272d03d0a.tar.gz
gdb-f7e3ecae9ff55b69aab93af61a7f7ca272d03d0a.tar.bz2
PR c++/14819: Explicit class:: inside class scope does not work
https://sourceware.org/ml/gdb-patches/2013-11/msg00102.html
Diffstat (limited to 'gdb/cp-namespace.c')
-rw-r--r--gdb/cp-namespace.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
index 36134c0..d0520bd 100644
--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -703,6 +703,34 @@ lookup_symbol_file (const char *name,
return sym;
}
+/* Search through the base classes of PARENT_TYPE for a base class
+ named NAME and return its type. If not found, return NULL. */
+
+struct type *
+find_type_baseclass_by_name (struct type *parent_type, const char *name)
+{
+ int i;
+
+ CHECK_TYPEDEF (parent_type);
+ for (i = 0; i < TYPE_N_BASECLASSES (parent_type); ++i)
+ {
+ struct type *type = check_typedef (TYPE_BASECLASS (parent_type, i));
+ const char *base_name = TYPE_BASECLASS_NAME (parent_type, i);
+
+ if (base_name == NULL)
+ continue;
+
+ if (streq (base_name, name))
+ return type;
+
+ type = find_type_baseclass_by_name (type, name);
+ if (type != NULL)
+ return type;
+ }
+
+ return NULL;
+}
+
/* Search through the base classes of PARENT_TYPE for a symbol named
NAME in block BLOCK. */