From f7e3ecae9ff55b69aab93af61a7f7ca272d03d0a Mon Sep 17 00:00:00 2001 From: Keith Seitz Date: Mon, 25 Nov 2013 13:37:08 -0800 Subject: PR c++/14819: Explicit class:: inside class scope does not work https://sourceware.org/ml/gdb-patches/2013-11/msg00102.html --- gdb/cp-namespace.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'gdb/cp-namespace.c') 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. */ -- cgit v1.1