本文整理汇总了C++中TREE_READONLY函数的典型用法代码示例。如果您正苦于以下问题:C++ TREE_READONLY函数的具体用法?C++ TREE_READONLY怎么用?C++ TREE_READONLY使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TREE_READONLY函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: make_alias_for
tree
make_alias_for (tree target, tree newid)
{
tree alias = build_decl (DECL_SOURCE_LOCATION (target),
TREE_CODE (target), newid, TREE_TYPE (target));
DECL_LANG_SPECIFIC (alias) = DECL_LANG_SPECIFIC (target);
cxx_dup_lang_specific_decl (alias);
DECL_CONTEXT (alias) = NULL;
TREE_READONLY (alias) = TREE_READONLY (target);
TREE_THIS_VOLATILE (alias) = TREE_THIS_VOLATILE (target);
TREE_PUBLIC (alias) = 0;
DECL_INTERFACE_KNOWN (alias) = 1;
if (DECL_LANG_SPECIFIC (alias))
{
DECL_NOT_REALLY_EXTERN (alias) = 1;
DECL_USE_TEMPLATE (alias) = 0;
DECL_TEMPLATE_INFO (alias) = NULL;
}
DECL_EXTERNAL (alias) = 0;
DECL_ARTIFICIAL (alias) = 1;
DECL_TEMPLATE_INSTANTIATED (alias) = 0;
if (TREE_CODE (alias) == FUNCTION_DECL)
{
DECL_SAVED_FUNCTION_DATA (alias) = NULL;
DECL_DESTRUCTOR_P (alias) = 0;
DECL_CONSTRUCTOR_P (alias) = 0;
DECL_PENDING_INLINE_P (alias) = 0;
DECL_DECLARED_INLINE_P (alias) = 0;
DECL_INITIAL (alias) = error_mark_node;
DECL_ARGUMENTS (alias) = copy_list (DECL_ARGUMENTS (target));
}
else
TREE_STATIC (alias) = 1;
TREE_ADDRESSABLE (alias) = 1;
TREE_USED (alias) = 1;
SET_DECL_ASSEMBLER_NAME (alias, DECL_NAME (alias));
TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (alias)) = 1;
return alias;
}
示例2: cxx_warn_unused_global_decl
bool
cxx_warn_unused_global_decl (const_tree decl)
{
if (TREE_CODE (decl) == FUNCTION_DECL && DECL_DECLARED_INLINE_P (decl))
return false;
if (DECL_IN_SYSTEM_HEADER (decl))
return false;
/* Const variables take the place of #defines in C++. */
if (VAR_P (decl) && TREE_READONLY (decl))
return false;
return true;
}
示例3: pack_ts_base_value_fields
static void
pack_ts_base_value_fields (struct bitpack_d *bp, tree expr)
{
bp_pack_value (bp, TREE_CODE (expr), 16);
if (!TYPE_P (expr))
{
bp_pack_value (bp, TREE_SIDE_EFFECTS (expr), 1);
bp_pack_value (bp, TREE_CONSTANT (expr), 1);
bp_pack_value (bp, TREE_READONLY (expr), 1);
/* TREE_PUBLIC is used on types to indicate that the type
has a TYPE_CACHED_VALUES vector. This is not streamed out,
so we skip it here. */
bp_pack_value (bp, TREE_PUBLIC (expr), 1);
}
else
bp_pack_value (bp, 0, 4);
bp_pack_value (bp, TREE_ADDRESSABLE (expr), 1);
bp_pack_value (bp, TREE_THIS_VOLATILE (expr), 1);
if (DECL_P (expr))
bp_pack_value (bp, DECL_UNSIGNED (expr), 1);
else if (TYPE_P (expr))
bp_pack_value (bp, TYPE_UNSIGNED (expr), 1);
else
bp_pack_value (bp, 0, 1);
/* We write debug info two times, do not confuse the second one.
The only relevant TREE_ASM_WRITTEN use is on SSA names. */
bp_pack_value (bp, (TREE_CODE (expr) != SSA_NAME
? 0 : TREE_ASM_WRITTEN (expr)), 1);
if (TYPE_P (expr))
bp_pack_value (bp, TYPE_ARTIFICIAL (expr), 1);
else
bp_pack_value (bp, TREE_NO_WARNING (expr), 1);
bp_pack_value (bp, TREE_NOTHROW (expr), 1);
bp_pack_value (bp, TREE_STATIC (expr), 1);
if (TREE_CODE (expr) != TREE_BINFO)
bp_pack_value (bp, TREE_PRIVATE (expr), 1);
bp_pack_value (bp, TREE_PROTECTED (expr), 1);
bp_pack_value (bp, TREE_DEPRECATED (expr), 1);
if (TYPE_P (expr))
{
bp_pack_value (bp, TYPE_SATURATING (expr), 1);
bp_pack_value (bp, TYPE_ADDR_SPACE (expr), 8);
}
else if (TREE_CODE (expr) == SSA_NAME)
bp_pack_value (bp, SSA_NAME_IS_DEFAULT_DEF (expr), 1);
else
bp_pack_value (bp, 0, 1);
}
示例4: lhd_warn_unused_global_decl
bool
lhd_warn_unused_global_decl (const_tree decl)
{
/* This is what used to exist in check_global_declarations. Probably
not many of these actually apply to non-C languages. */
if (TREE_CODE (decl) == FUNCTION_DECL && DECL_DECLARED_INLINE_P (decl))
return false;
if (TREE_CODE (decl) == VAR_DECL && TREE_READONLY (decl))
return false;
if (DECL_IN_SYSTEM_HEADER (decl))
return false;
return true;
}
示例5: mf_build_string
/* Build a reference to a literal string. */
static tree
mf_build_string (const char *string)
{
size_t len = strlen (string);
tree result = mf_mark (build_string (len + 1, string));
TREE_TYPE (result) = build_array_type
(char_type_node, build_index_type (size_int (len)));
TREE_CONSTANT (result) = 1;
TREE_READONLY (result) = 1;
TREE_STATIC (result) = 1;
result = build1 (ADDR_EXPR, build_pointer_type (char_type_node), result);
return mf_mark (result);
}
示例6: unpack_ts_base_value_fields
static void
unpack_ts_base_value_fields (struct bitpack_d *bp, tree expr)
{
/* Note that the code for EXPR has already been unpacked to create EXPR in
streamer_alloc_tree. */
if (!TYPE_P (expr))
{
TREE_SIDE_EFFECTS (expr) = (unsigned) bp_unpack_value (bp, 1);
TREE_CONSTANT (expr) = (unsigned) bp_unpack_value (bp, 1);
TREE_READONLY (expr) = (unsigned) bp_unpack_value (bp, 1);
/* TREE_PUBLIC is used on types to indicate that the type
has a TYPE_CACHED_VALUES vector. This is not streamed out,
so we skip it here. */
TREE_PUBLIC (expr) = (unsigned) bp_unpack_value (bp, 1);
}
else
bp_unpack_value (bp, 4);
TREE_ADDRESSABLE (expr) = (unsigned) bp_unpack_value (bp, 1);
TREE_THIS_VOLATILE (expr) = (unsigned) bp_unpack_value (bp, 1);
if (DECL_P (expr))
DECL_UNSIGNED (expr) = (unsigned) bp_unpack_value (bp, 1);
else if (TYPE_P (expr))
TYPE_UNSIGNED (expr) = (unsigned) bp_unpack_value (bp, 1);
else
bp_unpack_value (bp, 1);
TREE_ASM_WRITTEN (expr) = (unsigned) bp_unpack_value (bp, 1);
if (TYPE_P (expr))
TYPE_ARTIFICIAL (expr) = (unsigned) bp_unpack_value (bp, 1);
else
TREE_NO_WARNING (expr) = (unsigned) bp_unpack_value (bp, 1);
TREE_USED (expr) = (unsigned) bp_unpack_value (bp, 1);
TREE_NOTHROW (expr) = (unsigned) bp_unpack_value (bp, 1);
TREE_STATIC (expr) = (unsigned) bp_unpack_value (bp, 1);
TREE_PRIVATE (expr) = (unsigned) bp_unpack_value (bp, 1);
TREE_PROTECTED (expr) = (unsigned) bp_unpack_value (bp, 1);
TREE_DEPRECATED (expr) = (unsigned) bp_unpack_value (bp, 1);
if (TYPE_P (expr))
{
TYPE_SATURATING (expr) = (unsigned) bp_unpack_value (bp, 1);
TYPE_ADDR_SPACE (expr) = (unsigned) bp_unpack_value (bp, 8);
}
else if (TREE_CODE (expr) == SSA_NAME)
SSA_NAME_IS_DEFAULT_DEF (expr) = (unsigned) bp_unpack_value (bp, 1);
else
bp_unpack_value (bp, 1);
}
示例7: compile_resource_data
void
compile_resource_data (const char *name, const char *buffer, int length)
{
tree rtype, field = NULL_TREE, data_type, rinit, data, decl;
char buf[60];
data_type = build_prim_array_type (unsigned_byte_type_node,
strlen (name) + length);
rtype = make_node (RECORD_TYPE);
PUSH_FIELD (rtype, field, "name_length", unsigned_int_type_node);
PUSH_FIELD (rtype, field, "resource_length", unsigned_int_type_node);
PUSH_FIELD (rtype, field, "data", data_type);
FINISH_RECORD (rtype);
START_RECORD_CONSTRUCTOR (rinit, rtype);
PUSH_FIELD_VALUE (rinit, "name_length",
build_int_cst (NULL_TREE, strlen (name)));
PUSH_FIELD_VALUE (rinit, "resource_length",
build_int_cst (NULL_TREE, length));
data = build_string (strlen(name) + length, buffer);
TREE_TYPE (data) = data_type;
PUSH_FIELD_VALUE (rinit, "data", data);
FINISH_RECORD_CONSTRUCTOR (rinit);
TREE_CONSTANT (rinit) = 1;
TREE_INVARIANT (rinit) = 1;
/* Generate a unique-enough identifier. */
sprintf (buf, "_Jr%d", ++Jr_count);
decl = build_decl (VAR_DECL, get_identifier (buf), rtype);
TREE_STATIC (decl) = 1;
DECL_ARTIFICIAL (decl) = 1;
DECL_IGNORED_P (decl) = 1;
TREE_READONLY (decl) = 1;
TREE_THIS_VOLATILE (decl) = 0;
DECL_INITIAL (decl) = rinit;
layout_decl (decl, 0);
pushdecl (decl);
rest_of_decl_compilation (decl, global_bindings_p (), 0);
make_decl_rtl (decl);
assemble_variable (decl, 1, 0, 0);
resources = tree_cons (NULL_TREE, decl, resources);
}
示例8: compile_resource_data
void
compile_resource_data (const char *name, const char *buffer, int length)
{
tree rtype, field = NULL_TREE, data_type, rinit, data, decl;
VEC(constructor_elt,gc) *v = NULL;
data_type = build_prim_array_type (unsigned_byte_type_node,
strlen (name) + length);
rtype = make_node (RECORD_TYPE);
PUSH_FIELD (input_location,
rtype, field, "name_length", unsigned_int_type_node);
PUSH_FIELD (input_location,
rtype, field, "resource_length", unsigned_int_type_node);
PUSH_FIELD (input_location, rtype, field, "data", data_type);
FINISH_RECORD (rtype);
START_RECORD_CONSTRUCTOR (v, rtype);
PUSH_FIELD_VALUE (v, "name_length",
build_int_cst (NULL_TREE, strlen (name)));
PUSH_FIELD_VALUE (v, "resource_length",
build_int_cst (NULL_TREE, length));
data = build_string (strlen(name) + length, buffer);
TREE_TYPE (data) = data_type;
PUSH_FIELD_VALUE (v, "data", data);
FINISH_RECORD_CONSTRUCTOR (rinit, v, rtype);
TREE_CONSTANT (rinit) = 1;
decl = build_decl (input_location,
VAR_DECL, java_mangle_resource_name (name), rtype);
TREE_STATIC (decl) = 1;
TREE_PUBLIC (decl) = 1;
java_hide_decl (decl);
DECL_ARTIFICIAL (decl) = 1;
DECL_IGNORED_P (decl) = 1;
TREE_READONLY (decl) = 1;
TREE_THIS_VOLATILE (decl) = 0;
DECL_INITIAL (decl) = rinit;
layout_decl (decl, 0);
pushdecl (decl);
rest_of_decl_compilation (decl, global_bindings_p (), 0);
varpool_finalize_decl (decl);
VEC_safe_push (tree, gc, resources, decl);
}
示例9: add_new_static_var
/* Create a new global variable of type TYPE. */
tree
add_new_static_var (tree type)
{
tree new_decl;
varpool_node *new_node;
new_decl = create_tmp_var_raw (type, NULL);
DECL_NAME (new_decl) = create_tmp_var_name (NULL);
TREE_READONLY (new_decl) = 0;
TREE_STATIC (new_decl) = 1;
TREE_USED (new_decl) = 1;
DECL_CONTEXT (new_decl) = NULL_TREE;
DECL_ABSTRACT (new_decl) = 0;
lang_hooks.dup_lang_specific_decl (new_decl);
new_node = varpool_node_for_decl (new_decl);
varpool_finalize_decl (new_decl);
return new_node->decl;
}
示例10: dump_varpool_node
/* Dump given cgraph node. */
void
dump_varpool_node (FILE *f, varpool_node *node)
{
dump_symtab_base (f, node);
fprintf (f, " Availability: %s\n",
cgraph_function_flags_ready
? cgraph_availability_names[cgraph_variable_initializer_availability (node)]
: "not-ready");
fprintf (f, " Varpool flags:");
if (DECL_INITIAL (node->decl))
fprintf (f, " initialized");
if (node->output)
fprintf (f, " output");
if (TREE_READONLY (node->decl))
fprintf (f, " read-only");
if (ctor_for_folding (node->decl) != error_mark_node)
fprintf (f, " const-value-known");
fprintf (f, "\n");
}
示例11: convert_from_reference
tree
convert_from_reference (tree val)
{
if (TREE_CODE (TREE_TYPE (val)) == REFERENCE_TYPE)
{
tree t = canonical_type_variant (TREE_TYPE (TREE_TYPE (val)));
tree ref = build1 (INDIRECT_REF, t, val);
/* We *must* set TREE_READONLY when dereferencing a pointer to const,
so that we get the proper error message if the result is used
to assign to. Also, &* is supposed to be a no-op. */
TREE_READONLY (ref) = CP_TYPE_CONST_P (t);
TREE_THIS_VOLATILE (ref) = CP_TYPE_VOLATILE_P (t);
TREE_SIDE_EFFECTS (ref)
= (TREE_THIS_VOLATILE (ref) || TREE_SIDE_EFFECTS (val));
REFERENCE_REF_P (ref) = 1;
val = ref;
}
return val;
}
示例12: handle_const_attribute
static tree
handle_const_attribute (tree *node, tree ARG_UNUSED (name),
tree ARG_UNUSED (args), int ARG_UNUSED (flags),
bool * ARG_UNUSED (no_add_attrs))
{
tree type = TREE_TYPE (*node);
/* See FIXME comment on noreturn in c_common_attribute_table. */
if (TREE_CODE (*node) == FUNCTION_DECL)
TREE_READONLY (*node) = 1;
else if (TREE_CODE (type) == POINTER_TYPE
&& TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE)
TREE_TYPE (*node)
= build_pointer_type
(build_type_variant (TREE_TYPE (type), 1,
TREE_THIS_VOLATILE (TREE_TYPE (type))));
else
gcc_unreachable ();
return NULL_TREE;
}
示例13: add_new_static_var
/* Create a new global variable of type TYPE. */
tree
add_new_static_var (tree type)
{
tree new_decl;
struct varpool_node *new_node;
new_decl = create_tmp_var (type, NULL);
DECL_NAME (new_decl) = create_tmp_var_name (NULL);
TREE_READONLY (new_decl) = 0;
TREE_STATIC (new_decl) = 1;
TREE_USED (new_decl) = 1;
DECL_CONTEXT (new_decl) = NULL_TREE;
DECL_ABSTRACT (new_decl) = 0;
lang_hooks.dup_lang_specific_decl (new_decl);
create_var_ann (new_decl);
new_node = varpool_node (new_decl);
varpool_mark_needed_node (new_node);
add_referenced_var (new_decl);
varpool_finalize_decl (new_decl);
return new_node->decl;
}
示例14: start_handler_array
static tree
start_handler_array ()
{
tree handler_array_type, decl;
push_obstacks_nochange ();
end_temporary_allocation ();
handler_array_type = build_array_type (handler_element_type, NULL_TREE);
decl = build_lang_decl (VAR_DECL,
get_unique_identifier ("handler_table"),
handler_array_type);
/* TREE_TYPE (decl) = handler_array_type;*/
TREE_READONLY (decl) = 1;
TREE_STATIC (decl) = 1;
DECL_INITIAL (decl) = error_mark_node;
pushdecl (decl);
make_decl_rtl (decl, NULL_PTR, 0);
current_handler->handler_array_decl = decl;
return decl;
}
示例15: create_vop_var
static void
create_vop_var (void)
{
tree global_var;
gcc_assert (cfun->gimple_df->vop == NULL_TREE);
global_var = build_decl (BUILTINS_LOCATION, VAR_DECL,
get_identifier (".MEM"),
void_type_node);
DECL_ARTIFICIAL (global_var) = 1;
TREE_READONLY (global_var) = 0;
DECL_EXTERNAL (global_var) = 1;
TREE_STATIC (global_var) = 1;
TREE_USED (global_var) = 1;
DECL_CONTEXT (global_var) = NULL_TREE;
TREE_THIS_VOLATILE (global_var) = 0;
TREE_ADDRESSABLE (global_var) = 0;
create_var_ann (global_var);
add_referenced_var (global_var);
cfun->gimple_df->vop = global_var;
}