* buildsym.c (finish_block): Initialize BLOCK_USING to NULL.
* symtab.h (struct block): Delete last remnants of non-dictionary
symbol lists.
(struct block): Add field 'language_specific' and accessor macro
BLOCK_USING.
* cp-support.h (struct using_data): New struct.
(struct using_data_node): New struct.
+2002-10-07 David Carlton <carlton@math.stanford.edu>
+
+ * buildsym.c (finish_block): Initialize BLOCK_USING to NULL.
+ * symtab.h (struct block): Delete last remnants of non-dictionary
+ symbol lists.
+ (struct block): Add field 'language_specific' and accessor macro
+ BLOCK_USING.
+ * cp-support.h (struct using_data): New struct.
+ (struct using_data_node): New struct.
+
2002-09-30 David Carlton <carlton@math.stanford.edu>
* dictionary.h: Augment comment above dict_lookup.
BLOCK_END (block) = end;
/* Superblock filled in when containing block is made */
BLOCK_SUPERBLOCK (block) = NULL;
+ BLOCK_USING (block) = NULL;
BLOCK_GCC_COMPILED (block) = processing_gcc_compilation;
extern char *class_name_from_physname (const char *physname);
extern char *method_name_from_physname (const char *physname);
+
+/* This is a struct to store data from "using directives" and similar
+ language constructs. It contains two strings, OLD and NEW; both
+ should be fully-qualified namespace names, NEW should be an initial
+ substring of OLD, and it says that names in the namespace OLD
+ should be imported into namespace NEW. For example, if it is used
+ to represent the directive "using namespace std;" then OLD should
+ be "std" and new should be "". For a more complicated example, if
+ there is an anonymous namespace with a named namespace A, then OLD
+ should be "A::(anonymous namespace)" and new should be "A". */
+
+/* FIXME: carlton/2002-10-07: That anonymous namespace example isn't
+ that great, since it really depends not only on what the
+ demangler's output is but also on the fact that the demangler's
+ output doesn't depend on the name of the file in question. Which,
+ alas, it doesn't, but should, leaving us with no way to distinguish
+ between anonymous namespaces in different files. Sigh... */
+
+struct using_data
+{
+ const char *old;
+ const char *new;
+};
+
+/* This is a struct for a linked list of using_data's. */
+
+struct using_data_node
+{
+ struct using_data *current;
+ struct using_data_node *next;
+};
struct symtab **symtab);
static
+struct symbol *lookup_symbol_aux_psymtabs (int block_index,
+ const char *name,
+ const char *mangled_name,
+ const namespace_enum namespace,
+ struct symtab **symtab);
+static
struct symbol *lookup_symbol_aux_minsyms (const char *name,
const char *mangled_name,
const namespace_enum namespace,
int *is_a_field_of_this,
struct symtab **symtab);
-static
-struct symbol *lookup_symbol_aux_psymtabs (int block_index,
- const char *name,
- const char *mangled_name,
- const namespace_enum namespace,
- struct symtab **symtab);
static struct symbol *find_active_alias (struct symbol *sym, CORE_ADDR addr);
way. */
sym = lookup_symbol_aux_minsyms (name, mangled_name,
- namespace, is_a_field_of_this,
- symtab);
+ namespace, is_a_field_of_this,
+ symtab);
if (sym != NULL)
return sym;
before the static check in this case? */
sym = lookup_symbol_aux_minsyms (name, mangled_name,
- namespace, is_a_field_of_this,
- symtab);
+ namespace, is_a_field_of_this,
+ symtab);
if (sym != NULL)
return sym;
/* Check to see if the symbol is defined in one of the symtabs.
BLOCK_INDEX should be either GLOBAL_BLOCK or STATIC_BLOCK,
depending on whether or not we want to search global symbols or
- local symbols. */
+ static symbols. */
static struct symbol *
lookup_symbol_aux_symtabs (int block_index,
/* Check to see if the symbol is defined in one of the partial
symtabs. BLOCK_INDEX should be either GLOBAL_BLOCK or
STATIC_BLOCK, depending on whether or not we want to search global
- symbols or local symbols. */
+ symbols or static symbols. */
static struct symbol *
lookup_symbol_aux_psymtabs (int block_index, const char *name,
/* FIXME: carlton/2002-09-30: Should we really do that?
If that happens, isn't it likely to be a GDB error, in
which case we should fix the GDB error rather than
- silently dealing with it here. So I'd vote for
+ silently dealing with it here? So I'd vote for
removing the check for the symbol in the other
block. */
block = BLOCKVECTOR_BLOCK (bv,
/* Opaque declarations. */
struct obstack;
struct dictionary;
+struct using_data_node;
/* Don't do this; it means that if some .o's are compiled with GNU C
and some are not (easy to do accidentally the way we configure
struct dictionary *dict;
+ /* Used for language-specific info. */
+ union
+ {
+ struct
+ {
+ /* Contains information about what using directives or other
+ similar features are added by this block. */
+ struct using_data_node *using;
+ }
+ cplus_specific;
+ }
+ language_specific;
+
/* Version of GCC used to compile the function corresponding
to this block, or 0 if not compiled with GCC. When possible,
GCC should be compatible with the native compiler, or if that
of this flag is undefined. */
unsigned char gcc_compile_flag;
-
- /* The symbols for this block are either in a simple linear list or
- in a simple hashtable. Blocks which correspond to a function
- (which have a list of symbols corresponding to arguments) use
- a linear list, as do some older symbol readers (currently only
- mdebugread and dstread). Other blocks are hashed.
-
- The hashtable uses the same hash function as the minsym hashtables,
- found in minsyms.c:minsym_hash_iw. Symbols are hashed based on
- their demangled name if appropriate, and on their name otherwise.
- The hash function ignores space, and stops at the beginning of the
- argument list if any.
-
- The table is laid out in NSYMS/5 buckets and symbols are chained via
- their hash_next field. */
-
-#if 0
- /* NOTE: carlton/2002-09-24: The rest of the members have been
- obsoleted by DICT. */
-
- /* If this is really a hashtable of the symbols, this flag is 1. */
-
- unsigned char hashtable;
-
- /* Number of local symbols. */
-
- int nsyms;
-
- /* The symbols. If some of them are arguments, then they must be
- in the order in which we would like to print them. */
-
- struct symbol *sym[1];
-#endif /* 0 */
};
#define BLOCK_START(bl) (bl)->startaddr
#define BLOCK_FUNCTION(bl) (bl)->function
#define BLOCK_SUPERBLOCK(bl) (bl)->superblock
#define BLOCK_DICT(bl) (bl)->dict
+#define BLOCK_USING(bl) (bl)->language_specific.cplus_specific.using
#define BLOCK_GCC_COMPILED(bl) (bl)->gcc_compile_flag
-#if 0
-
-/* NOTE: carlton/2002-09-24: These have been obsoleted by dictionary
- stuff. */
-#define BLOCK_HASHTABLE(bl) (bl)->hashtable
-
-/* For blocks without a hashtable (BLOCK_HASHTABLE (bl) == 0) only. */
-#define BLOCK_NSYMS(bl) (bl)->nsyms
-#define BLOCK_SYM(bl, n) (bl)->sym[n]
-
-/* For blocks with a hashtable, but these are valid for non-hashed blocks as
- well - each symbol will appear to be one bucket by itself. */
-#define BLOCK_BUCKETS(bl) (bl)->nsyms
-#define BLOCK_BUCKET(bl, n) (bl)->sym[n]
-
-/* Macro used to set the size of a hashtable for N symbols. */
-#define BLOCK_HASHTABLE_SIZE(n) ((n)/5 + 1)
-
-/* Macro to loop through all symbols in a block BL, in no particular order.
- i counts which bucket we are in, and sym points to the current symbol. */
-
-#define ALL_BLOCK_SYMBOLS(bl, i, sym) \
- for ((i) = 0; (i) < BLOCK_BUCKETS ((bl)); (i)++) \
- for ((sym) = BLOCK_BUCKET ((bl), (i)); (sym); \
- (sym) = (sym)->hash_next)
-#endif /* 0 */
-
\f
/* Represent one symbol name; a variable, constant, function or typedef. */