int funfirstline,
char ***canonical,
char *saved_arg,
- char *p);
+ char *p,
+ int *not_found_ptr);
static struct symbol *lookup_prefix_sym (char **argptr, char *p);
char *saved_arg,
char *copy,
struct type *t,
- struct symbol *sym_class);
-
-static int collect_methods (char *copy, struct type *t,
- struct symbol *sym_class,
- struct symbol **sym_arr);
+ struct symbol *sym_class,
+ int *not_found_ptr);
static NORETURN void cplusplus_error (const char *name,
const char *fmt, ...)
cplusplus_error (const char *name, const char *fmt, ...)
{
struct ui_file *tmp_stream;
+ char *message;
tmp_stream = mem_fileopen ();
make_cleanup_ui_file_delete (tmp_stream);
("Hint: try '%s<TAB> or '%s<ESC-?>\n"
"(Note leading single quote.)"),
name, name);
- error_stream (tmp_stream);
+
+ message = ui_file_xstrdup (tmp_stream, NULL);
+ make_cleanup (xfree, message);
+ throw_error (NOT_FOUND_ERROR, "%s", message);
}
/* Return the number of methods described for TYPE, including the
else
phys_name = TYPE_FN_FIELD_PHYSNAME (f, field_counter);
- /* Destructor is handled by caller, don't add it to
- the list. */
- if (is_destructor_name (phys_name) != 0)
- continue;
-
sym_arr[i1] = lookup_symbol_in_language (phys_name,
NULL, VAR_DOMAIN,
language,
if (p[0] == '.' || p[1] == ':')
return decode_compound (argptr, funfirstline, canonical,
- saved_arg, p);
+ saved_arg, p, not_found_ptr);
/* No, the first part is a filename; set file_symtab to be that file's
symtab. Also, move argptr past the filename. */
p = skip_quoted (*argptr);
}
+ /* Keep any template parameters */
+ if (*p == '<')
+ p = find_template_name_end (p);
+
copy = (char *) alloca (p - *argptr + 1);
memcpy (copy, *argptr, p - *argptr);
copy[p - *argptr] = '\0';
static struct symtabs_and_lines
decode_compound (char **argptr, int funfirstline, char ***canonical,
- char *saved_arg, char *p)
+ char *saved_arg, char *p, int *not_found_ptr)
{
struct symtabs_and_lines values;
char *p2;
we'll lookup the whole string in the symbol tables. */
return find_method (funfirstline, canonical, saved_arg,
- copy, t, sym_class);
+ copy, t, sym_class, not_found_ptr);
} /* End if symbol found */
/* Couldn't find any interpretation as classes/namespaces, so give
up. The quotes are important if copy is empty. */
+ if (not_found_ptr)
+ *not_found_ptr = 1;
cplusplus_error (saved_arg,
"Can't find member of namespace, class, struct, or union named \"%s\"\n",
copy);
static struct symtabs_and_lines
find_method (int funfirstline, char ***canonical, char *saved_arg,
- char *copy, struct type *t, struct symbol *sym_class)
+ char *copy, struct type *t, struct symbol *sym_class, int *not_found_ptr)
{
struct symtabs_and_lines values;
struct symbol *sym = NULL;
/* Find all methods with a matching name, and put them in
sym_arr. */
- i1 = collect_methods (copy, t, sym_class, sym_arr);
+ i1 = find_methods (t, copy, SYMBOL_LANGUAGE (sym_class), sym_arr);
if (i1 == 1)
{
}
else
tmp = copy;
+ if (not_found_ptr)
+ *not_found_ptr = 1;
if (tmp[0] == '~')
cplusplus_error (saved_arg,
"the class `%s' does not have destructor defined\n",
}
}
-/* Find all methods named COPY in the class whose type is T, and put
- them in SYM_ARR. Return the number of methods found. */
-
-static int
-collect_methods (char *copy, struct type *t,
- struct symbol *sym_class, struct symbol **sym_arr)
-{
- int i1 = 0; /* Counter for the symbol array. */
-
- if (destructor_name_p (copy, t))
- {
- /* Destructors are a special case. */
- int m_index, f_index;
-
- if (get_destructor_fn_field (t, &m_index, &f_index))
- {
- struct fn_field *f = TYPE_FN_FIELDLIST1 (t, m_index);
-
- sym_arr[i1] =
- lookup_symbol (TYPE_FN_FIELD_PHYSNAME (f, f_index),
- NULL, VAR_DOMAIN, (int *) NULL);
- if (sym_arr[i1])
- i1++;
- }
- }
- else
- i1 = find_methods (t, copy, SYMBOL_LANGUAGE (sym_class), sym_arr);
-
- return i1;
-}
-
\f
/* Return the symtab associated to the filename given by the substring