本文整理汇总了C++中TREE_VEC_ELT函数的典型用法代码示例。如果您正苦于以下问题:C++ TREE_VEC_ELT函数的具体用法?C++ TREE_VEC_ELT怎么用?C++ TREE_VEC_ELT使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TREE_VEC_ELT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fold_cplus_constants
static tree
fold_cplus_constants (const_tree c)
{
tree folded_elems, elems = CONST_CAST_TREE (c);
int vec_len, i;
if (elems == NULL_TREE || elems == error_mark_node)
return elems;
vec_len = TREE_VEC_LENGTH (elems);
/* First check if there is at least one element that needs
folding. If there is none, we just return ELEMS. Otherwise create
and return a new tree vector that contains the folded versions of
ELEMS. This is to avoid allocating memory if we don't need
to. */
for (i = 0; i < vec_len; ++i)
{
if (template_arg_needs_folding (TREE_VEC_ELT (elems, i)))
break;
}
if (i == vec_len)
return elems;
folded_elems = make_tree_vec (vec_len);
for (i = 0; i < vec_len; ++i)
{
tree elem = TREE_VEC_ELT (elems, i);
TREE_VEC_ELT (folded_elems, i) =
(elem && !TYPE_P (elem)) ? cplus_expand_constant (elem) : elem;
}
return folded_elems;
}
示例2: compression_table_add
static void
compression_table_add (tree type)
{
if (compression_next == TREE_VEC_LENGTH (compression_table))
{
tree new_table = make_tree_vec (2*compression_next);
int i;
for (i = 0; i < compression_next; i++)
TREE_VEC_ELT (new_table, i) = TREE_VEC_ELT (compression_table, i);
compression_table = new_table;
}
TREE_VEC_ELT (compression_table, compression_next++) = type;
}
示例3: find_compression_array_template_match
static int
find_compression_array_template_match (tree string)
{
int i;
for (i = 0; i < compression_next; i++)
if (TREE_VEC_ELT (compression_table, i) == string)
return i;
return -1;
}
示例4: write_ts_vec_tree_pointers
static void
write_ts_vec_tree_pointers (struct output_block *ob, tree expr, bool ref_p)
{
int i;
/* Note that the number of slots for EXPR has already been emitted
in EXPR's header (see streamer_write_tree_header). */
for (i = 0; i < TREE_VEC_LENGTH (expr); i++)
stream_write_tree (ob, TREE_VEC_ELT (expr, i), ref_p);
}
示例5: cxx_omp_clause_dtor
tree
cxx_omp_clause_dtor (tree clause, tree decl)
{
tree info = CP_OMP_CLAUSE_INFO (clause);
tree ret = NULL;
if (info)
ret = cxx_omp_clause_apply_fn (TREE_VEC_ELT (info, 1), decl, NULL);
return ret;
}
示例6: cxx_omp_clause_default_ctor
tree
cxx_omp_clause_default_ctor (tree clause, tree decl, tree /*outer*/)
{
tree info = CP_OMP_CLAUSE_INFO (clause);
tree ret = NULL;
if (info)
ret = cxx_omp_clause_apply_fn (TREE_VEC_ELT (info, 0), decl, NULL);
return ret;
}
示例7: lto_input_ts_vec_tree_pointers
static void
lto_input_ts_vec_tree_pointers (struct lto_input_block *ib,
struct data_in *data_in, tree expr)
{
int i;
/* Note that TREE_VEC_LENGTH was read by streamer_alloc_tree to
instantiate EXPR. */
for (i = 0; i < TREE_VEC_LENGTH (expr); i++)
TREE_VEC_ELT (expr, i) = stream_read_tree (ib, data_in);
}
示例8: find_compression_record_match
static int
find_compression_record_match (tree type, tree *next_current)
{
int i, match = -1;
tree current, saved_current = NULL_TREE;
current = TYPE_PACKAGE_LIST (type);
for (i = 0; i < compression_next; i++)
{
tree compression_entry = TREE_VEC_ELT (compression_table, i);
if (current && compression_entry == TREE_PURPOSE (current))
{
match = i;
saved_current = current;
current = TREE_CHAIN (current);
}
else
/* We don't want to match an element that appears in the middle
of a package name, so skip forward to the next complete type name.
IDENTIFIER_NODEs (except for a "6JArray") are partial package
names while RECORD_TYPEs represent complete type names. */
while (i < compression_next
&& TREE_CODE (compression_entry) == IDENTIFIER_NODE
&& compression_entry != atms)
compression_entry = TREE_VEC_ELT (compression_table, ++i);
}
if (!next_current)
return match;
/* If we have a match, set next_current to the item next to the last
matched value. */
if (match >= 0)
*next_current = TREE_CHAIN (saved_current);
/* We had no match: we'll have to start from the beginning. */
if (match < 0)
*next_current = TYPE_PACKAGE_LIST (type);
return match;
}
示例9: pp_cxx_template_parameter_list
static inline void
pp_cxx_template_parameter_list (cxx_pretty_printer *pp, tree t)
{
const int n = TREE_VEC_LENGTH (t);
int i;
for (i = 0; i < n; ++i)
{
if (i)
pp_cxx_separate_with (pp, ',');
pp_cxx_template_parameter (pp, TREE_VEC_ELT (t, i));
}
}
示例10: cxx_omp_clause_assign_op
tree
cxx_omp_clause_assign_op (tree clause, tree dst, tree src)
{
tree info = CP_OMP_CLAUSE_INFO (clause);
tree ret = NULL;
if (info)
ret = cxx_omp_clause_apply_fn (TREE_VEC_ELT (info, 2), dst, src);
if (ret == NULL)
ret = build2 (MODIFY_EXPR, TREE_TYPE (dst), dst, src);
return ret;
}
示例11: cxx_omp_clause_copy_ctor
tree
cxx_omp_clause_copy_ctor (tree clause, tree dst, tree src)
{
tree info = CP_OMP_CLAUSE_INFO (clause);
tree ret = NULL;
if (info)
ret = cxx_omp_clause_apply_fn (TREE_VEC_ELT (info, 0), dst, src);
if (ret == NULL)
ret = build2 (MODIFY_EXPR, void_type_node, dst, src);
return ret;
}
示例12: ok_to_generate_alias_set_for_type
static bool
ok_to_generate_alias_set_for_type (tree t)
{
if (TYPE_PTRMEMFUNC_P (t))
return true;
if (AGGREGATE_TYPE_P (t))
{
if ((TREE_CODE (t) == RECORD_TYPE) || (TREE_CODE (t) == UNION_TYPE))
{
tree fields;
/* Backend-created structs are safe. */
if (! CLASS_TYPE_P (t))
return true;
/* PODs are safe. */
if (! CLASSTYPE_NON_POD_P(t))
return true;
/* Classes with virtual baseclasses are not. */
if (TYPE_USES_VIRTUAL_BASECLASSES (t))
return false;
/* Recursively check the base classes. */
if (TYPE_BINFO (t) != NULL && TYPE_BINFO_BASETYPES (t) != NULL)
{
int i;
for (i = 0; i < TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES (t)); i++)
{
tree binfo = TREE_VEC_ELT (TYPE_BINFO_BASETYPES (t), i);
if (!ok_to_generate_alias_set_for_type (BINFO_TYPE (binfo)))
return false;
}
}
/* Check all the fields. */
for (fields = TYPE_FIELDS (t); fields; fields = TREE_CHAIN (fields))
{
if (TREE_CODE (fields) != FIELD_DECL)
continue;
if (! ok_to_generate_alias_set_for_type (TREE_TYPE (fields)))
return false;
}
return true;
}
else if (TREE_CODE (t) == ARRAY_TYPE)
return ok_to_generate_alias_set_for_type (TREE_TYPE (t));
else
/* This should never happen, we dealt with all the aggregate
types that can appear in C++ above. */
abort ();
}
else
return true;
}
示例13: merge_type_state
int
merge_type_state (tree label)
{
int nlocals = DECL_MAX_LOCALS (current_function_decl);
int cur_length = stack_pointer + nlocals;
tree vec = LABEL_TYPE_STATE (label);
tree return_map;
if (vec == NULL_TREE)
{
vec = make_tree_vec (cur_length);
LABEL_TYPE_STATE (label) = vec;
while (--cur_length >= 0)
TREE_VEC_ELT (vec, cur_length) = type_map[cur_length];
return 1;
}
else
{
int i;
int changed = 0;
if (LABEL_IS_SUBR_START (label) && LABEL_VERIFIED (label)
&& current_subr != label)
return_map = LABEL_RETURN_TYPE_STATE (label);
else
return_map = NULL_TREE;
if (TREE_VEC_LENGTH (vec) != cur_length)
{
return -1;
}
for (i = 0; i < cur_length; i++)
{
tree old_type = TREE_VEC_ELT (vec, i);
tree new_type = merge_types (old_type, type_map[i]);
if (TREE_VEC_ELT (vec, i) != new_type)
{
/* If there has been a change, note that since we must re-verify.
However, if the label is the start of a subroutine,
we don't care about local variables that are neither
set nor used in the subroutine. */
if (return_map == NULL_TREE || i >= nlocals
|| TREE_VEC_ELT (return_map, i) != TYPE_UNUSED
|| (TYPE_IS_WIDE (new_type)
&& TREE_VEC_ELT (return_map, i+1) != TYPE_UNUSED))
changed = 1;
}
TREE_VEC_ELT (vec, i) = new_type;
if (new_type == TYPE_UNKNOWN)
{
if (i >= nlocals)
return -1;
}
else if (TYPE_IS_WIDE (new_type))
i++;
}
return changed;
}
}
示例14: entry_match_pointer_p
static int
entry_match_pointer_p (tree type, int i)
{
tree t = TREE_VEC_ELT (compression_table, i);
while (TREE_CODE (type) == POINTER_TYPE
&& TREE_CODE (t) == POINTER_TYPE)
{
t = TREE_TYPE (t);
type = TREE_TYPE (type);
}
return (TREE_CODE (type) == RECORD_TYPE
&& TREE_CODE (t) == RECORD_TYPE
&& t == type);
}
示例15: pp_cxx_template_argument_list
static void
pp_cxx_template_argument_list (cxx_pretty_printer *pp, tree t)
{
int i;
if (t == NULL)
return;
for (i = 0; i < TREE_VEC_LENGTH (t); ++i)
{
tree arg = TREE_VEC_ELT (t, i);
if (i != 0)
pp_cxx_separate_with (pp, ',');
if (TYPE_P (arg) || (TREE_CODE (arg) == TEMPLATE_DECL
&& TYPE_P (DECL_TEMPLATE_RESULT (arg))))
pp_cxx_type_id (pp, arg);
else
pp_cxx_expression (pp, arg);
}
}