+2003-01-28 David Carlton <carlton@math.stanford.edu>
+
+ * valops.c (find_overload_match): Calculate func_name via
+ SYMBOL_CPLUS_DEMANGLED_NAME + remove_params.
+ * symtab.c (remove_params): Make extern.
+ * symtab.h: Add declaration for remove_params.
+ * symtab.c (overload_list_add_symbol): Change second arg to const
+ char *.
+ * valops.c (find_overload_match) Update call to
+ make_symbol_overload_list.
+ * symtab.h: Update declaration for make_symbol_overload_list.
+ * symtab.c (make_symbol_overload_list): Change arguments.
+ * valops.c (find_overload_match): Rename cleanups to old_cleanups;
+ handle freeing func_name via cleanups.
+
2003-01-27 David Carlton <carlton@math.stanford.edu>
* objfiles.h: Add comments about objfile->msymbols being NULL.
static void symtab_symbol_info (char *, namespace_enum, int);
-static void overload_list_add_symbol (struct symbol *sym, char *oload_name);
+static void overload_list_add_symbol (struct symbol *sym,
+ const char *oload_name);
void _initialize_symtab (void);
/* Begin overload resolution functions */
-static char *
+char *
remove_params (const char *demangled_name)
{
const char *argp;
characters. If so, add it to the current completion list. */
static void
-overload_list_add_symbol (struct symbol *sym, char *oload_name)
+overload_list_add_symbol (struct symbol *sym, const char *oload_name)
{
int newsize;
int i;
}
/* Return a null-terminated list of pointers to function symbols that
- * match name of the supplied symbol FSYM.
- * This is used in finding all overloaded instances of a function name.
- * This has been modified from make_symbol_completion_list. */
-
+ match name of the supplied symbol FSYM and that occur within the
+ namespace given by the initial substring of NAMESPACE_NAME of
+ length NAMESPACE_LEN. Apply using directives from BLOCK. This is
+ used in finding all overloaded instances of a function name. This
+ has been modified from make_symbol_completion_list. */
struct symbol **
-make_symbol_overload_list (struct symbol *fsym)
+make_symbol_overload_list (const char *func_name,
+ const char *namespace_name,
+ int namespace_len, const struct block *block)
{
register struct symbol *sym;
register struct symtab *s;
register struct block *b, *surrounding_static_block = 0;
struct dict_iterator iter;
/* The name we are completing on. */
- char *oload_name = NULL;
- /* Length of name. */
- int oload_name_len = 0;
-
- /* Look for the symbol we are supposed to complete on. */
-
- oload_name = remove_params (SYMBOL_DEMANGLED_NAME (fsym));
- if (!oload_name)
- {
- sym_return_val_size = 1;
- sym_return_val =
- (struct symbol **) xmalloc (2 * sizeof (struct symbol *));
- sym_return_val[0] = fsym;
- sym_return_val[1] = NULL;
-
- return sym_return_val;
- }
- oload_name_len = strlen (oload_name);
+ const char *oload_name = func_name;
sym_return_val_size = 100;
sym_return_val_index = 0;
}
}
- xfree (oload_name);
-
return (sym_return_val);
}
extern char **make_file_symbol_completion_list (char *, char *, char *);
-extern struct symbol **make_symbol_overload_list (struct symbol *);
+extern char *remove_params (const char *demangled_name);
+
+extern struct symbol **make_symbol_overload_list (const char *,
+ const char *, int,
+ const struct block *);
extern char **make_source_files_completion_list (char *, char *);
int boffset;
register int ix;
int static_offset;
- struct cleanup *cleanups = NULL;
+ struct cleanup *old_cleanups = NULL;
const char *obj_type_name = NULL;
char *func_name = NULL;
else
{
int i = -1;
- func_name = cplus_demangle (SYMBOL_NAME (fsym), DMGL_NO_OPTS);
+ func_name = remove_params (SYMBOL_CPLUS_DEMANGLED_NAME (fsym));
/* If the name is NULL this must be a C-style function.
Just return the same symbol. */
- if (!func_name)
+ if (func_name == NULL)
{
*symp = fsym;
return 0;
}
- oload_syms = make_symbol_overload_list (fsym);
- cleanups = make_cleanup (xfree, oload_syms);
+ old_cleanups = make_cleanup (xfree, func_name);
+ oload_syms = make_symbol_overload_list (func_name, "", 0, current_block);
+ make_cleanup (xfree, oload_syms);
while (oload_syms[++i])
num_fns++;
if (!num_fns)
error ("Couldn't find function %s", func_name);
}
- oload_champ = find_oload_champ(arg_types, nargs, method, num_fns, fns_ptr,
- oload_syms, &oload_champ_bv);
+ oload_champ = find_oload_champ (arg_types, nargs, method, num_fns, fns_ptr,
+ oload_syms, &oload_champ_bv);
/* NOTE: dan/2000-03-10: Seems to be a better idea to just pick one
if they have the exact same goodness. This is because there is no
else
{
*symp = oload_syms[oload_champ];
- xfree (func_name);
}
if (objp)
}
*objp = temp;
}
- if (cleanups != NULL)
- do_cleanups (cleanups);
+ if (old_cleanups != NULL)
+ do_cleanups (old_cleanups);
switch (match_quality)
{