FreeBSD/contrib/gcc/cp/method.c
/* Finish THUNK, a thunk decl.  */
Finish THUNK, a thunk decl.
Finish THUNK a thunk decl .
void
finish_thunk (tree thunk)
{
  tree function, name;
  tree fixed_offset = ssize_int (THUNK_FIXED_OFFSET (thunk));
  tree virtual_offset = THUNK_VIRTUAL_OFFSET (thunk);
  gcc_assert (!DECL_NAME (thunk) && DECL_THUNK_P (thunk));
  if (virtual_offset && DECL_RESULT_THUNK_P (thunk))
    virtual_offset = BINFO_VPTR_FIELD (virtual_offset);
  function = THUNK_TARGET (thunk);
  name = mangle_thunk (function, DECL_THIS_THUNK_P (thunk),
		       fixed_offset, virtual_offset);
  if (DECL_RESULT_THUNK_P (thunk))
    {
      tree cov_probe;
      for (cov_probe = DECL_THUNKS (function);
	   cov_probe; cov_probe = TREE_CHAIN (cov_probe))
	if (DECL_NAME (cov_probe) == name)
	  {
	    gcc_assert (!DECL_THUNKS (thunk));
	    THUNK_ALIAS (thunk) = (THUNK_ALIAS (cov_probe)
				   ? THUNK_ALIAS (cov_probe) : cov_probe);
	    break;
	  }
    }
  DECL_NAME (thunk) = name;
  SET_DECL_ASSEMBLER_NAME (thunk, name);
}
void finish_thunk ( tree thunk ) { tree function , name ; tree fixed_offset = ssize_int ( THUNK_FIXED_OFFSET ( thunk ) ) ; tree virtual_offset = THUNK_VIRTUAL_OFFSET ( thunk ) ; gcc_assert ( ! DECL_NAME ( thunk ) && DECL_THUNK_P ( thunk ) ) ; if ( virtual_offset && DECL_RESULT_THUNK_P ( thunk ) ) virtual_offset = BINFO_VPTR_FIELD ( virtual_offset ) ; function = THUNK_TARGET ( thunk ) ; name = mangle_thunk ( function , DECL_THIS_THUNK_P ( thunk ) , fixed_offset , virtual_offset ) ; if ( DECL_RESULT_THUNK_P ( thunk ) ) { tree cov_probe ; for ( cov_probe = DECL_THUNKS ( function ) ; cov_probe ; cov_probe = TREE_CHAIN ( cov_probe ) ) if ( DECL_NAME ( cov_probe ) == name ) { gcc_assert ( ! DECL_THUNKS ( thunk ) ) ; THUNK_ALIAS ( thunk ) = ( THUNK_ALIAS ( cov_probe ) ? THUNK_ALIAS ( cov_probe ) : cov_probe ) ; break ; } } DECL_NAME ( thunk ) = name ; SET_DECL_ASSEMBLER_NAME ( thunk , name ) ; }
Finish THUNK, a thunk decl.
Finish THUNK a thunk decl .
/* We can end up with declarations of (logically) different
     covariant thunks, that do identical adjustments.  The two thunks
     will be adjusting between within different hierarchies, which
     happen to have the same layout.  We must nullify one of them to
     refer to the other.  */