aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Carlton <carlton@bactrian.org>2003-02-28 01:04:25 +0000
committerDavid Carlton <carlton@bactrian.org>2003-02-28 01:04:25 +0000
commit160e942aa15f9f939444eb3c3c29b2f9a63b786d (patch)
tree5ea2043d2a7f0b41017d72b11e39dcc8080c57c3
parente6bdd9263901fb54f57ff420d689733282829a6d (diff)
downloadgdb-160e942aa15f9f939444eb3c3c29b2f9a63b786d.zip
gdb-160e942aa15f9f939444eb3c3c29b2f9a63b786d.tar.gz
gdb-160e942aa15f9f939444eb3c3c29b2f9a63b786d.tar.bz2
2003-02-27 David Carlton <carlton@math.stanford.edu>
* symtab.c (lookup_symbol_aux_namespace_scope): Rename from lookup_symbol_aux_using_loop. (lookup_symbol_aux_using): Delete. (lookup_symbol_aux): Call lookup_symbol_aux_namespace_scope instead of lookup_symbol_aux_using.
-rw-r--r--gdb/ChangeLog8
-rw-r--r--gdb/symtab.c70
2 files changed, 33 insertions, 45 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 0bcf274..97c1e50 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,11 @@
+2003-02-27 David Carlton <carlton@math.stanford.edu>
+
+ * symtab.c (lookup_symbol_aux_namespace_scope): Rename from
+ lookup_symbol_aux_using_loop.
+ (lookup_symbol_aux_using): Delete.
+ (lookup_symbol_aux): Call lookup_symbol_aux_namespace_scope
+ instead of lookup_symbol_aux_using.
+
2003-02-24 David Carlton <carlton@math.stanford.edu>
* symtab.h: Declare 'struct objfile'; don't declare 'struct
diff --git a/gdb/symtab.c b/gdb/symtab.c
index a9bc84e..abe7e29 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -134,20 +134,13 @@ struct symbol *lookup_symbol_aux_psymtabs (int block_index,
struct symtab **symtab);
static
-struct symbol *lookup_symbol_aux_using (const char *name,
- const char *linkage_name,
- const struct block *block,
- const namespace_enum namespace,
- struct symtab **symtab);
-
-static
-struct symbol *lookup_symbol_aux_using_loop (const char *name,
- const char *linkage_name,
- const struct block *block,
- namespace_enum namespace,
- struct symtab **symtab,
- const char *scope,
- int scope_len);
+struct symbol *lookup_symbol_aux_namespace_scope (const char *name,
+ const char *linkage_name,
+ const struct block *block,
+ namespace_enum namespace,
+ struct symtab **symtab,
+ const char *scope,
+ int scope_len);
static struct symbol *find_active_alias (struct symbol *sym, CORE_ADDR addr);
@@ -964,12 +957,11 @@ lookup_symbol_aux (const char *name, const char *linkage_name,
}
/* Now search this block's static block, and all the global blocks.
- We do this from within lookup_symbol_aux_using: that will apply
- appropriate using directives in the C++ case. But it works fine
- in the non-C++ case, too. */
+ In the C++ case, do lookup in namespace scope. */
- sym = lookup_symbol_aux_using (name, linkage_name, block, namespace,
- symtab);
+ sym = lookup_symbol_aux_namespace_scope (name, linkage_name, block,
+ namespace, symtab,
+ block_scope (block), 0);
if (sym != NULL)
return sym;
@@ -1259,32 +1251,19 @@ lookup_symbol_aux_psymtabs (int block_index, const char *name,
return NULL;
}
-/* This function and lookup_symbol_aux_using_loop calculates the
- appropriate namespaces scope for BLOCK, and searches for NAME in
- each of the namespaces that are in scope. */
-
-static struct symbol *
-lookup_symbol_aux_using (const char *name,
- const char *linkage_name,
- const struct block *block,
- const namespace_enum namespace,
- struct symtab **symtab)
-{
- const char *scope = block_scope (block);
-
- return lookup_symbol_aux_using_loop (name, linkage_name, block,
- namespace, symtab,
- scope, 0);
-}
+/* Lookup NAME at namespace scope (or, in C terms, in static and
+ global variables). SCOPE is the namespace that the current
+ function is defined within; only consider namespaces whose length
+ is at least SCOPE_LEN. (This is to make the recursion easier.) */
static struct symbol *
-lookup_symbol_aux_using_loop (const char *name,
- const char *linkage_name,
- const struct block *block,
- namespace_enum namespace,
- struct symtab **symtab,
- const char *scope,
- int scope_len)
+lookup_symbol_aux_namespace_scope (const char *name,
+ const char *linkage_name,
+ const struct block *block,
+ namespace_enum namespace,
+ struct symtab **symtab,
+ const char *scope,
+ int scope_len)
{
char *cp_namespace;
@@ -1300,8 +1279,9 @@ lookup_symbol_aux_using_loop (const char *name,
new_scope_len += 2;
}
new_scope_len += cp_find_first_component (scope + new_scope_len);
- sym = lookup_symbol_aux_using_loop (name, linkage_name, block, namespace,
- symtab, scope, new_scope_len);
+ sym = lookup_symbol_aux_namespace_scope (name, linkage_name, block,
+ namespace, symtab,
+ scope, new_scope_len);
if (sym != NULL)
return sym;
}