37 const char *nested_name,
38 const char *concatenated_name,
41 int basic_lookup,
int is_in_anonymous);
57 unsigned int previous_component;
58 unsigned int next_component;
66 previous_component = 0;
69 while (name[next_component] ==
':')
71 if (((next_component - previous_component)
73 && strncmp (name + previous_component,
77 int dest_len = (previous_component == 0
78 ? 0 : previous_component - 2);
79 int src_len = next_component;
81 char *dest = alloca (dest_len + 1);
82 char *src = alloca (src_len + 1);
84 memcpy (dest, name, dest_len);
85 memcpy (src, name, src_len);
87 dest[dest_len] =
'\0';
98 previous_component = next_component + 2;
99 next_component = (previous_component
101 + previous_component));
124 const char *declaration,
127 struct obstack *obstack)
143 if ((alias == NULL && current->
alias != NULL)
144 || (alias != NULL && current->
alias == NULL)
145 || (alias != NULL && current->
alias != NULL
146 && strcmp (alias, current->
alias) != 0))
148 if ((declaration == NULL && current->
declaration != NULL)
149 || (declaration != NULL && current->
declaration == NULL)
150 || (declaration != NULL && current->
declaration != NULL
151 && strcmp (declaration, current->
declaration) != 0))
157 || strcmp (param, current->
excludes[ix]) != 0)
167 newobj = obstack_alloc (obstack, (
sizeof (*newobj)
170 memset (newobj, 0,
sizeof (*newobj));
174 newobj->
import_src = obstack_copy0 (obstack, src, strlen (src));
175 newobj->
import_dest = obstack_copy0 (obstack, dest, strlen (dest));
183 if (alias != NULL && copy_names)
184 newobj->
alias = obstack_copy0 (obstack, alias, strlen (alias));
188 if (declaration != NULL && copy_names)
190 declaration, strlen (declaration));
234 if (global_block != NULL)
265 if (strchr (name,
'<') == NULL && strchr (name,
'(') == NULL)
301 if (lang_this == NULL)
331 unsigned int prefix_len,
335 char *klass, *nested;
338 struct type *klass_type;
352 nested = xstrdup (name + prefix_len + 2);
364 if (klass_sym == NULL)
395 char *concatenated_name = NULL;
397 unsigned int prefix_len;
400 if (the_namespace[0] !=
'\0')
402 concatenated_name = alloca (strlen (the_namespace) + 2
403 + strlen (name) + 1);
404 strcpy (concatenated_name, the_namespace);
405 strcat (concatenated_name,
"::");
406 strcat (concatenated_name, name);
407 name = concatenated_name;
474 const int search_scope_first,
475 const int declaration_only,
476 const int search_parents)
479 struct symbol *sym = NULL;
482 struct cleanup *searched_cleanup;
485 if (search_scope_first)
498 current = current->
next)
500 const char **excludep;
503 directive_match = (search_parents
507 || scope[
len] ==
'\0'))
512 if (directive_match && !current->
searched)
526 && strcmp (name, current->
alias
535 if (declaration_only || sym != NULL || current->
declaration)
547 for (excludep = current->
excludes; *excludep; excludep++)
548 if (strcmp (name, *excludep) == 0)
556 if (current->
alias != NULL
557 && strcmp (name, current->
alias) == 0)
566 else if (current->
alias == NULL)
595 for (i = 0; i < num; ++i)
619 "cp_lookup_symbol_imports_or_template"
620 " (%s, %s, %s, %s)\n",
641 "cp_lookup_symbol_imports_or_template"
653 struct type *context;
668 name_copy[prefix_len] =
'\0';
687 "cp_lookup_symbol_imports_or_template"
703 "cp_lookup_symbol_imports_or_template (...) = %s\n",
721 while (block != NULL)
749 "cp_lookup_symbol_namespace (%s, %s, %s, %s)\n",
764 "cp_lookup_symbol_namespace (...) = %s\n",
795 if (scope[scope_len] !=
'\0')
800 int new_scope_len = scope_len;
803 if (new_scope_len != 0)
810 scope, new_scope_len);
826 if (scope_len == 0 && strchr (name,
':') == NULL)
829 the_namespace = alloca (scope_len + 1);
830 strncpy (the_namespace, scope, scope_len);
831 the_namespace[scope_len] =
'\0';
854 "cp_lookup_symbol_non_local"
855 " (%s, %s (scope %s), %s)\n",
871 "cp_lookup_symbol_nonlocal (...) = %s\n",
891 if (base_name == NULL)
894 if (
streq (base_name, name))
916 char *concatenated_name;
919 concatenated_name = NULL;
928 if (base_name == NULL)
931 len = strlen (base_name) + 2 + strlen (name) + 1;
932 concatenated_name =
xrealloc (concatenated_name, len);
933 xsnprintf (concatenated_name, len,
"%s::%s", base_name, name);
936 block, domain, 1, is_in_anonymous);
959 const char *nested_name,
960 const char *concatenated_name,
963 int basic_lookup,
int is_in_anonymous)
997 if (!is_in_anonymous)
1009 domain, is_in_anonymous);
1024 const char *nested_name,
1030 struct type *saved_parent_type = parent_type;
1039 "cp_lookup_nested_symbol (%s, %s, %s, %s)\n",
1040 type_name != NULL ? type_name :
"unnamed",
1059 char *concatenated_name;
1060 int is_in_anonymous;
1062 size = strlen (parent_name) + 2 + strlen (nested_name) + 1;
1063 concatenated_name = alloca (size);
1064 xsnprintf (concatenated_name, size,
"%s::%s",
1065 parent_name, nested_name);
1069 concatenated_name, block, domain,
1070 1, is_in_anonymous);
1075 "cp_lookup_nested_symbol (...) = %s\n",
1087 "cp_lookup_nested_symbol (...) = NULL"
1088 " (func/method)\n");
1094 _(
"cp_lookup_nested_symbol called "
1095 "on a non-aggregate type."));
1131 if (scope[0] ==
'\0')
1141 static struct type *
1151 if (scope[scope_length] ==
':')
1161 full_name = alloca (scope_length + 2 + strlen (name) + 1);
1162 strncpy (full_name, scope, scope_length);
1163 strncpy (full_name + scope_length,
"::", 2);
1164 strcpy (full_name + scope_length + 2, name);
1188 _(
"Deprecated placeholder for removed functionality."),
struct gdbarch * target_gdbarch(void)
struct symbol * cp_lookup_nested_symbol(struct type *parent_type, const char *nested_name, const struct block *block, const domain_enum domain)
struct type * cp_lookup_transparent_type(const char *name)
void cp_add_using_directive(const char *dest, const char *src, const char *alias, const char *declaration, VEC(const_char_ptr)*excludes, int copy_names, struct obstack *obstack)
struct symbol * language_lookup_primitive_type_as_symbol(const struct language_defn *la, struct gdbarch *gdbarch, const char *name)
#define TYPE_N_BASECLASSES(thistype)
struct symbol * cp_lookup_symbol_namespace(const char *scope, const char *name, const struct block *block, const domain_enum domain)
const char * type_name_no_tag_or_error(struct type *type)
struct symbol * cp_lookup_symbol_imports_or_template(const char *scope, const char *name, const struct block *block, const domain_enum domain)
struct cmd_list_element * deprecate_cmd(struct cmd_list_element *cmd, const char *replacement)
static struct symbol * cp_search_static_and_baseclasses(const char *name, const struct block *block, const domain_enum domain, unsigned int prefix_len, int is_in_anonymous)
#define TYPE_NAME(thistype)
const struct block * block_global_block(const struct block *block)
enum domain_enum_tag domain_enum
static struct symbol * lookup_namespace_scope(const struct language_defn *langdef, const char *name, const struct block *block, const domain_enum domain, const char *scope, int scope_len)
void internal_error(const char *file, int line, const char *fmt,...)
const struct language_defn * language_def(enum language lang)
static struct type * cp_lookup_transparent_type_loop(const char *name, const char *scope, int scope_len)
unsigned int symbol_lookup_debug
struct symbol ** template_arguments
struct gdbarch * symbol_arch(const struct symbol *symbol)
static struct symbol * cp_basic_lookup_symbol(const char *name, const struct block *block, const domain_enum domain, int is_in_anonymous)
struct symbol * lookup_static_symbol(const char *name, const domain_enum domain)
static struct symbol * search_symbol_list(const char *name, int num, struct symbol **syms)
#define BLOCK_FUNCTION(bl)
struct obstack objfile_obstack
#define TYPE_N_TEMPLATE_ARGUMENTS(thistype)
initialize_file_ftype _initialize_cp_namespace
struct type * lookup_typename(const struct language_defn *language, struct gdbarch *gdbarch, const char *name, const struct block *block, int noerr)
EXTERN struct using_direct * using_directives
#define VEC_iterate(T, V, I, P)
struct type * check_typedef(struct type *type)
void initialize_file_ftype(void)
struct symbol * lookup_symbol_in_block(const char *name, const struct block *block, const domain_enum domain)
static struct symbol * cp_lookup_symbol_in_namespace(const char *the_namespace, const char *name, const struct block *block, const domain_enum domain, int search)
struct symbol * lookup_language_this(const struct language_defn *lang, const struct block *block)
#define SYMBOL_DEMANGLED_NAME(symbol)
const char * const_char_ptr
unsigned int cp_find_first_component(const char *name)
void fprintf_unfiltered(struct ui_file *stream, const char *format,...)
int streq(const char *lhs, const char *rhs)
struct cmd_list_element * add_cmd(const char *name, enum command_class theclass, cmd_cfunc_ftype *fun, const char *doc, struct cmd_list_element **list)
void free_current_contents(void *ptr)
struct type * basic_lookup_transparent_type(const char *name)
struct cleanup * make_cleanup(make_cleanup_ftype *function, void *arg)
struct using_direct * block_using(const struct block *block)
#define SYMBOL_IS_CPLUS_TEMPLATE_FUNCTION(symbol)
#define BLOCK_SUPERBLOCK(bl)
struct cmd_list_element * maint_cplus_cmd_list
static struct symbol * find_symbol_in_baseclass(struct type *parent_type, const char *name, const struct block *block, const domain_enum domain, int is_in_anonymous)
#define CP_ANONYMOUS_NAMESPACE_STR
int cp_is_in_anonymous(const char *symbol_name)
static int startswith(const char *string, const char *pattern)
static struct symbol * cp_lookup_nested_symbol_1(struct type *container_type, const char *nested_name, const char *concatenated_name, const struct block *block, const domain_enum domain, int basic_lookup, int is_in_anonymous)
const char * domain_name(domain_enum e)
#define TYPE_BASECLASS(thistype, index)
void printf_unfiltered(const char *format,...)
static struct symbol * cp_lookup_bare_symbol(const struct language_defn *langdef, const char *name, const struct block *block, const domain_enum domain, int search)
struct ui_file * gdb_stdlog
struct using_direct * next
PTR xrealloc(PTR ptr, size_t size)
#define TYPE_TEMPLATE_ARGUMENTS(thistype)
static void reset_directive_searched(void *data)
void cp_scan_for_anonymous_namespaces(const struct symbol *const symbol, struct objfile *const objfile)
void discard_cleanups(struct cleanup *old_chain)
#define TYPE_TARGET_TYPE(thistype)
struct symbol * lookup_global_symbol(const char *name, const struct block *block, const domain_enum domain)
int xsnprintf(char *str, size_t size, const char *format,...)
#define TYPE_CODE(thistype)
#define TYPE_BASECLASS_NAME(thistype, index)
struct gdbarch * block_gdbarch(const struct block *block)
const char * host_address_to_string(const void *addr)
static void maintenance_cplus_namespace(char *args, int from_tty)
#define SYMBOL_LANGUAGE(symbol)
struct symbol * cp_lookup_symbol_nonlocal(const struct language_defn *langdef, const char *name, const struct block *block, const domain_enum domain)
#define VEC_address(T, V)
#define CHECK_TYPEDEF(TYPE)
const struct block * get_selected_block(CORE_ADDR *addr_in_block)
#define SYMBOL_NATURAL_NAME(symbol)
char * savestring(const char *ptr, size_t len)
static struct symbol * cp_lookup_symbol_via_imports(const char *scope, const char *name, const struct block *block, const domain_enum domain, const int search_scope_first, const int declaration_only, const int search_parents)
struct symbol * lookup_symbol_in_static_block(const char *name, const struct block *block, const domain_enum domain)
#define SYMBOL_TYPE(symbol)
const char * type_name_no_tag(const struct type *type)
#define CP_ANONYMOUS_NAMESPACE_LEN
unsigned int cp_entire_prefix_len(const char *name)
struct type * cp_find_type_baseclass_by_name(struct type *parent_type, const char *name)
static struct symbol * cp_lookup_symbol_via_all_imports(const char *scope, const char *name, const struct block *block, const domain_enum domain)
const char * block_scope(const struct block *block)
void do_cleanups(struct cleanup *old_chain)
__extension__ enum domain_enum_tag domain
const ULONGEST const LONGEST len