FreeBSD/contrib/gcc/cp/tree.c
/* Returns the kind of linkage associated with the indicated DECL.  Th
   value returned is as specified by the language standard; it is
   independent of implementation details regarding template
   instantiation, etc.  For example, it is possible that a declaration
   to which this function assigns external linkage would not show up
   as a global symbol when you run `nm' on the resulting object file.  */
Returns the kind of linkage associated with the indicated DECL.  Th
value returned is as specified by the language standard; it is
independent of implementation details regarding template
instantiation, etc.  For example, it is possible that a declaration
to which this function assigns external linkage would not show up
as a global symbol when you run `nm' on the resulting object file.
Returns the kind of linkage associated with the indicated DECL . Th value returned is as specified by the language standard ; it is independent of implementation details regarding template instantiation etc . For example it is possible that a declaration to which this function assigns external linkage would not show up as a global symbol when you run ` nm ' on the resulting object file .
linkage_kind
decl_linkage (tree decl)
{
  if (!DECL_NAME (decl))
    return lk_none;
  if (TREE_PUBLIC (decl))
    return lk_external;
  if (TREE_CODE (decl) == NAMESPACE_DECL)
    return lk_external;
  if (TREE_CODE (decl) == CONST_DECL)
    return decl_linkage (TYPE_NAME (TREE_TYPE (decl)));
  if (TREE_CODE (decl) != TYPE_DECL && DECL_LANG_SPECIFIC (decl)
      && DECL_COMDAT (decl))
    return lk_external;
  if (decl_function_context (decl))
    return lk_none;
  if (TREE_CODE (decl) == TYPE_DECL
      || ((TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == FUNCTION_DECL)
	  && !DECL_THIS_STATIC (decl)))
    return lk_external;
  return lk_internal;
}
linkage_kind decl_linkage ( tree decl ) { if ( ! DECL_NAME ( decl ) ) return lk_none ; if ( TREE_PUBLIC ( decl ) ) return lk_external ; if ( TREE_CODE ( decl ) == NAMESPACE_DECL ) return lk_external ; if ( TREE_CODE ( decl ) == CONST_DECL ) return decl_linkage ( TYPE_NAME ( TREE_TYPE ( decl ) ) ) ; if ( TREE_CODE ( decl ) != TYPE_DECL && DECL_LANG_SPECIFIC ( decl ) && DECL_COMDAT ( decl ) ) return lk_external ; if ( decl_function_context ( decl ) ) return lk_none ; if ( TREE_CODE ( decl ) == TYPE_DECL || ( ( TREE_CODE ( decl ) == VAR_DECL || TREE_CODE ( decl ) == FUNCTION_DECL ) && ! DECL_THIS_STATIC ( decl ) ) ) return lk_external ; return lk_internal ; }
Returns the kind of linkage associated with the indicated DECL.
Returns the kind of linkage associated with the indicated DECL .
/* This function doesn't attempt to calculate the linkage from first
     principles as given in [basic.link].  Instead, it makes use of
     the fact that we have already set TREE_PUBLIC appropriately, and
     then handles a few special cases.  Ideally, we would calculate
     linkage first, and then transform that into a concrete
     implementation.  */ /* Things that don't have names have no linkage.  */ /* Things that are TREE_PUBLIC have external linkage.  */ /* Linkage of a CONST_DECL depends on the linkage of the enumeration
     type.  */ /* Some things that are not TREE_PUBLIC have external linkage, too.
     For example, on targets that don't have weak symbols, we make all
     template instantiations have internal linkage (in the object
     file), but the symbols should still be treated as having external
     linkage from the point of view of the language.  */ /* Things in local scope do not have linkage, if they don't have
     TREE_PUBLIC set.  */ /* Members of the anonymous namespace also have TREE_PUBLIC unset, but
     are considered to have external linkage for language purposes.  DECLs
     really meant to have internal linkage have DECL_THIS_STATIC set.  */ /* Everything else has internal linkage.  */