23#include "gdbsupport/gdb_obstack.h"
39 const char *nested_name,
40 const char *concatenated_name,
43 int basic_lookup,
int is_in_anonymous);
60 unsigned int previous_component;
61 unsigned int next_component;
69 previous_component = 0;
72 while (
name[next_component] ==
':')
74 if (((next_component - previous_component)
76 && strncmp (
name + previous_component,
80 int dest_len = (previous_component == 0
81 ? 0 : previous_component - 2);
82 int src_len = next_component;
84 char *dest = (
char *) alloca (dest_len + 1);
85 char *src = (
char *) alloca (src_len + 1);
87 memcpy (dest,
name, dest_len);
88 memcpy (src,
name, src_len);
90 dest[dest_len] =
'\0';
97 std::vector<const char *> excludes;
99 dest, src, NULL, NULL, excludes,
103 previous_component = next_component + 2;
104 next_component = (previous_component
106 + previous_component));
177 if (strchr (
name,
'<') == NULL && strchr (
name,
'(') == NULL)
178 gdb_assert (strstr (
name,
"::") == NULL);
219 if (lang_this.
symbol == NULL)
250 unsigned int prefix_len,
254 if (prefix_len + 2 > strlen (
name) ||
name[prefix_len + 1] !=
':')
259 std::string scope (
name, prefix_len);
263 const char *nested =
name + prefix_len + 2;
272 if (scope_sym.
symbol == NULL)
274 if (scope_sym.
symbol == NULL)
281 if ((scope_type->
code () == TYPE_CODE_FUNC
282 || scope_type->
code () == TYPE_CODE_METHOD)
291 block, domain, 0, is_in_anonymous);
308 char *concatenated_name = NULL;
310 unsigned int prefix_len;
313 if (the_namespace[0] !=
'\0')
316 = (
char *) alloca (strlen (the_namespace) + 2 + strlen (
name) + 1);
317 strcpy (concatenated_name, the_namespace);
318 strcat (concatenated_name,
"::");
319 strcat (concatenated_name,
name);
320 name = concatenated_name;
378 const int search_scope_first,
379 const int declaration_only,
380 const int search_parents)
388 if (search_scope_first)
401 current = current->
next)
403 const char **excludep;
406 directive_match = (search_parents
410 || scope[len] ==
'\0'))
415 if (directive_match && !current->
searched)
419 scoped_restore reset_directive_searched
420 = make_scoped_restore (¤t->
searched, 1);
446 for (excludep = current->
excludes; *excludep; excludep++)
447 if (strcmp (
name, *excludep) == 0)
452 if (current->
alias != NULL
462 else if (current->
alias == NULL)
489 for (i = 0; i < num; ++i)
511 (
"cp_lookup_symbol_imports_or_template (%s, %s, %s, %s)",
528 (
"cp_lookup_symbol_imports_or_template (...) = %s",
529 host_address_to_string (sym));
538 struct type *context;
546 unsigned int prefix_len
553 name_copy.erase (prefix_len);
569 (
"cp_lookup_symbol_imports_or_template (...) = %s",
570 host_address_to_string (sym));
579 (
"cp_lookup_symbol_imports_or_template (...) = %s",
580 result.
symbol != NULL ? host_address_to_string (result.
symbol) :
"NULL");
595 while (
block != NULL)
621 scope,
name, host_address_to_string (
block),
633 ? host_address_to_string (sym.
symbol) :
"NULL");
662 if (scope[scope_len] !=
'\0')
667 int new_scope_len = scope_len;
670 if (new_scope_len != 0)
672 gdb_assert (scope[new_scope_len] ==
':');
677 scope, new_scope_len);
693 if (scope_len == 0 && strchr (
name,
':') == NULL)
696 the_namespace = (
char *) alloca (scope_len + 1);
697 strncpy (the_namespace, scope, scope_len);
698 the_namespace[scope_len] =
'\0';
719 (
"cp_lookup_symbol_non_local (%s, %s (scope %s), %s)",
732 ? host_address_to_string (sym.
symbol)
750 const char *base_name =
type->
name ();
752 if (base_name == NULL)
755 if (streq (tdef_name,
name) || streq (base_name,
name))
782 if (base_name == NULL)
785 std::string concatenated_name = std::string (base_name) +
"::" +
name;
788 concatenated_name.c_str (),
789 block, domain, 1, is_in_anonymous);
811 const char *nested_name,
812 const char *concatenated_name,
815 int basic_lookup,
int is_in_anonymous)
849 if (!is_in_anonymous)
861 domain, is_in_anonymous);
876 const char *nested_name,
882 struct type *saved_parent_type = parent_type;
888 const char *type_name = saved_parent_type->
name ();
891 type_name != NULL ? type_name :
"unnamed",
892 nested_name, host_address_to_string (
block),
896 switch (parent_type->code ())
898 case TYPE_CODE_STRUCT:
899 case TYPE_CODE_NAMESPACE:
900 case TYPE_CODE_UNION:
905 case TYPE_CODE_MODULE:
910 char *concatenated_name;
913 size = strlen (parent_name) + 2 + strlen (nested_name) + 1;
914 concatenated_name = (
char *) alloca (
size);
915 xsnprintf (concatenated_name,
size,
"%s::%s",
916 parent_name, nested_name);
920 concatenated_name,
block, domain,
925 ? host_address_to_string (sym.
symbol)
931 case TYPE_CODE_METHOD:
933 (
"cp_lookup_nested_symbol (...) = NULL (func/method)");
937 internal_error (_(
"cp_lookup_nested_symbol called "
938 "on a non-aggregate type."));
974 if (scope[0] ==
'\0')
994 if (scope[scope_length] ==
':')
1004 full_name = (
char *) alloca (scope_length + 2 + strlen (
name) + 1);
1005 strncpy (full_name, scope, scope_length);
1006 memcpy (full_name + scope_length,
"::", 2);
1007 strcpy (full_name + scope_length + 2,
name);
1018 gdb_printf (_(
"The `maint namespace' command was removed.\n"));
1029 _(
"Deprecated placeholder for removed functionality."),
struct gdbarch * target_gdbarch(void)
const struct block * block_global_block(const struct block *block)
struct using_direct * block_using(const struct block *block)
struct gdbarch * block_gdbarch(const struct block *block)
const char * block_scope(const struct block *block)
struct cmd_list_element * add_cmd(const char *name, enum command_class theclass, const char *doc, struct cmd_list_element **list)
struct cmd_list_element * deprecate_cmd(struct cmd_list_element *cmd, const char *replacement)
struct block_symbol cp_lookup_symbol_imports_or_template(const char *scope, const char *name, const struct block *block, const domain_enum domain)
static struct block_symbol find_symbol_in_baseclass(struct type *parent_type, const char *name, const struct block *block, const domain_enum domain, int is_in_anonymous)
static void maintenance_cplus_namespace(const char *args, int from_tty)
static struct block_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)
static struct block_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)
static struct block_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)
static struct block_symbol cp_basic_lookup_symbol(const char *name, const struct block *block, const domain_enum domain, int is_in_anonymous)
static struct block_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)
void cp_scan_for_anonymous_namespaces(struct buildsym_compunit *compunit, const struct symbol *const symbol, struct objfile *const objfile)
static struct block_symbol cp_lookup_bare_symbol(const struct language_defn *langdef, const char *name, const struct block *block, const domain_enum domain, int search)
struct type * cp_lookup_transparent_type(const char *name)
static struct block_symbol cp_lookup_symbol_via_all_imports(const char *scope, const char *name, const struct block *block, const domain_enum domain)
static struct type * cp_lookup_transparent_type_loop(const char *name, const char *scope, int scope_len)
struct type * cp_find_type_baseclass_by_name(struct type *parent_type, const char *name)
struct block_symbol cp_lookup_symbol_namespace(const char *scope, const char *name, const struct block *block, const domain_enum domain)
struct block_symbol cp_lookup_symbol_nonlocal(const struct language_defn *langdef, const char *name, const struct block *block, const domain_enum domain)
void _initialize_cp_namespace()
struct block_symbol cp_lookup_nested_symbol(struct type *parent_type, const char *nested_name, const struct block *block, const domain_enum domain)
int cp_is_in_anonymous(const char *symbol_name)
static struct block_symbol cp_lookup_symbol_in_namespace(const char *the_namespace, const char *name, const struct block *block, const domain_enum domain, int search)
static struct symbol * search_symbol_list(const char *name, int num, struct symbol **syms)
unsigned int cp_find_first_component(const char *name)
unsigned int cp_entire_prefix_len(const char *name)
struct cmd_list_element * maint_cplus_cmd_list
#define CP_ANONYMOUS_NAMESPACE_LEN
#define CP_ANONYMOUS_NAMESPACE_STR
const struct block * get_selected_block(CORE_ADDR *addr_in_block)
struct type * lookup_typename(const struct language_defn *language, const char *name, const struct block *block, int noerr)
const char * type_name_or_error(struct type *type)
struct type * check_typedef(struct type *type)
#define TYPE_BASECLASS_NAME(thistype, index)
#define TYPE_TEMPLATE_ARGUMENTS(thistype)
#define TYPE_BASECLASS(thistype, index)
#define TYPE_N_TEMPLATE_ARGUMENTS(thistype)
#define TYPE_N_BASECLASSES(thistype)
const struct language_defn * language_def(enum language lang)
struct symbol * language_lookup_primitive_type_as_symbol(const struct language_defn *la, struct gdbarch *gdbarch, const char *name)
void add_using_directive(struct using_direct **using_directives, const char *dest, const char *src, const char *alias, const char *declaration, const std::vector< const char * > &excludes, int copy_names, struct obstack *obstack)
const struct block * block
const block * superblock() const
symbol * function() const
struct using_direct ** get_local_using_directives()
const char * natural_name() const
const char * demangled_name
enum language language() const
auto_obstack objfile_obstack
const block * value_block() const
struct type * type() const
domain_enum domain() const
bool is_cplus_template_function() const
struct symbol ** template_arguments
struct type * target_type() const
const char * name() const
struct using_direct * next
const char * domain_name(domain_enum e)
struct block_symbol lookup_static_symbol(const char *name, const domain_enum domain)
struct block_symbol lookup_symbol(const char *name, const struct block *block, domain_enum domain, struct field_of_this_result *is_a_field_of_this)
struct block_symbol lookup_global_symbol(const char *name, const struct block *block, const domain_enum domain)
struct type * basic_lookup_transparent_type(const char *name)
struct symbol * lookup_symbol_in_block(const char *name, symbol_name_match_type match_type, const struct block *block, const domain_enum domain)
struct block_symbol lookup_symbol_in_static_block(const char *name, const struct block *block, const domain_enum domain)
unsigned int symbol_lookup_debug
struct block_symbol lookup_language_this(const struct language_defn *lang, const struct block *block)
#define symbol_lookup_debug_printf(fmt,...)
void gdb_printf(struct ui_file *stream, const char *format,...)