aboutsummaryrefslogtreecommitdiff
path: root/gdb/cp-namespace.c
diff options
context:
space:
mode:
authorDavid Carlton <carlton@bactrian.org>2003-09-25 16:39:39 +0000
committerDavid Carlton <carlton@bactrian.org>2003-09-25 16:39:39 +0000
commit79c2c32df4d14566f2d11310fddd4e4ca9ab6542 (patch)
treea5e0893e16910a2814ae39a59ab3293a7d86ecbb /gdb/cp-namespace.c
parent594e6d67cd35735bd5eb9eca720560a8336eac37 (diff)
downloadgdb-79c2c32df4d14566f2d11310fddd4e4ca9ab6542.zip
gdb-79c2c32df4d14566f2d11310fddd4e4ca9ab6542.tar.gz
gdb-79c2c32df4d14566f2d11310fddd4e4ca9ab6542.tar.bz2
2003-09-25 David Carlton <carlton@kealia.com>
* c-exp.y: Include cp-support.h. Add qualified_type. (yylex): Delete nested type hack; add comments. * cp-namespace.c (cp_lookup_nested_type): New function. * cp-support.h: Declare cp_lookup_nested_type. * eval.c (evaluate_subexp_standard): Call value_aggregate_elt instead of value_struct_elt_for_reference. * valops.c: Include cp-support.h. (value_aggregate_elt): New function. (value_namespace_elt): Ditto. (value_struct_elt_for_reference): Make static. * value.h: Delete declaration of value_struct_elt_for_reference; add declaration for value_aggregate_elt. * Makefile.in (c-exp.tab.o): Depend on $(cp_support_h). (valops.o): Ditto. 2003-09-25 David Carlton <carlton@kealia.com> * gdb.cp/namespace.exp: Tweak comments. Add non-quoted versions of some print tests, where appropriate. Add tests for C::D::cd, E::ce, F::cXfX, G::XgX. * gdb.cp/namespace.cc: Add XgX, cXfX, ce.
Diffstat (limited to 'gdb/cp-namespace.c')
-rw-r--r--gdb/cp-namespace.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
index 40959a5..75104ac 100644
--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -508,6 +508,41 @@ lookup_symbol_file (const char *name,
return NULL;
}
+/* Look up a type named NESTED_NAME that is nested inside the C++
+ class or namespace given by PARENT_TYPE, from within the context
+ given by BLOCK. Return NULL if there is no such nested type. */
+
+/* FIXME: carlton/2003-09-24: For now, this only works for nested
+ namespaces; the patch to make this work on other sorts of nested
+ types is next on my TODO list. */
+
+struct type *
+cp_lookup_nested_type (struct type *parent_type,
+ const char *nested_name,
+ const struct block *block)
+{
+ switch (TYPE_CODE (parent_type))
+ {
+ case TYPE_CODE_NAMESPACE:
+ {
+ const char *parent_name = TYPE_TAG_NAME (parent_type);
+ struct symbol *sym = cp_lookup_symbol_namespace (parent_name,
+ nested_name,
+ NULL,
+ block,
+ VAR_DOMAIN,
+ NULL);
+ if (sym == NULL || SYMBOL_CLASS (sym) != LOC_TYPEDEF)
+ return NULL;
+ else
+ return SYMBOL_TYPE (sym);
+ }
+ default:
+ internal_error (__FILE__, __LINE__,
+ "cp_lookup_nested_type called on a non-namespace.");
+ }
+}
+
/* Now come functions for dealing with symbols associated to
namespaces. (They're used to store the namespaces themselves, not
objects that live in the namespaces.) These symbols come in two