public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  archer-keiths-expr-cumulative: Remove tests renamed upstream.
@ 2010-05-05 20:33 swagiaal
  0 siblings, 0 replies; only message in thread
From: swagiaal @ 2010-05-05 20:33 UTC (permalink / raw)
  To: archer-commits

The branch, archer-keiths-expr-cumulative has been updated
       via  b5a7497340b24199f0c7ba7fdf0d54d4df44d6bc (commit)
       via  570878809817deaee8c470fc85bbc2adb6066e40 (commit)
      from  56b45f494f647360f9d6ff84f12f59c08cbe05af (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit b5a7497340b24199f0c7ba7fdf0d54d4df44d6bc
Author: Sami Wagiaalla <swagiaal@redhat.com>
Date:   Wed May 5 16:24:51 2010 -0400

    Remove tests renamed upstream.

commit 570878809817deaee8c470fc85bbc2adb6066e40
Author: swagiaal <swagiaal>
Date:   Mon Mar 15 17:29:36 2010 +0000

    cherry-pick: 31b3aec7058e59abbdeb8f43fb9db95c9fe1ebe0
    
        2010-03-15  Sami Wagiaalla  <swagiaal@redhat.com>
    
            PR c++/7936:
            * cp-support.h: Added char *declaration element to using_direct
            data struct.
            (cp_add_using): Added char *declaration argument.
            (cp_add_using_directive): Ditto.
            (cp_lookup_symbol_imports): made extern.
            * cp-namespace.c: Updated with the above changes.
            * dwarf2read.c (read_import_statement): Ditto.
            (read_namespace): Ditto.
            (read_import_statement): Support import declarations.
            * cp-namespace.c (cp_lookup_symbol_imports): Check for imported
            declarations.
            Added support for 'declaration_only' search.
            (cp_lookup_symbol_namespace): Attempt to search for the name as
            is before consideration of imports.
            * symtab.c (lookup_symbol_aux_local): Added a 'declaration_only'
            search at every block level search.
            Now takes language argument.
            (lookup_symbol_aux): Updated.
    
        2010-03-15  Sami Wagiaalla  <swagiaal@redhat.com>
    
            * gdb.cp/shadow.exp: Removed kfail; test has been fix.
            * gdb.cp/nsusing.exp: Ditto.

-----------------------------------------------------------------------

Summary of changes:
 gdb/cp-namespace.c                                 |  368 ++++++++++----------
 gdb/cp-support.h                                   |   15 +-
 gdb/dwarf2read.c                                   |   51 ++--
 gdb/testsuite/gdb.cp/namespace-multiple-imports.cc |   20 -
 .../gdb.cp/namespace-multiple-imports.exp          |   49 ---
 gdb/testsuite/gdb.cp/namespace-recursive.cc        |   47 ---
 gdb/testsuite/gdb.cp/namespace-recursive.exp       |   75 ----
 .../gdb.cp/namespace-stress-declarations.cc        |   93 -----
 .../gdb.cp/namespace-stress-declarations.exp       |   50 ---
 gdb/testsuite/gdb.cp/namespace-stress.cc           |   60 ----
 gdb/testsuite/gdb.cp/namespace-stress.exp          |   50 ---
 gdb/testsuite/gdb.cp/nsusing.exp                   |    2 +-
 gdb/testsuite/gdb.cp/shadow.cc                     |    6 +-
 gdb/valops.c                                       |    6 +-
 14 files changed, 230 insertions(+), 662 deletions(-)
 delete mode 100644 gdb/testsuite/gdb.cp/namespace-multiple-imports.cc
 delete mode 100644 gdb/testsuite/gdb.cp/namespace-multiple-imports.exp
 delete mode 100644 gdb/testsuite/gdb.cp/namespace-recursive.cc
 delete mode 100644 gdb/testsuite/gdb.cp/namespace-recursive.exp
 delete mode 100644 gdb/testsuite/gdb.cp/namespace-stress-declarations.cc
 delete mode 100644 gdb/testsuite/gdb.cp/namespace-stress-declarations.exp
 delete mode 100644 gdb/testsuite/gdb.cp/namespace-stress.cc
 delete mode 100644 gdb/testsuite/gdb.cp/namespace-stress.exp

First 500 lines of diff:
diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
index c6df91f..0d99138 100644
--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -39,11 +39,6 @@ static struct symbol *lookup_namespace_scope (const char *name,
 					      const char *scope,
 					      int scope_len);
 
-static struct symbol *cp_lookup_symbol_in_namespace (const char *namespace,
-                                                     const char *name,
-                                                     const struct block *block,
-                                                     const domain_enum domain);
-
 static struct symbol *lookup_symbol_file (const char *name,
 					  const struct block *block,
 					  const domain_enum domain,
@@ -120,7 +115,7 @@ cp_scan_for_anonymous_namespaces (const struct symbol *symbol)
 		 anonymous namespace.  So add symbols in it to the
 		 namespace given by the previous component if there is
 		 one, or to the global namespace if there isn't.  */
-	      cp_add_using_directive (dest, src, NULL, "", 0,
+	      cp_add_using_directive (dest, src, NULL, NULL, 0,
 	                              &SYMBOL_SYMTAB (symbol)->objfile->objfile_obstack);
 	    }
 	  /* The "+ 2" is for the "::".  */
@@ -132,31 +127,39 @@ cp_scan_for_anonymous_namespaces (const struct symbol *symbol)
     }
 }
 
-/* Add a using directive to using_list. If the using directive in question
-   has already been added, don't add it twice.
+
+/* Add a using directive to using_directives.  If the using directive in
+   question has already been added, don't add it twice.
    Create a new struct using_direct which imports the namespace SRC into the
    scope DEST.  ALIAS is the name of the imported namespace in the current
    scope.  If ALIAS is NULL then the namespace is known by its original name.
-   The arguments are copied into newly allocated memory so they can be
-   temporaries.  */
+   DECLARATION is the name if the imported varable if this is a declaration
+   import (Eg. using A::x), otherwise it is NULL. The arguments are copied
+   into newly allocated memory so they can be temporaries.  */
 
 void
-cp_add_using_directive (const char *dest, const char *src, const char *alias,
-			const char *declaration, const int line_number,
-			struct obstack *obstack)
+cp_add_using_directive (const char *dest,
+			const char *src,
+			const char *alias,
+			const char *declaration,
+			const int line_number,
+                        struct obstack *obstack)
 {
   struct using_direct *current;
   struct using_direct *new;
-
+  
   /* Has it already been added?  */
 
   for (current = using_directives; current != NULL; current = current->next)
     {
       if (strcmp (current->import_src, src) == 0
-	  && strcmp (current->import_dest, dest) == 0
-	  && ((alias == NULL && current->alias == NULL)
-	      || (alias != NULL && current->alias != NULL
-		  && strcmp (alias, current->alias) == 0)))
+          && strcmp (current->import_dest, dest) == 0
+          && ((alias == NULL && current->alias == NULL)
+              || (alias != NULL && current->alias != NULL
+        	  && strcmp (alias, current->alias) == 0))
+	  && ((declaration == NULL && current->declaration == NULL)
+	      || (declaration != NULL && current->declaration != NULL
+		  && strcmp (declaration, current->declaration) == 0)))
 	return;
     }
 
@@ -168,7 +171,9 @@ cp_add_using_directive (const char *dest, const char *src, const char *alias,
   if (alias != NULL)
     new->alias = obsavestring (alias, strlen (alias), obstack);
 
-  new->declaration = obsavestring (declaration, strlen (declaration), obstack);
+  if (declaration != NULL)
+    new->declaration = obsavestring (declaration, strlen (declaration),
+                                     obstack);
   new->line_number = line_number;
 
   new->next = using_directives;
@@ -227,132 +232,48 @@ cp_is_anonymous (const char *namespace)
 /* The C++-specific version of name lookup for static and global
    names.  This makes sure that names get looked for in all namespaces
    that are in scope.  NAME is the natural name of the symbol that
-   we're looking for, LINKAGE_NAME (which is optional) is its linkage
-   name, BLOCK is the block that we're searching within, DOMAIN says
-   what kind of symbols we're looking for, and if SYMTAB is non-NULL,
-   we should store the symtab where we found the symbol in it.  */
+   we're looking for, BLOCK is the block that we're searching within,
+   DOMAIN says what kind of symbols we're looking for, and if SYMTAB is
+   non-NULL, we should store the symtab where we found the symbol in it.  */
 
 struct symbol *
 cp_lookup_symbol_nonlocal (const char *name,
 			   const struct block *block,
 			   const domain_enum domain)
 {
-  struct symbol *sym; 
+  struct symbol *sym;
   const char *scope = block_scope (block);
 
   sym = lookup_namespace_scope (name, block, domain, scope, 0);
   if (sym != NULL)
     return sym;
 
-  return cp_lookup_symbol_namespace(scope, name, block, domain);
+  return cp_lookup_symbol_namespace (scope, name, block, domain);
 }
 
-/* Searches for NAME in the current namespace, and by applying relevant import
-   statements belonging to BLOCK and its parents.  SCOPE is the namespace
-   scope of the context in which the search is being evaluated.  */
-
-struct symbol*
-cp_lookup_symbol_namespace (const char *scope,
-                            const char *name,
-                            const struct block *block,
-                            const domain_enum domain)
-{
-  struct symbol *sym;
-
-  /* First, try to find the symbol in the given namespace.  */
-  sym = cp_lookup_symbol_in_namespace (scope, name, block, domain);
-  if ( sym != NULL)
-    return sym;
-    
-  /* Search for name in namespaces imported to this and parent blocks.  */
-  while (block != NULL)
-    {
-      sym = cp_lookup_symbol_imports(scope,name, block, domain,0,1);
-
-      if (sym)
-        return sym;
-
-      block = BLOCK_SUPERBLOCK(block);
-    }
-
-  return NULL;
-}
-
-/* Lookup NAME at namespace scope (or, in C terms, in static and
-   global variables).  SCOPE is the namespace that the current
-   function is defined within; only consider namespaces whose length
-   is at least SCOPE_LEN.  Other arguments are as in
-   cp_lookup_symbol_nonlocal.
-
-   For example, if we're within a function A::B::f and looking for a
-   symbol x, this will get called with NAME = "x", SCOPE = "A::B", and
-   SCOPE_LEN = 0.  It then calls itself with NAME and SCOPE the same,
-   but with SCOPE_LEN = 1.  And then it calls itself with NAME and
-   SCOPE the same, but with SCOPE_LEN = 4.  This third call looks for
-   "A::B::x"; if it doesn't find it, then the second call looks for
-   "A::x", and if that call fails, then the first call looks for
-   "x".  */
-
-struct symbol *
-lookup_namespace_scope (const char *name,
-			const struct block *block,
-			const domain_enum domain,
-			const char *scope,
-			int scope_len)
-{
-  char *namespace;
-
-  if (scope[scope_len] != '\0')
-    {
-      /* Recursively search for names in child namespaces first.  */
-
-      struct symbol *sym;
-      int new_scope_len = scope_len;
-
-      /* If the current scope is followed by "::", skip past that.  */
-      if (new_scope_len != 0)
-	{
-	  gdb_assert (scope[new_scope_len] == ':');
-	  new_scope_len += 2;
-	}
-      new_scope_len += cp_find_first_component (scope + new_scope_len);
-      sym = lookup_namespace_scope (name, block, domain, scope, new_scope_len);
-      if (sym != NULL)
-	return sym;
-    }
-
-  /* Okay, we didn't find a match in our children, so look for the
-     name in the current namespace.  */
-
-  namespace = alloca (scope_len + 1);
-  strncpy (namespace, scope, scope_len);
-  namespace[scope_len] = '\0';
-  return cp_lookup_symbol_in_namespace (namespace, name,block, domain);
-}
-
-/* Look up NAME in the C++ namespace NAMESPACE. Other arguments are as in
+/* Look up NAME in the C++ namespace NAMESPACE.  Other arguments are as in
    cp_lookup_symbol_nonlocal.  */
 
 static struct symbol *
 cp_lookup_symbol_in_namespace (const char *namespace,
-			       const char *name,
-			       const struct block *block,
-			       const domain_enum domain)
+                               const char *name,
+                               const struct block *block,
+                               const domain_enum domain)
 {
 
   if (namespace[0] == '\0')
     {
-      return lookup_symbol_file (name, block,domain, 0);
+      return lookup_symbol_file (name, block, domain, 0);
     }
   else
     {
-      char *concatenated_name
-	= alloca (strlen (namespace) + 2 + strlen (name) + 1);
+      char *concatenated_name = alloca (strlen (namespace) + 2
+                                        + strlen (name) + 1);
       strcpy (concatenated_name, namespace);
       strcat (concatenated_name, "::");
       strcat (concatenated_name, name);
-      return lookup_symbol_file (concatenated_name, block, domain,
-				cp_is_anonymous (namespace));
+      return lookup_symbol_file (concatenated_name, block,
+                                 domain, cp_is_anonymous (namespace));
     }
 }
 
@@ -367,7 +288,7 @@ reset_directive_searched (void *data)
 }
 
 /* Search for NAME by applying all import statements belonging
-   to BLOCK which are applicable in SCOPE. If DECLARATION_ONLY the search
+   to BLOCK which are applicable in SCOPE.  If DECLARATION_ONLY the search
    is restricted to using declarations.
    Example:
 
@@ -377,7 +298,7 @@ reset_directive_searched (void *data)
      using A::x;
 
    If SEARCH_PARENTS the search will include imports which are applicable in
-   parents of scopes.
+   parents of SCOPE.
    Example:
 
      namespace A{
@@ -388,7 +309,7 @@ reset_directive_searched (void *data)
      }
 
    If SCOPE is "A::B" and SEARCH_PARENTS is true the imports of namespaces X
-   and Y will be considered. If SEARCH_PARENTS is false only the import of Y
+   and Y will be considered.  If SEARCH_PARENTS is false only the import of Y
    is considered.  */
 
 struct symbol *
@@ -396,20 +317,21 @@ cp_lookup_symbol_imports (const char *scope,
                           const char *name,
                           const struct block *block,
                           const domain_enum domain,
-                          int declaration_only,
-                          int search_parents)
+                          const int declaration_only,
+                          const int search_parents)
 {
   struct using_direct *current;
   struct symbol *sym = NULL;
+  int len;
   int directive_match;
   int current_line;
   struct cleanup *searched_cleanup;
 
-  if(!declaration_only)
-    /* First, try to find the symbol in the given namespace.  */
+  /* First, try to find the symbol in the given namespace.  */
+  if (!declaration_only)
     sym = cp_lookup_symbol_in_namespace (scope, name, block, domain);
-
-  if ( sym != NULL)
+  
+  if (sym != NULL)
     return sym;
 
   if (has_stack_frames ())
@@ -426,10 +348,9 @@ cp_lookup_symbol_imports (const char *scope,
        current != NULL;
        current = current->next)
     {
-  
+      len = strlen (current->import_dest);
       /* If the import destination is the current scope or one of its ancestors then
          it is applicable.  */
-      int len = strlen (current->import_dest);
       directive_match = (search_parents
                          ? (strncmp (scope, current->import_dest,
                                      strlen (current->import_dest)) == 0
@@ -441,68 +362,152 @@ cp_lookup_symbol_imports (const char *scope,
           current->line_number < current_line &&
           !current->searched)
 	{
-	  current->searched = 1;
-	  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 (strcmp ("", current->declaration) != 0)
-	    {
-	    if (strcmp (name, current->declaration) == 0)
-	      {
-	      sym = cp_lookup_symbol_in_namespace (current->import_src,
-	                                           name,
-	                                           block,
-	                                           domain);
-	      }
-
-	    current->searched = 0;
-	    if (sym)
-	      return sym;
-
-	    continue;
-	    }
-	   
-	  if (declaration_only)
-	    {
-	    current->searched = 0;
-	    discard_cleanups (searched_cleanup);
-	    continue;
-	    }
-
-	  if (current->alias != NULL && strcmp (name, current->alias) == 0)
-	    /* If the import is creating an alias and the alias matches the
-	       sought name. Pass current->inner as the NAME to direct the
-	       search towards the aliased namespace */
-	    {
+	/* Mark this import as searched so that the recursive call does not
+           search it again.  */
+	current->searched = 1;
+	searched_cleanup = make_cleanup (reset_directive_searched, current);
+
+	/* If there is an import of a single declaration, compare the imported
+	   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,
+	                                       block,
+	                                       domain);
+
+	/* If this is a DECLARATION_ONLY search or a symbol was found or
+	   this import statement was an import declaration, the search
+	   of this import is complete.  */
+        if (declaration_only || sym != NULL || current->declaration)
+          {
+            current->searched = 0;
+            discard_cleanups (searched_cleanup);
+
+            if (sym != NULL)
+              return sym;
+
+            continue;
+          }
+
+	if (current->alias != NULL && strcmp (name, current->alias) == 0)
+	  /* If the import is creating an alias and the alias matches the
+	     sought name.  Pass current->import_src as the NAME to direct the
+	     search towards the aliased namespace.  */
+	  {
 	    sym = cp_lookup_symbol_in_namespace (scope,
 	                                         current->import_src,
 	                                         block,
 	                                         domain);
-	    } else if (current->alias == NULL){
+	  }
+	else if (current->alias == NULL)
+	  {
 	    /* If this import statement creates no alias, pass current->inner as
-	       NAMESPACE to direct the search towards the imported namespace. */
-	      sym = cp_lookup_symbol_imports (current->import_src,
-	                                      name,
-	                                      block,
-	                                      domain,
-	                                      0,
-	                                      0);
-	    }
+               NAMESPACE to direct the search towards the imported namespace.  */
+	    sym = cp_lookup_symbol_imports (current->import_src,
+	                                    name,
+	                                    block,
+	                                    domain,
+	                                    0,
+	                                    0);
+	  }
+	current->searched = 0;
+	discard_cleanups (searched_cleanup);
+
+	if (sym != NULL)
+	  return sym;
+	}
+    }
 
-	  current->searched = 0;
-	  discard_cleanups (searched_cleanup);
+  return NULL;
+}
 
-	  if (sym != NULL)
-	    return sym;
-	}
+ /* Searches for NAME in the current namespace, and by applying relevant import
+    statements belonging to BLOCK and its parents. SCOPE is the namespace scope
+    of the context in which the search is being evaluated.  */
+
+struct symbol*
+cp_lookup_symbol_namespace (const char *scope,
+                            const char *name,
+                            const struct block *block,
+                            const domain_enum domain)
+{
+  struct symbol *sym;
+  
+  /* First, try to find the symbol in the given namespace.  */
+  sym = cp_lookup_symbol_in_namespace (scope, name, block, domain);
+  if (sym != NULL)
+    return sym;
+
+  /* Search for name in namespaces imported to this and parent blocks.  */
+  while (block != NULL)
+    {
+      sym = cp_lookup_symbol_imports (scope, name, block, domain, 0, 1);
+
+      if (sym)
+	return sym;
+
+      block = BLOCK_SUPERBLOCK (block);
     }
 
   return NULL;
 }
 
+/* Lookup NAME at namespace scope (or, in C terms, in static and
+   global variables).  SCOPE is the namespace that the current
+   function is defined within; only consider namespaces whose length
+   is at least SCOPE_LEN.  Other arguments are as in
+   cp_lookup_symbol_nonlocal.
+
+   For example, if we're within a function A::B::f and looking for a
+   symbol x, this will get called with NAME = "x", SCOPE = "A::B", and
+   SCOPE_LEN = 0.  It then calls itself with NAME and SCOPE the same,
+   but with SCOPE_LEN = 1.  And then it calls itself with NAME and
+   SCOPE the same, but with SCOPE_LEN = 4.  This third call looks for
+   "A::B::x"; if it doesn't find it, then the second call looks for
+   "A::x", and if that call fails, then the first call looks for
+   "x".  */
+
+static struct symbol *
+lookup_namespace_scope (const char *name,
+			const struct block *block,
+			const domain_enum domain,
+			const char *scope,
+			int scope_len)
+{
+  char *namespace;
+
+  if (scope[scope_len] != '\0')
+    {
+      /* Recursively search for names in child namespaces first.  */
+
+      struct symbol *sym;
+      int new_scope_len = scope_len;
+
+      /* If the current scope is followed by "::", skip past that.  */
+      if (new_scope_len != 0)
+	{
+	  gdb_assert (scope[new_scope_len] == ':');
+	  new_scope_len += 2;
+	}
+      new_scope_len += cp_find_first_component (scope + new_scope_len);
+      sym = lookup_namespace_scope (name, block, domain, scope, new_scope_len);
+      if (sym != NULL)
+	return sym;
+    }
+
+  /* Okay, we didn't find a match in our children, so look for the
+     name in the current namespace.  */
+
+  namespace = alloca (scope_len + 1);
+  strncpy (namespace, scope, scope_len);
+  namespace[scope_len] = '\0';
+  return cp_lookup_symbol_in_namespace (namespace, name, block, domain);


hooks/post-receive
--
Repository for Project Archer.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-05-05 20:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-05 20:33 [SCM] archer-keiths-expr-cumulative: Remove tests renamed upstream swagiaal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).