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

📄 search.c

📁 gcc-2.95.3 Linux下最常用的C编译器
💻 C
📖 第 1 页 / 共 5 页
字号:
    {      brettype = TREE_TYPE (TREE_TYPE (brettype));      drettype = TREE_TYPE (TREE_TYPE (drettype));    }  else if (TREE_CODE (brettype) == METHOD_TYPE)    {      brettype = TREE_TYPE (brettype);      drettype = TREE_TYPE (drettype);    }  if (same_type_p (brettype, drettype))    return 0;  if (! (TREE_CODE (brettype) == TREE_CODE (drettype)	 && (TREE_CODE (brettype) == POINTER_TYPE	     || TREE_CODE (brettype) == REFERENCE_TYPE)	 && TYPE_QUALS (brettype) == TYPE_QUALS (drettype)))    return 0;  if (! can_convert (brettype, drettype))    return 0;  brettype = TREE_TYPE (brettype);  drettype = TREE_TYPE (drettype);  /* If not pedantic, allow any standard pointer conversion.  */  if (! IS_AGGR_TYPE (drettype) || ! IS_AGGR_TYPE (brettype))    return -1;  binfo = get_binfo (brettype, drettype, 1);  /* If we get an error_mark_node from get_binfo, it already complained,     so let's just succeed.  */  if (binfo == error_mark_node)    return 1;  if (! BINFO_OFFSET_ZEROP (binfo) || TREE_VIA_VIRTUAL (binfo))    return 2;  return 1;}/* Given a class type TYPE, and a function decl FNDECL, look for a   virtual function in TYPE's hierarchy which FNDECL could match as a   virtual function.  It doesn't matter which one we find.   DTORP is nonzero if we are looking for a destructor.  Destructors   need special treatment because they do not match by name.  */treeget_matching_virtual (binfo, fndecl, dtorp)     tree binfo, fndecl;     int dtorp;{  tree tmp = NULL_TREE;  int i;  if (TREE_CODE (fndecl) == TEMPLATE_DECL)    /* In [temp.mem] we have:         A specialization of a member function template does not         override a virtual function from a base class.  */    return NULL_TREE;  /* Breadth first search routines start searching basetypes     of TYPE, so we must perform first ply of search here.  */  if (dtorp)    return bfs_walk (binfo, get_virtual_destructor,		     tree_has_any_destructor_p, 0);  else    {      tree drettype, dtypes, btypes, instptr_type;      tree basetype = DECL_CLASS_CONTEXT (fndecl);      tree baselink, best = NULL_TREE;      tree name = DECL_ASSEMBLER_NAME (fndecl);      tree declarator = DECL_NAME (fndecl);      if (IDENTIFIER_VIRTUAL_P (declarator) == 0)	return NULL_TREE;      baselink = get_virtuals_named_this (binfo, declarator);      if (baselink == NULL_TREE)	return NULL_TREE;      drettype = TREE_TYPE (TREE_TYPE (fndecl));      dtypes = TYPE_ARG_TYPES (TREE_TYPE (fndecl));      if (DECL_STATIC_FUNCTION_P (fndecl))	instptr_type = NULL_TREE;      else	instptr_type = TREE_TYPE (TREE_VALUE (dtypes));      for (; baselink; baselink = next_baselink (baselink))	{	  tree tmps;	  for (tmps = TREE_VALUE (baselink); tmps; tmps = OVL_NEXT (tmps))	    {	      tmp = OVL_CURRENT (tmps);	      if (! DECL_VINDEX (tmp))		continue;	      btypes = TYPE_ARG_TYPES (TREE_TYPE (tmp));	      if (instptr_type == NULL_TREE)		{		  if (compparms (TREE_CHAIN (btypes), dtypes))		    /* Caller knows to give error in this case.  */		    return tmp;		  return NULL_TREE;		}	      if (/* The first parameter is the `this' parameter,		     which has POINTER_TYPE, and we can therefore		     safely use TYPE_QUALS, rather than		     CP_TYPE_QUALS.  */		  (TYPE_QUALS (TREE_TYPE (TREE_VALUE (btypes)))		   == TYPE_QUALS (instptr_type))		  && compparms (TREE_CHAIN (btypes), TREE_CHAIN (dtypes)))		{		  tree brettype = TREE_TYPE (TREE_TYPE (tmp));		  if (same_type_p (brettype, drettype))		    /* OK */;		  else if ((i = covariant_return_p (brettype, drettype)))		    {		      if (i == 2)			sorry ("adjusting pointers for covariant returns");		      if (pedantic && i == -1)			{			  cp_pedwarn_at ("invalid covariant return type for `%#D' (must be pointer or reference to class)", fndecl);			  cp_pedwarn_at ("  overriding `%#D'", tmp);			}		    }		  else if (IS_AGGR_TYPE_2 (brettype, drettype)			   && same_or_base_type_p (brettype, drettype))		    {		      error ("invalid covariant return type (must use pointer or reference)");		      cp_error_at ("  overriding `%#D'", tmp);		      cp_error_at ("  with `%#D'", fndecl);		    }		  else if (IDENTIFIER_ERROR_LOCUS (name) == NULL_TREE)		    {		      cp_error_at ("conflicting return type specified for virtual function `%#D'", fndecl);		      cp_error_at ("  overriding definition as `%#D'", tmp);		      SET_IDENTIFIER_ERROR_LOCUS (name, basetype);		    }		  /* FNDECL overrides this function.  We continue to		     check all the other functions in order to catch		     errors; it might be that in some other baseclass		     a virtual function was declared with the same		     parameter types, but a different return type.  */		  best = tmp;		}	    }	}      return best;    }}/* Return the list of virtual functions which are abstract in type   TYPE that come from non virtual base classes.  See   expand_direct_vtbls_init for the style of search we do.  */static treeget_abstract_virtuals_1 (binfo, do_self, abstract_virtuals)     tree binfo;     int do_self;     tree abstract_virtuals;{  tree binfos = BINFO_BASETYPES (binfo);  int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;  for (i = 0; i < n_baselinks; i++)    {      tree base_binfo = TREE_VEC_ELT (binfos, i);      int is_not_base_vtable	= i != CLASSTYPE_VFIELD_PARENT (BINFO_TYPE (binfo));      if (! TREE_VIA_VIRTUAL (base_binfo))	abstract_virtuals	  = get_abstract_virtuals_1 (base_binfo, is_not_base_vtable,				     abstract_virtuals);    }  /* Should we use something besides CLASSTYPE_VFIELDS? */  if (do_self && CLASSTYPE_VFIELDS (BINFO_TYPE (binfo)))    {      tree virtuals = BINFO_VIRTUALS (binfo);      skip_rtti_stuff (&virtuals, BINFO_TYPE (binfo));      while (virtuals)	{	  tree base_pfn = FNADDR_FROM_VTABLE_ENTRY (TREE_VALUE (virtuals));	  tree base_fndecl = TREE_OPERAND (base_pfn, 0);	  if (DECL_ABSTRACT_VIRTUAL_P (base_fndecl))	    abstract_virtuals = tree_cons (NULL_TREE, base_fndecl, abstract_virtuals);	  virtuals = TREE_CHAIN (virtuals);	}    }  return abstract_virtuals;}/* Return the list of virtual functions which are abstract in type TYPE.   This information is cached, and so must be built on a   non-temporary obstack.  */treeget_abstract_virtuals (type)     tree type;{  tree vbases;  tree abstract_virtuals = NULL;  /* First get all from non-virtual bases.  */  abstract_virtuals    = get_abstract_virtuals_1 (TYPE_BINFO (type), 1, abstract_virtuals);					         for (vbases = CLASSTYPE_VBASECLASSES (type); vbases; vbases = TREE_CHAIN (vbases))    {      tree virtuals = BINFO_VIRTUALS (vbases);      skip_rtti_stuff (&virtuals, type);      while (virtuals)	{	  tree base_pfn = FNADDR_FROM_VTABLE_ENTRY (TREE_VALUE (virtuals));	  tree base_fndecl = TREE_OPERAND (base_pfn, 0);	  if (DECL_NEEDS_FINAL_OVERRIDER_P (base_fndecl))	    cp_error ("`%#D' needs a final overrider", base_fndecl);	  else if (DECL_ABSTRACT_VIRTUAL_P (base_fndecl))	    abstract_virtuals = tree_cons (NULL_TREE, base_fndecl, abstract_virtuals);	  virtuals = TREE_CHAIN (virtuals);	}    }  return nreverse (abstract_virtuals);}static treenext_baselink (baselink)     tree baselink;{  tree tmp = TREE_TYPE (baselink);  baselink = TREE_CHAIN (baselink);  while (tmp)    {      /* @@ does not yet add previous base types.  */      baselink = tree_cons (TREE_PURPOSE (tmp), TREE_VALUE (tmp),			    baselink);      TREE_TYPE (baselink) = TREE_TYPE (tmp);      tmp = TREE_CHAIN (tmp);    }  return baselink;}/* DEPTH-FIRST SEARCH ROUTINES.  *//* This routine converts a pointer to be a pointer of an immediate   base class.  The normal convert_pointer_to routine would diagnose   the conversion as ambiguous, under MI code that has the base class   as an ambiguous base class.  */static treeconvert_pointer_to_single_level (to_type, expr)     tree to_type, expr;{  tree derived;  tree binfo_of_derived;  int i;  derived = TREE_TYPE (TREE_TYPE (expr));  binfo_of_derived = TYPE_BINFO (derived);  my_friendly_assert (BINFO_INHERITANCE_CHAIN (binfo_of_derived) == NULL_TREE,		      980827);  for (i = CLASSTYPE_N_BASECLASSES (derived) - 1; i >= 0; --i)    {      tree binfo = BINFO_BASETYPE (binfo_of_derived, i);      my_friendly_assert (BINFO_INHERITANCE_CHAIN (binfo) == binfo_of_derived,			  980827);      if (same_type_p (BINFO_TYPE (binfo), to_type))	return build_vbase_path (PLUS_EXPR, 				 build_pointer_type (to_type), 				 expr, binfo, 1);    }  my_friendly_abort (19990607);  /* NOTREACHED */  return NULL_TREE;}tree markedp (binfo, data)      tree binfo;     void *data ATTRIBUTE_UNUSED;{   return BINFO_MARKED (binfo) ? binfo : NULL_TREE; }static treeunmarkedp (binfo, data)      tree binfo;     void *data ATTRIBUTE_UNUSED;{  return !BINFO_MARKED (binfo) ? binfo : NULL_TREE;}static treemarked_vtable_pathp (binfo, data)      tree binfo;     void *data ATTRIBUTE_UNUSED;{   return BINFO_VTABLE_PATH_MARKED (binfo) ? binfo : NULL_TREE; }static treeunmarked_vtable_pathp (binfo, data)      tree binfo;     void *data ATTRIBUTE_UNUSED;{   return !BINFO_VTABLE_PATH_MARKED (binfo) ? binfo : NULL_TREE; }static tree marked_new_vtablep (binfo, data)      tree binfo;     void *data ATTRIBUTE_UNUSED;{  return BINFO_NEW_VTABLE_MARKED (binfo) ? binfo : NULL_TREE; }static treeunmarked_new_vtablep (binfo, data)      tree binfo;     void *data ATTRIBUTE_UNUSED;{   return !BINFO_NEW_VTABLE_MARKED (binfo) ? binfo : NULL_TREE; }static treemarked_pushdecls_p (binfo, data)      tree binfo;     void *data ATTRIBUTE_UNUSED;{  return (CLASS_TYPE_P (BINFO_TYPE (binfo))	  && BINFO_PUSHDECLS_MARKED (binfo)) ? binfo : NULL_TREE; }static treeunmarked_pushdecls_p (binfo, data)      tree binfo;     void *data ATTRIBUTE_UNUSED;{   return (CLASS_TYPE_P (BINFO_TYPE (binfo))	  && !BINFO_PUSHDECLS_MARKED (binfo)) ? binfo : NULL_TREE;}#if 0static int dfs_search_slot_nonempty_p (binfo) tree binfo;{ return CLASSTYPE_SEARCH_SLOT (BINFO_TYPE (binfo)) != 0; }#endifstatic tree dfs_debug_unmarkedp (binfo, data)      tree binfo;     void *data ATTRIBUTE_UNUSED;{   return (!CLASSTYPE_DEBUG_REQUESTED (BINFO_TYPE (binfo)) 	  ? binfo : NULL_TREE);}/* The worker functions for `dfs_walk'.  These do not need to   test anything (vis a vis marking) if they are paired with   a predicate function (above).  */#if 0static voiddfs_mark (binfo) tree binfo;{ SET_BINFO_MARKED (binfo); }#endiftreedfs_unmark (binfo, data)      tree binfo;     void *data ATTRIBUTE_UNUSED;{   CLEAR_BINFO_MARKED (binfo);   return NULL_TREE;}#if 0static voiddfs_mark_vtable_path (binfo) tree binfo;{ SET_BINFO_VTABLE_PATH_MARKED (binfo); }static voiddfs_unmark_vtable_path (binfo) tree binfo;{ CLEAR_BINFO_VTABLE_PATH_MARKED (binfo); }static voiddfs_mark_new_vtable (binfo) tree binfo;{ SET_BINFO_NEW_VTABLE_MARKED (binfo); }static voiddfs_unmark_new_vtable (binfo) tree binfo;{ CLEAR_BINFO_NEW_VTABLE_MARKED (binfo); }static voiddfs_clear_search_slot (binfo) tree binfo;{ CLASSTYPE_SEARCH_SLOT (BINFO_TYPE (binfo)) = 0; }#endifstatic treedfs_debug_mark (binfo, data)     tree binfo;     void *data ATTRIBUTE_UNUSED;{  tree t = BINFO_TYPE (binfo);  /* Use heuristic that if there are virtual functions,     ignore until we see a non-inline virtual function.  */  tree methods = CLASSTYPE_METHOD_VEC (t);  CLASSTYPE_DEBUG_REQUESTED (t) = 1;  if (methods == 0)    return NULL_TREE;  /* If interface info is known, either we've already emitted the debug     info or we don't need to.  */  if (CLASSTYPE_INTERFACE_KNOWN (t))    return NULL_TREE;  /* If debug info is requested from this context for this type, supply it.     If debug info is requested from another context for this type,     see if some third context can supply it.  */  if (current_function_decl == NULL_TREE      || DECL_CLASS_CONTEXT (current_function_decl) != t)    {      if (TREE_VEC_ELT (methods, 1))	methods = TREE_VEC_ELT (methods, 1);      else if (TREE_VEC_ELT (methods, 0))	methods = TREE_VEC_ELT (methods, 0);      else	methods = TREE_VEC_ELT (methods, 2);      methods = OVL_CURRENT (methods);      while (methods)	{	  if (DECL_VINDEX (methods)	      && DECL_THIS_INLINE (methods) == 0	      && DE

⌨️ 快捷键说明

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