gdb/
* cp-namespace.c (cp_lookup_symbol_imports): Support ALIAS for the CURRENT->DECLARATION case. * cp-support.h (struct using_direct): Provide extended comment.
This commit is contained in:
parent
7c54a10880
commit
1ac77ea163
3 changed files with 51 additions and 18 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2010-05-03 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||||
|
|
||||||
|
* cp-namespace.c (cp_lookup_symbol_imports): Support ALIAS for the
|
||||||
|
CURRENT->DECLARATION case.
|
||||||
|
* cp-support.h (struct using_direct): Provide extended comment.
|
||||||
|
|
||||||
2010-05-03 Mark Kettenis <kettenis@gnu.org>
|
2010-05-03 Mark Kettenis <kettenis@gnu.org>
|
||||||
|
|
||||||
* hppaobsd-tdep.c (HPPAOBSD_SIZEOF_GREGS): Renamed from
|
* hppaobsd-tdep.c (HPPAOBSD_SIZEOF_GREGS): Renamed from
|
||||||
|
|
|
@ -355,12 +355,14 @@ cp_lookup_symbol_imports (const char *scope,
|
||||||
searched_cleanup = make_cleanup (reset_directive_searched, current);
|
searched_cleanup = make_cleanup (reset_directive_searched, current);
|
||||||
|
|
||||||
/* If there is an import of a single declaration, compare the imported
|
/* If there is an import of a single declaration, compare the imported
|
||||||
declaration with the sought out name. If there is a match pass
|
declaration (after optional renaming by its alias) with the sought
|
||||||
current->import_src as NAMESPACE to direct the search towards the
|
out name. If there is a match pass current->import_src as NAMESPACE
|
||||||
imported namespace. */
|
to direct the search towards the imported namespace. */
|
||||||
if (current->declaration && strcmp (name, current->declaration) == 0)
|
if (current->declaration
|
||||||
|
&& strcmp (name, current->alias ? current->alias
|
||||||
|
: current->declaration) == 0)
|
||||||
sym = cp_lookup_symbol_in_namespace (current->import_src,
|
sym = cp_lookup_symbol_in_namespace (current->import_src,
|
||||||
name,
|
current->declaration,
|
||||||
block,
|
block,
|
||||||
domain);
|
domain);
|
||||||
|
|
||||||
|
|
|
@ -37,19 +37,44 @@ struct type;
|
||||||
struct demangle_component;
|
struct demangle_component;
|
||||||
|
|
||||||
/* This struct is designed to store data from using directives. It
|
/* This struct is designed to store data from using directives. It
|
||||||
says that names from namespace IMPORT_SRC should be visible within
|
says that names from namespace IMPORT_SRC should be visible within namespace
|
||||||
namespace IMPORT_DEST. These form a linked list; NEXT is the next element
|
IMPORT_DEST. These form a linked list; NEXT is the next element of the
|
||||||
of the list. If the imported namespace has been aliased, ALIAS is set to a
|
list. If the imported namespace or declaration has been aliased within the
|
||||||
string representing the alias. Otherwise, ALIAS is NULL.
|
IMPORT_DEST namespace, ALIAS is set to a string representing the alias.
|
||||||
Eg:
|
Otherwise, ALIAS is NULL. DECLARATION is the name of the imported
|
||||||
namespace C = A::B;
|
declaration, if this import statement represents one. Otherwise DECLARATION
|
||||||
ALIAS = "C"
|
is NULL and this import statement represents a namespace.
|
||||||
DECLARATION is the name of the imported declaration, if this import
|
|
||||||
statement represents one.
|
C++: using namespace A;
|
||||||
Eg:
|
Fortran: use A
|
||||||
using A::x;
|
import_src = "A"
|
||||||
Where x is variable in namespace A. DECLARATION is set to x.
|
import_dest = local scope of the import statement even such as ""
|
||||||
*/
|
alias = NULL
|
||||||
|
declaration = NULL
|
||||||
|
|
||||||
|
C++: using A::x;
|
||||||
|
Fortran: use A, only: x
|
||||||
|
import_src = "A"
|
||||||
|
import_dest = local scope of the import statement even such as ""
|
||||||
|
alias = NULL
|
||||||
|
declaration = "x"
|
||||||
|
The declaration will get imported as import_dest::x.
|
||||||
|
|
||||||
|
C++: namespace LOCALNS = A;
|
||||||
|
Fortran has no way to address non-local namespace/module.
|
||||||
|
import_src = "A"
|
||||||
|
import_dest = local scope of the import statement even such as ""
|
||||||
|
alias = "LOCALNS"
|
||||||
|
declaration = NULL
|
||||||
|
The namespace will get imported as the import_dest::LOCALNS namespace.
|
||||||
|
|
||||||
|
C++ cannot express it, it would be something like: using localname = A::x;
|
||||||
|
Fortran: use A, only localname => x
|
||||||
|
import_src = "A"
|
||||||
|
import_dest = local scope of the import statement even such as ""
|
||||||
|
alias = "localname"
|
||||||
|
declaration = "x"
|
||||||
|
The declaration will get imported as localname or `import_dest`localname. */
|
||||||
|
|
||||||
struct using_direct
|
struct using_direct
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue