summaryrefslogtreecommitdiff
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
commit0c40460023b3ee8a5b9b37f5bedd604f482f4963 (patch)
tree8fc12115ef71c1be5985c2d79d29d155f2bc85cb
parentad3748676f6da252d845cba345e4ecb645737059 (diff)
downloadgdb-0c40460023b3ee8a5b9b37f5bedd604f482f4963.tar.gz
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 0bcf27433cb..97c1e50cb25 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 a9bc84e7eab..abe7e29f040 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;
}