FreeBSD/contrib/gcc/cp/name-lookup.c
/* Insert USED into the using list of USER. Set INDIRECT_flag if this
   directive is not directly from the source. Also find the common
   ancestor and let our users know about the new namespace */
Insert USED into the using list of USER. Set INDIRECT_flag if this
directive is not directly from the source. Also find the common
ancestor and let our users know about the new namespace
Insert USED into the using list of USER . Set INDIRECT_flag if this directive is not directly from the source . Also find the common ancestor and let our users know about the new namespace
static void
add_using_namespace (tree user, tree used, bool indirect)
{
  tree t;
  timevar_push (TV_NAME_LOOKUP);
  if (user == used)
    {
      timevar_pop (TV_NAME_LOOKUP);
      return;
    }
  gcc_assert (TREE_CODE (user) == NAMESPACE_DECL);
  gcc_assert (TREE_CODE (used) == NAMESPACE_DECL);
  t = purpose_member (used, DECL_NAMESPACE_USING (user));
  if (t != NULL_TREE)
    {
      if (!indirect)
	TREE_INDIRECT_USING (t) = 0;
      timevar_pop (TV_NAME_LOOKUP);
      return;
    }
  DECL_NAMESPACE_USING (user)
    = tree_cons (used, namespace_ancestor (user, used),
		 DECL_NAMESPACE_USING (user));
  TREE_INDIRECT_USING (DECL_NAMESPACE_USING (user)) = indirect;
  DECL_NAMESPACE_USERS (used)
    = tree_cons (user, 0, DECL_NAMESPACE_USERS (used));
  for (t = DECL_NAMESPACE_USING (used); t; t = TREE_CHAIN (t))
    add_using_namespace (user, TREE_PURPOSE (t), 1);
  for (t = DECL_NAMESPACE_USERS (user); t; t = TREE_CHAIN (t))
    add_using_namespace (TREE_PURPOSE (t), used, 1);
  timevar_pop (TV_NAME_LOOKUP);
}
static void add_using_namespace ( tree user , tree used , bool indirect ) { tree t ; timevar_push ( TV_NAME_LOOKUP ) ; if ( user == used ) { timevar_pop ( TV_NAME_LOOKUP ) ; return ; } gcc_assert ( TREE_CODE ( user ) == NAMESPACE_DECL ) ; gcc_assert ( TREE_CODE ( used ) == NAMESPACE_DECL ) ; t = purpose_member ( used , DECL_NAMESPACE_USING ( user ) ) ; if ( t != NULL_TREE ) { if ( ! indirect ) TREE_INDIRECT_USING ( t ) = 0 ; timevar_pop ( TV_NAME_LOOKUP ) ; return ; } DECL_NAMESPACE_USING ( user ) = tree_cons ( used , namespace_ancestor ( user , used ) , DECL_NAMESPACE_USING ( user ) ) ; TREE_INDIRECT_USING ( DECL_NAMESPACE_USING ( user ) ) = indirect ; DECL_NAMESPACE_USERS ( used ) = tree_cons ( user , 0 , DECL_NAMESPACE_USERS ( used ) ) ; for ( t = DECL_NAMESPACE_USING ( used ) ; t ; t = TREE_CHAIN ( t ) ) add_using_namespace ( user , TREE_PURPOSE ( t ) , 1 ) ; for ( t = DECL_NAMESPACE_USERS ( user ) ; t ; t = TREE_CHAIN ( t ) ) add_using_namespace ( TREE_PURPOSE ( t ) , used , 1 ) ; timevar_pop ( TV_NAME_LOOKUP ) ; }
Insert USED into the using list of USER.
Insert USED into the using list of USER .
/* Using oneself is a no-op.  */ /* Check if we already have this.  */ /* Promote to direct usage.  */ /* Add used to the user's using list.  */ /* Add user to the used's users list.  */ /* Recursively add all namespaces used.  */ /* indirect usage */ /* Tell everyone using us about the new used namespaces.  */