⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 method.c

📁 gcc-2.95.3 Linux下最常用的C编译器
💻 C
📖 第 1 页 / 共 5 页
字号:
	      OB_PUTC ('z');	      build_template_template_parm_names		(DECL_INNERMOST_TEMPLATE_PARMS (parm));	      icat (IDENTIFIER_LENGTH (DECL_NAME (arg)));	      OB_PUTID (DECL_NAME (arg));	    }	}      else	{	  parm = tsubst (parm, arglist, /*complain=*/1, NULL_TREE);	  /* It's a PARM_DECL.  */	  build_mangled_name_for_type (TREE_TYPE (parm));	  build_overload_value (TREE_TYPE (parm), arg, 				uses_template_parms (arglist));	}    } }/* Output the representation for NAME, which is either a TYPE_DECL or   an IDENTIFIER.  */static voidbuild_overload_identifier (name)     tree name;{  if (TREE_CODE (name) == TYPE_DECL      && CLASS_TYPE_P (TREE_TYPE (name))      && CLASSTYPE_TEMPLATE_INFO (TREE_TYPE (name))      && (PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (TREE_TYPE (name)))	  || (TREE_CODE (DECL_CONTEXT (CLASSTYPE_TI_TEMPLATE 				       (TREE_TYPE (name))))	      == FUNCTION_DECL)))    {      /* NAME is the TYPE_DECL for a template specialization.  */      tree template, parmlist, arglist, tname;      template = CLASSTYPE_TI_TEMPLATE (TREE_TYPE (name));      arglist = CLASSTYPE_TI_ARGS (TREE_TYPE (name));      tname = DECL_NAME (template);      parmlist = DECL_INNERMOST_TEMPLATE_PARMS (template);      OB_PUTC ('t');      icat (IDENTIFIER_LENGTH (tname));      OB_PUTID (tname);      build_template_parm_names (parmlist, arglist);    }  else    {      if (TREE_CODE (name) == TYPE_DECL)	name = DECL_NAME (name);      if (numeric_output_need_bar)	{	  OB_PUTC ('_');	  numeric_output_need_bar = 0;	}      icat (IDENTIFIER_LENGTH (name));      OB_PUTID (name);    }}/* Given DECL, either a class TYPE, TYPE_DECL or FUNCTION_DECL, produce   the mangling for it.  Used by build_mangled_name and build_static_name.  */static voidbuild_qualified_name (decl)     tree decl;{  tree context;  int i = 1;  if (TREE_CODE_CLASS (TREE_CODE (decl)) == 't')    decl = TYPE_NAME (decl);  /* If DECL_ASSEMBLER_NAME has been set properly, use it.  */  if (TREE_CODE (decl) == TYPE_DECL      && DECL_ASSEMBLER_NAME (decl) != DECL_NAME (decl) && !flag_do_squangling)    {      tree id = DECL_ASSEMBLER_NAME (decl);      OB_PUTID (id);      if (ISDIGIT (IDENTIFIER_POINTER (id) [IDENTIFIER_LENGTH (id) - 1]))	numeric_output_need_bar = 1;      return;    }  context = decl;  /* If we can't find a Ktype, do it the hard way.  */  if (check_ktype (context, FALSE) == -1)    {      /* Count type and namespace scopes.  */      while (1)	{	  context = CP_DECL_CONTEXT (context);	  if (context == global_namespace)	    break;	  i += 1;	  if (check_ktype (context, FALSE) != -1)	    /* Found one!  */	    break;	  if (TREE_CODE_CLASS (TREE_CODE (context)) == 't')	    context = TYPE_NAME (context);	}    }  if (i > 1)    {      OB_PUTC ('Q');      build_underscore_int (i);      numeric_output_need_bar = 0;    }  build_overload_nested_name (decl);}/* Output the mangled representation for TYPE.  If EXTRA_GCODE is   non-zero, mangled names for structure/union types are intentionally   mangled differently from the method described in the ARM.  */static void build_mangled_name_for_type_with_Gcode (type, extra_Gcode)     tree type;     int extra_Gcode;{  if (TYPE_PTRMEMFUNC_P (type))    type = TYPE_PTRMEMFUNC_FN_TYPE (type);  process_modifiers (type);  process_overload_item (type, extra_Gcode);}/* Like build_mangled_name_for_type_with_Gcode, but never outputs the   `G'.  */static voidbuild_mangled_name_for_type (type)     tree type;{  build_mangled_name_for_type_with_Gcode (type, 0);}/* Given a list of parameters in PARMTYPES, create an unambiguous   overload string. Should distinguish any type that C (or C++) can   distinguish. I.e., pointers to functions are treated correctly.   Caller must deal with whether a final `e' goes on the end or not.   Any default conversions must take place before this function   is called.   BEGIN and END control initialization and finalization of the   obstack where we build the string.  */char *build_overload_name (parmtypes, begin, end)     tree parmtypes;     int begin, end;{  char *ret;  start_squangling ();  ret = build_mangled_name (parmtypes, begin, end);  end_squangling ();  return ret ;}/* Output the mangled representation for PARMTYPES.  If PARMTYPES is a   TREE_LIST, then it is a list of parameter types.  Otherwise,   PARMTYPES must be a single type.  */static char *build_mangled_name (parmtypes, begin, end)     tree parmtypes;     int begin, end;{  if (begin)     OB_INIT ();  if (TREE_CODE (parmtypes) != TREE_LIST)      /* There is only one type.  */    build_mangled_name_for_type (parmtypes);  else      {      /* There are several types in a parameter list.  */      int nrepeats = 0;      int old_style_repeats = !flag_do_squangling && !nofold && typevec;      tree last_type = NULL_TREE;      for (; parmtypes && parmtypes != void_list_node;	   parmtypes = TREE_CHAIN (parmtypes))	{	  /* We used to call canonical_type_variant here, but that isn't	     good enough; it doesn't handle pointers to typedef types.  So	     we can't just set TREE_USED to say we've seen a type already;	     we have to check each of the earlier types with same_type_p.  */	  tree parmtype = TREE_VALUE (parmtypes);	  if (old_style_repeats)	    {	      /* Every argument gets counted.  */	      my_friendly_assert (maxtype < typevec_size, 387);	      typevec[maxtype++] = parmtype;	    }	  if (last_type && same_type_p (parmtype, last_type))	    {	      if (flag_do_squangling 		  || (old_style_repeats		      && is_back_referenceable_type (parmtype)))		{		  /* The next type is the same as this one.  Keep		     track of the repetition, and output the repeat		     count later.  */		  nrepeats++;		  continue;		}	    }	  else if (nrepeats != 0)	    {	      /* Indicate how many times the previous parameter was		 repeated.  */	      if (old_style_repeats)		flush_repeats (nrepeats, last_type);	      else		issue_nrepeats (nrepeats, last_type);	      nrepeats = 0;	    }	  	  last_type = parmtype;	  /* Note that for bug-compatibility with 2.7.2, we can't build up	     repeats of types other than the most recent one.  So we call	     flush_repeats every round, if we get this far.  */	  if (old_style_repeats && flush_repeats (0, parmtype))	    continue;	  /* Output the PARMTYPE.  */	  build_mangled_name_for_type_with_Gcode (parmtype, 1);	}      /* Output the repeat count for the last parameter, if	 necessary.  */      if (nrepeats != 0)	{	  if (old_style_repeats)	    flush_repeats (nrepeats, last_type);	  else	    issue_nrepeats (nrepeats, last_type);	  nrepeats = 0;	}      if (!parmtypes)	/* The parameter list ends in an ellipsis.  */	OB_PUTC ('e');    }  if (end)     OB_FINISH ();  return (char *)obstack_base (&scratch_obstack);}/* Emit modifiers such as constant, read-only, and volatile.  */static void process_modifiers (parmtype)      tree parmtype;{  /* Note that here we do not use CP_TYPE_CONST_P and friends because     we describe types recursively; we will get the `const' in      `const int ()[10]' when processing the `const int' part.  */  if (TYPE_READONLY (parmtype))    OB_PUTC ('C');  if (TREE_CODE (parmtype) == INTEGER_TYPE      && parmtype != char_type_node      && parmtype != wchar_type_node      && (TYPE_MAIN_VARIANT (parmtype)	  == unsigned_type (TYPE_MAIN_VARIANT (parmtype)))      && ! TYPE_FOR_JAVA (parmtype))    OB_PUTC ('U');  if (TYPE_VOLATILE (parmtype))    OB_PUTC ('V');  /* It would be better to use `R' for `restrict', but that's already     used for reference types.  And `r' is used for `long double'.  */  if (TYPE_RESTRICT (parmtype))    OB_PUTC ('u');}/* Check to see if TYPE has been entered into the Bcode typelist.  If   so, return 1 and emit a backreference to TYPE.  Otherwise, add TYPE   to the list of back-referenceable types and return 0.  */static int check_btype (type)      tree type;{  int x;  if (btypelist == NULL)    return 0;  if (!is_back_referenceable_type (type))    return 0;  for (x = 0; x < maxbtype; x++)     if (same_type_p (type, btypelist[x]))      {	OB_PUTC ('B');	icat (x);	if (x > 9)	  OB_PUTC ('_');	return 1 ;      }  if (maxbsize <= maxbtype)     {      /* Enlarge the table.  */      maxbsize = maxbsize * 3 / 2;      btypelist = (tree *)xrealloc (btypelist, sizeof (tree) * maxbsize);     }    /* Register the TYPE.  */  btypelist[maxbtype++] = type;  return 0;}/* Emit the correct code for various node types.  */static void process_overload_item (parmtype, extra_Gcode)   tree parmtype;  int extra_Gcode;{  numeric_output_need_bar = 0;  /* Our caller should have already handed any qualifiers, so pull out the     TYPE_MAIN_VARIANT to avoid typedef confusion.  Except we can't do that     for arrays, because they are transparent to qualifiers.  Sigh.  */  if (TREE_CODE (parmtype) == ARRAY_TYPE)    parmtype = canonical_type_variant (parmtype);  else    parmtype = TYPE_MAIN_VARIANT (parmtype);  /* These tree types are considered modifiers for B code squangling,     and therefore should not get entries in the Btypelist.  They are,     however, repeatable types.  */  switch (TREE_CODE (parmtype))    {    case REFERENCE_TYPE:      OB_PUTC ('R');      goto more;    case ARRAY_TYPE:#if PARM_CAN_BE_ARRAY_TYPE      {        OB_PUTC ('A');        if (TYPE_DOMAIN (parmtype) == NULL_TREE)	  OB_PUTC ('_');        else	  {	    tree length = array_type_nelts (parmtype);	    if (TREE_CODE (length) != INTEGER_CST || flag_do_squangling)	      {		length = fold (build (PLUS_EXPR, TREE_TYPE (length),				      length, integer_one_node));		STRIP_NOPS (length);	      }	    build_overload_value (sizetype, length, 1);	  }	if (numeric_output_need_bar && ! flag_do_squangling)	  OB_PUTC ('_');        goto more;      }#else      OB_PUTC ('P');      goto more;#endif    case POINTER_TYPE:      /* Even though the vlist_type_node is PPPFe (i.e. `int	 (***)(...)'), it is different from the any other occurence of	 the pointer type, because the underlying function type is	 different.  */      if (parmtype == vlist_type_node)	{	  OB_PUTS (VLIST_TYPE_NAME);	  return;	}      OB_PUTC ('P');    more:      build_mangled_name_for_type (TREE_TYPE (parmtype));      return;      break;    default:      break;    }    if (flag_do_squangling && check_btype (parmtype))     /* If PARMTYPE is already in the list of back-referenceable types,       then check_btype will output the appropriate reference, and       there's nothing more to do.  */    return;  switch (TREE_CODE (parmtype))    {    case OFFSET_TYPE:      OB_PUTC ('O');      build_mangled_name_for_type (TYPE_OFFSET_BASETYPE (parmtype));      OB_PUTC ('_');      build_mangled_name_for_type (TREE_TYPE (parmtype));      break;    case FUNCTION_TYPE:    case METHOD_TYPE:      {        tree parms = TYPE_ARG_TYPES (parmtype);	/* Rather than implementing a reentrant TYPEVEC, we turn off	   repeat codes here, unless we're squangling.  Squangling	   doesn't make use of the TYPEVEC, so there's no reentrancy	   problem.  */	int old_nofold = nofold;	if (!flag_do_squangling)	  nofold = 1;	if (TREE_CODE (parmtype) == METHOD_TYPE)	  {	    /* Mark this as a method.  */            OB_PUTC ('M');	    /* Output the class of which this method is a member.  */            build_mangled_name_for_type (TYPE_METHOD_BASETYPE (parmtype));	    /* Output any qualifiers for the `this' parameter.  */	    process_modifiers (TREE_TYPE (TREE_VALUE (parms)));	  }	/* Output the parameter types.  */	OB_PUTC ('F');	if (parms == NULL_TREE)	  OB_PUTC ('e');	else if (parms == void_list_node)	  OB_PUTC ('v');	else	  build_mangled_name (parms, 0, 0);        /* Output the return type.  */        OB_PUTC ('_');        build_mangled_name_for_type (TREE_TYPE (parmtype));        nofold = old_nofold;        break;      }    case INTEGER_TYPE:      if (parmtype == integer_type_node          || parmtype == unsigned_type_node	  || parmtype == java_int_type_node)        OB_PUTC ('i');      else if (parmtype == long_integer_type_node               || parmtype == long_unsigned_type_node)        OB_PUTC ('l');      else if (parmtype == short_integer_type_node               || parmtype == short_unsigned_type_node	       || parmtype == java_short_type_node)        OB_PUTC ('s');      else if (parmtype == signed_char_type_node)        {          OB_PUTC ('S');          OB_PUTC ('c');        }      else if (parmtype == char_type_node               || parmtype == unsigned_char_type_node	       || parmtype == java_byte_type_node)        OB_PUTC ('c');      else if (parmtype == wchar_type_node	       || parmtype == java_char_type_node)        OB_PUTC ('w');      else if (parmtype == long_long_integer_type_node	       || parmtype == long_long_unsigned_type_node	       || parmtype == java_long_type_node)        OB_PUTC ('x');      else if (parmtype == java_boolean_type_node)	OB_PUTC ('b');#if HOST_BITS_PER_WIDE_INT >= 64      else if (parmtype == intTI_type_node 	       || parmtype == unsigned_intTI_type_node)	{	  /* Should just check a flag here instead of specific	   *_type_nodes, because all C9x types could use this. */	  int bits = TREE_INT_CST_LOW (TYPE_SIZE (parmtype));	  build_mangled_C9x_name (bits);	}#endif      else        my_friendly_abort (73);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -