contrib/gdb-7/gdb/cp-namespace.c
void
cp_add_using_directive (const char *dest,
			const char *src,
			const char *alias,
			const char *declaration,
			VEC (const_char_ptr) *excludes,
                        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)
    {
      int ix;
      const char *param;

      if (strcmp (current->import_src, src) != 0)
	continue;
      if (strcmp (current->import_dest, dest) != 0)
	continue;
      if ((alias == NULL && current->alias != NULL)
	  || (alias != NULL && current->alias == NULL)
	  || (alias != NULL && current->alias != NULL
	      && strcmp (alias, current->alias) != 0))
	continue;
      if ((declaration == NULL && current->declaration != NULL)
	  || (declaration != NULL && current->declaration == NULL)
	  || (declaration != NULL && current->declaration != NULL
	      && strcmp (declaration, current->declaration) != 0))
	continue;

      /* Compare the contents of EXCLUDES.  */
      for (ix = 0; VEC_iterate (const_char_ptr, excludes, ix, param); ix++)
	if (current->excludes[ix] == NULL
	    || strcmp (param, current->excludes[ix]) != 0)
	  break;
      if (ix < VEC_length (const_char_ptr, excludes)
	  || current->excludes[ix] != NULL)
	continue;

      /* Parameters exactly match CURRENT.  */
      return;
    }

  new = obstack_alloc (obstack, (sizeof (*new)
				 + (VEC_length (const_char_ptr, excludes)
				    * sizeof (*new->excludes))));
  memset (new, 0, sizeof (*new));

  new->import_src = obsavestring (src, strlen (src), obstack);
  new->import_dest = obsavestring (dest, strlen (dest), obstack);

  if (alias != NULL)
    new->alias = obsavestring (alias, strlen (alias), obstack);

  if (declaration != NULL)
    new->declaration = obsavestring (declaration, strlen (declaration),
                                     obstack);

  memcpy (new->excludes, VEC_address (const_char_ptr, excludes),
	  VEC_length (const_char_ptr, excludes) * sizeof (*new->excludes));
  new->excludes[VEC_length (const_char_ptr, excludes)] = NULL;

  new->next = using_directives;
  using_directives = new;
}
/* 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.  DECLARATION is the name if the imported
   varable if this is a declaration import (Eg. using A::x), otherwise
   it is NULL.  EXCLUDES is a list of names not to import from an imported
   module or NULL.  The arguments are copied into newly allocated memory so
   they can be temporaries.  For EXCLUDES the VEC pointers are copied but the
   pointed to characters are not copied.  */
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.  DECLARATION is the name if the imported
varable if this is a declaration import , otherwise
it is NULL.  EXCLUDES is a list of names not to import from an imported
module or NULL.  The arguments are copied into newly allocated memory so
they can be temporaries.  For EXCLUDES the VEC pointers are copied but the
pointed to characters are not copied.
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 . DECLARATION is the name if the imported varable if this is a declaration import otherwise it is NULL . EXCLUDES is a list of names not to import from an imported module or NULL . The arguments are copied into newly allocated memory so they can be temporaries . For EXCLUDES the VEC pointers are copied but the pointed to characters are not copied .
void
cp_add_using_directive (const char *dest,
			const char *src,
			const char *alias,
			const char *declaration,
			VEC (const_char_ptr) *excludes,
                        struct obstack *obstack)
{
  struct using_direct *current;
  struct using_direct *new;
  for (current = using_directives; current != NULL; current = current->next)
    {
      int ix;
      const char *param;
      if (strcmp (current->import_src, src) != 0)
	continue;
      if (strcmp (current->import_dest, dest) != 0)
	continue;
      if ((alias == NULL && current->alias != NULL)
	  || (alias != NULL && current->alias == NULL)
	  || (alias != NULL && current->alias != NULL
	      && strcmp (alias, current->alias) != 0))
	continue;
      if ((declaration == NULL && current->declaration != NULL)
	  || (declaration != NULL && current->declaration == NULL)
	  || (declaration != NULL && current->declaration != NULL
	      && strcmp (declaration, current->declaration) != 0))
	continue;
      for (ix = 0; VEC_iterate (const_char_ptr, excludes, ix, param); ix++)
	if (current->excludes[ix] == NULL
	    || strcmp (param, current->excludes[ix]) != 0)
	  break;
      if (ix < VEC_length (const_char_ptr, excludes)
	  || current->excludes[ix] != NULL)
	continue;
      return;
    }
  new = obstack_alloc (obstack, (sizeof (*new)
				 + (VEC_length (const_char_ptr, excludes)
				    * sizeof (*new->excludes))));
  memset (new, 0, sizeof (*new));
  new->import_src = obsavestring (src, strlen (src), obstack);
  new->import_dest = obsavestring (dest, strlen (dest), obstack);
  if (alias != NULL)
    new->alias = obsavestring (alias, strlen (alias), obstack);
  if (declaration != NULL)
    new->declaration = obsavestring (declaration, strlen (declaration),
                                     obstack);
  memcpy (new->excludes, VEC_address (const_char_ptr, excludes),
	  VEC_length (const_char_ptr, excludes) * sizeof (*new->excludes));
  new->excludes[VEC_length (const_char_ptr, excludes)] = NULL;
  new->next = using_directives;
  using_directives = new;
}
void cp_add_using_directive ( const char * dest , const char * src , const char * alias , const char * declaration , VEC ( const_char_ptr ) * excludes , struct obstack * obstack ) { struct using_direct * current ; struct using_direct * new ; for ( current = using_directives ; current != NULL ; current = current -> next ) { int ix ; const char * param ; if ( strcmp ( current -> import_src , src ) != 0 ) continue ; if ( strcmp ( current -> import_dest , dest ) != 0 ) continue ; if ( ( alias == NULL && current -> alias != NULL ) || ( alias != NULL && current -> alias == NULL ) || ( alias != NULL && current -> alias != NULL && strcmp ( alias , current -> alias ) != 0 ) ) continue ; if ( ( declaration == NULL && current -> declaration != NULL ) || ( declaration != NULL && current -> declaration == NULL ) || ( declaration != NULL && current -> declaration != NULL && strcmp ( declaration , current -> declaration ) != 0 ) ) continue ; for ( ix = 0 ; VEC_iterate ( const_char_ptr , excludes , ix , param ) ; ix ++ ) if ( current -> excludes [ ix ] == NULL || strcmp ( param , current -> excludes [ ix ] ) != 0 ) break ; if ( ix < VEC_length ( const_char_ptr , excludes ) || current -> excludes [ ix ] != NULL ) continue ; return ; } new = obstack_alloc ( obstack , ( sizeof ( * new ) + ( VEC_length ( const_char_ptr , excludes ) * sizeof ( * new -> excludes ) ) ) ) ; memset ( new , 0 , sizeof ( * new ) ) ; new -> import_src = obsavestring ( src , strlen ( src ) , obstack ) ; new -> import_dest = obsavestring ( dest , strlen ( dest ) , obstack ) ; if ( alias != NULL ) new -> alias = obsavestring ( alias , strlen ( alias ) , obstack ) ; if ( declaration != NULL ) new -> declaration = obsavestring ( declaration , strlen ( declaration ) , obstack ) ; memcpy ( new -> excludes , VEC_address ( const_char_ptr , excludes ) , VEC_length ( const_char_ptr , excludes ) * sizeof ( * new -> excludes ) ) ; new -> excludes [ VEC_length ( const_char_ptr , excludes ) ] = NULL ; new -> next = using_directives ; using_directives = new ; }
Add a using directive to using_directives.
Add a using directive to using_directives .
/* Has it already been added?  */ /* Compare the contents of EXCLUDES.  */ /* Parameters exactly match CURRENT.  */