gdb/
authorJan Kratochvil <jan.kratochvil@redhat.com>
Mon, 3 May 2010 20:10:22 +0000 (20:10 +0000)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Mon, 3 May 2010 20:10:22 +0000 (20:10 +0000)
* cp-namespace.c (cp_lookup_symbol_imports): Support ALIAS for the
CURRENT->DECLARATION case.
* cp-support.h (struct using_direct): Provide extended comment.

gdb/ChangeLog
gdb/cp-namespace.c
gdb/cp-support.h

index 2b8651bbdf3e585bd6b1e951ab4f39af8589ef2e..9f3456c74a9c3dc25736184917c64f6c3cc3a436 100644 (file)
@@ -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>
 
        * hppaobsd-tdep.c (HPPAOBSD_SIZEOF_GREGS): Renamed from
index c050d1a2efa2e73c9a705b1d732464246e7a4d66..e04246367194955876deae7b52dc8f00c4c2f2fa 100644 (file)
@@ -355,12 +355,14 @@ cp_lookup_symbol_imports (const char *scope,
        searched_cleanup = make_cleanup (reset_directive_searched, current);
 
        /* If there is an import of a single declaration, compare the imported
-          declaration with the sought out name.  If there is a match pass
-          current->import_src as NAMESPACE to direct the search towards the
-          imported namespace.  */
-       if (current->declaration && strcmp (name, current->declaration) == 0)
+          declaration (after optional renaming by its alias) with the sought
+          out name.  If there is a match pass current->import_src as NAMESPACE
+          to direct the search towards the imported namespace.  */
+       if (current->declaration
+           && strcmp (name, current->alias ? current->alias
+                                           : current->declaration) == 0)
          sym = cp_lookup_symbol_in_namespace (current->import_src,
-                                              name,
+                                              current->declaration,
                                               block,
                                               domain);
 
index f2f202f139722126a262cc97f32b1f8ea51c6cf5..dd4df842df1a30118440e115d781b08d51c0ff41 100644 (file)
@@ -37,19 +37,44 @@ struct type;
 struct demangle_component;
 
 /* This struct is designed to store data from using directives.  It
-   says that names from namespace IMPORT_SRC should be visible within
-   namespace IMPORT_DEST.  These form a linked list; NEXT is the next element
-   of the list.  If the imported namespace has been aliased, ALIAS is set to a
-   string representing the alias.  Otherwise, ALIAS is NULL.
-   Eg:
-       namespace C = A::B;
-   ALIAS = "C"
-   DECLARATION is the name of the imported declaration, if this import
-   statement represents one.
-   Eg:
-       using A::x;
-   Where x is variable in namespace A.  DECLARATION is set to x.
-*/
+   says that names from namespace IMPORT_SRC should be visible within namespace
+   IMPORT_DEST.  These form a linked list; NEXT is the next element of the
+   list.  If the imported namespace or declaration has been aliased within the
+   IMPORT_DEST namespace, ALIAS is set to a string representing the alias.
+   Otherwise, ALIAS is NULL.  DECLARATION is the name of the imported
+   declaration, if this import statement represents one.  Otherwise DECLARATION
+   is NULL and this import statement represents a namespace.
+
+   C++:      using namespace A;
+   Fortran:  use A
+   import_src = "A"
+   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
 {
This page took 0.075793 seconds and 4 git commands to generate.