本文整理汇总了C++中TREE_PURPOSE函数的典型用法代码示例。如果您正苦于以下问题:C++ TREE_PURPOSE函数的具体用法?C++ TREE_PURPOSE怎么用?C++ TREE_PURPOSE使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TREE_PURPOSE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lto_input_ts_list_tree_pointers
static void
lto_input_ts_list_tree_pointers (struct lto_input_block *ib,
struct data_in *data_in, tree expr)
{
TREE_PURPOSE (expr) = stream_read_tree (ib, data_in);
TREE_VALUE (expr) = stream_read_tree (ib, data_in);
TREE_CHAIN (expr) = stream_read_tree (ib, data_in);
}
示例2: cxx11_attribute_p
bool
cxx11_attribute_p (const_tree attr)
{
if (attr == NULL_TREE
|| TREE_CODE (attr) != TREE_LIST)
return false;
return (TREE_CODE (TREE_PURPOSE (attr)) == TREE_LIST);
}
示例3: split_range
static void
split_range (struct eh_range *range, int pc)
{
struct eh_range *ptr;
struct eh_range **first_child, **second_child;
struct eh_range *h;
/* First, split all the sub-ranges. */
for (ptr = range->first_child; ptr; ptr = ptr->next_sibling)
{
if (pc > ptr->start_pc
&& pc < ptr->end_pc)
{
split_range (ptr, pc);
}
}
/* Create a new range. */
h = XNEW (struct eh_range);
h->start_pc = pc;
h->end_pc = range->end_pc;
h->next_sibling = range->next_sibling;
range->next_sibling = h;
range->end_pc = pc;
h->handlers = build_tree_list (TREE_PURPOSE (range->handlers),
TREE_VALUE (range->handlers));
h->next_sibling = NULL;
h->expanded = 0;
h->stmt = NULL;
h->outer = range->outer;
h->first_child = NULL;
ptr = range->first_child;
first_child = &range->first_child;
second_child = &h->first_child;
/* Distribute the sub-ranges between the two new ranges. */
for (ptr = range->first_child; ptr; ptr = ptr->next_sibling)
{
if (ptr->start_pc < pc)
{
*first_child = ptr;
ptr->outer = range;
first_child = &ptr->next_sibling;
}
else
{
*second_child = ptr;
ptr->outer = h;
second_child = &ptr->next_sibling;
}
}
*first_child = NULL;
*second_child = NULL;
}
示例4: generate_strings
/* This emits all the meta-data string tables (and finalizes each var
as it goes). */
void
generate_strings (void)
{
tree chain, string_expr;
tree string, decl; /* , type;*/
for (chain = class_names_chain; chain; chain = TREE_CHAIN (chain))
{
string = TREE_VALUE (chain);
decl = TREE_PURPOSE (chain);
string_expr = my_build_string (IDENTIFIER_LENGTH (string) + 1,
IDENTIFIER_POINTER (string));
finish_var_decl (decl, string_expr);
}
for (chain = meth_var_names_chain; chain; chain = TREE_CHAIN (chain))
{
string = TREE_VALUE (chain);
decl = TREE_PURPOSE (chain);
string_expr = my_build_string (IDENTIFIER_LENGTH (string) + 1,
IDENTIFIER_POINTER (string));
finish_var_decl (decl, string_expr);
}
for (chain = meth_var_types_chain; chain; chain = TREE_CHAIN (chain))
{
string = TREE_VALUE (chain);
decl = TREE_PURPOSE (chain);
string_expr = my_build_string (IDENTIFIER_LENGTH (string) + 1,
IDENTIFIER_POINTER (string));
finish_var_decl (decl, string_expr);
}
for (chain = prop_names_attr_chain; chain; chain = TREE_CHAIN (chain))
{
string = TREE_VALUE (chain);
decl = TREE_PURPOSE (chain);
string_expr = my_build_string (IDENTIFIER_LENGTH (string) + 1,
IDENTIFIER_POINTER (string));
finish_var_decl (decl, string_expr);
}
}
示例5: build_tree_list
/*
* Return a newly created TREE_LIST node whose
* purpose and value fields are PARM and VALUE.
*/
tree
build_tree_list (tree parm, tree value)
{
register tree t = make_node (TREE_LIST);
TREE_PURPOSE (t) = parm;
TREE_VALUE (t) = value;
return (t);
} /* end build_tree_list */
示例6: build_op_identifier
/*
****************************************************************
* Create a OP_IDENTIFIER node *
****************************************************************
*/
tree
build_op_identifier (tree op1, tree op2)
{
register tree t = make_node (OP_IDENTIFIER);
TREE_PURPOSE (t) = op1;
TREE_VALUE (t) = op2;
return (t);
} /* end build_op_identifier */
示例7: oacc_replace_fn_attrib
void
oacc_replace_fn_attrib (tree fn, tree dims)
{
tree ident = get_identifier (OACC_FN_ATTRIB);
tree attribs = DECL_ATTRIBUTES (fn);
/* If we happen to be present as the first attrib, drop it. */
if (attribs && TREE_PURPOSE (attribs) == ident)
attribs = TREE_CHAIN (attribs);
DECL_ATTRIBUTES (fn) = tree_cons (ident, dims, attribs);
}
示例8: tree_cons
/*
* Return a newly created TREE_LIST node whose
* purpose and value fields are PARM and VALUE
* and whose TREE_CHAIN is CHAIN.
*/
tree
tree_cons (tree purpose, tree value, tree chain)
{
register tree node = make_node (TREE_LIST);
TREE_CHAIN (node) = chain;
TREE_PURPOSE (node) = purpose;
TREE_VALUE (node) = value;
return (node);
} /* end tree_cons */
示例9: expand_end_java_handler
/* If there are any handlers for this range, issue end of range,
and then all handler blocks */
void
expand_end_java_handler (struct eh_range *range)
{
tree handler = range->handlers;
if (handler)
{
tree exc_obj = build_exception_object_var ();
tree catches = make_node (STATEMENT_LIST);
tree_stmt_iterator catches_i = tsi_last (catches);
tree *body;
for (; handler; handler = TREE_CHAIN (handler))
{
tree type, eh_type, x;
tree stmts = make_node (STATEMENT_LIST);
tree_stmt_iterator stmts_i = tsi_last (stmts);
type = TREE_PURPOSE (handler);
if (type == NULL)
type = throwable_type_node;
eh_type = prepare_eh_table_type (type);
x = build_call_expr (builtin_decl_explicit (BUILT_IN_EH_POINTER),
1, integer_zero_node);
x = build2 (MODIFY_EXPR, void_type_node, exc_obj, x);
tsi_link_after (&stmts_i, x, TSI_CONTINUE_LINKING);
x = build1 (GOTO_EXPR, void_type_node, TREE_VALUE (handler));
tsi_link_after (&stmts_i, x, TSI_CONTINUE_LINKING);
x = build2 (CATCH_EXPR, void_type_node, eh_type, stmts);
tsi_link_after (&catches_i, x, TSI_CONTINUE_LINKING);
/* Throwable can match anything in Java, and therefore
any subsequent handlers are unreachable. */
/* ??? If we're assured of no foreign language exceptions,
we'd be better off using NULL as the exception type
for the catch. */
if (type == throwable_type_node)
break;
}
body = get_stmts ();
*body = build2 (TRY_CATCH_EXPR, void_type_node, *body, catches);
}
#if defined(DEBUG_JAVA_BINDING_LEVELS)
indent ();
fprintf (stderr, "expand end handler pc %d <-- %d\n",
current_pc, range->start_pc);
#endif /* defined(DEBUG_JAVA_BINDING_LEVELS) */
}
示例10: lookup_attribute_spec
const struct attribute_spec *
lookup_attribute_spec (const_tree name)
{
tree ns;
if (TREE_CODE (name) == TREE_LIST)
{
ns = TREE_PURPOSE (name);
name = TREE_VALUE (name);
}
else
ns = get_identifier ("gnu");
return lookup_scoped_attribute_spec (ns, name);
}
示例11: java_init_lex
void
java_init_lex ()
{
#ifndef JC1_LITE
int java_lang_imported = 0;
if (!java_lang_id)
java_lang_id = get_identifier ("java.lang");
if (!java_lang_cloneable)
java_lang_cloneable = get_identifier ("java.lang.Cloneable");
if (!java_lang_imported)
{
tree node = build_tree_list
(build_expr_wfl (java_lang_id, NULL, 0, 0), NULL_TREE);
read_import_dir (TREE_PURPOSE (node));
TREE_CHAIN (node) = ctxp->import_demand_list;
ctxp->import_demand_list = node;
java_lang_imported = 1;
}
if (!wfl_operator)
wfl_operator = build_expr_wfl (NULL_TREE, ctxp->filename, 0, 0);
if (!label_id)
label_id = get_identifier ("$L");
if (!wfl_append)
wfl_append = build_expr_wfl (get_identifier ("append"), NULL, 0, 0);
if (!wfl_string_buffer)
wfl_string_buffer =
build_expr_wfl (get_identifier ("java.lang.StringBuffer"), NULL, 0, 0);
if (!wfl_to_string)
wfl_to_string = build_expr_wfl (get_identifier ("toString"), NULL, 0, 0);
ctxp->static_initialized = ctxp->non_static_initialized =
ctxp->incomplete_class = NULL_TREE;
bzero ((PTR) ctxp->modifier_ctx, 11*sizeof (ctxp->modifier_ctx[0]));
bzero ((PTR) current_jcf, sizeof (JCF));
ctxp->current_parsed_class = NULL;
ctxp->package = NULL_TREE;
#endif
ctxp->filename = input_filename;
ctxp->lineno = lineno = 0;
ctxp->p_line = NULL;
ctxp->c_line = NULL;
ctxp->unget_utf8_value = 0;
ctxp->minus_seen = 0;
ctxp->java_error_flag = 0;
}
示例12: pp_cxx_ctor_initializer
static void
pp_cxx_ctor_initializer (cxx_pretty_printer *pp, tree t)
{
t = TREE_OPERAND (t, 0);
pp_cxx_whitespace (pp);
pp_colon (pp);
pp_cxx_whitespace (pp);
for (; t; t = TREE_CHAIN (t))
{
pp_cxx_primary_expression (pp, TREE_PURPOSE (t));
pp_cxx_call_argument_list (pp, TREE_VALUE (t));
if (TREE_CHAIN (t))
pp_cxx_separate_with (pp, ',');
}
}
示例13: finish_cdtor
static void
finish_cdtor (tree body)
{
tree scope;
tree block;
scope = add_scope_stmt (/*begin_p=*/0, /*partial_p=*/0);
block = poplevel (0, 0, 0);
SCOPE_STMT_BLOCK (TREE_PURPOSE (scope)) = block;
SCOPE_STMT_BLOCK (TREE_VALUE (scope)) = block;
RECHAIN_STMTS (body, COMPOUND_BODY (body));
finish_function ();
}
示例14: add_objc_string
tree
add_objc_string (tree ident, string_section section)
{
tree *chain, decl, type;
char buf[BUFSIZE];
switch (section)
{
case class_names:
chain = &class_names_chain;
snprintf (buf, BUFSIZE, "_OBJC_ClassName_%s", IDENTIFIER_POINTER (ident));
break;
case meth_var_names:
chain = &meth_var_names_chain;
snprintf (buf, BUFSIZE, "_OBJC_METH_VAR_NAME_%d", meth_var_names_idx++);
break;
case meth_var_types:
chain = &meth_var_types_chain;
snprintf (buf, BUFSIZE, "_OBJC_METH_VAR_TYPE_%d", meth_var_types_idx++);
break;
case prop_names_attr:
chain = &prop_names_attr_chain;
snprintf (buf, BUFSIZE, "_OBJC_PropertyAttributeOrName_%d", property_name_attr_idx++);
break;
default:
gcc_unreachable ();
}
while (*chain)
{
if (TREE_VALUE (*chain) == ident)
return convert (string_type_node,
build_unary_op (input_location,
ADDR_EXPR, TREE_PURPOSE (*chain), 1));
chain = &TREE_CHAIN (*chain);
}
type = build_sized_array_type (char_type_node, IDENTIFIER_LENGTH (ident) + 1);
/* Get a runtime-specific string decl which will be finish_var()'ed in
generate_strings (). */
decl = (*runtime.string_decl) (type, buf, section);
TREE_CONSTANT (decl) = 1;
*chain = tree_cons (decl, ident, NULL_TREE);
return convert (string_type_node,
build_unary_op (input_location, ADDR_EXPR, decl, 1));
}
示例15: register_capture_members
void
register_capture_members (tree captures)
{
if (captures == NULL_TREE)
return;
register_capture_members (TREE_CHAIN (captures));
tree field = TREE_PURPOSE (captures);
if (PACK_EXPANSION_P (field))
field = PACK_EXPANSION_PATTERN (field);
/* We set this in add_capture to avoid duplicates. */
IDENTIFIER_MARKED (DECL_NAME (field)) = false;
finish_member_declaration (field);
}