本文整理汇总了C++中build_decl函数的典型用法代码示例。如果您正苦于以下问题:C++ build_decl函数的具体用法?C++ build_decl怎么用?C++ build_decl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了build_decl函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: build_equiv_decl
static tree
build_equiv_decl (tree union_type, bool is_init)
{
tree decl;
char name[15];
static int serial = 0;
if (is_init)
{
decl = gfc_create_var (union_type, "equiv");
TREE_STATIC (decl) = 1;
return decl;
}
snprintf (name, sizeof (name), "equiv.%d", serial++);
decl = build_decl (VAR_DECL, get_identifier (name), union_type);
DECL_ARTIFICIAL (decl) = 1;
DECL_IGNORED_P (decl) = 1;
if (!gfc_can_put_var_on_stack (DECL_SIZE_UNIT (decl)))
TREE_STATIC (decl) = 1;
TREE_ADDRESSABLE (decl) = 1;
TREE_USED (decl) = 1;
/* The source location has been lost, and doesn't really matter.
We need to set it to something though. */
gfc_set_decl_location (decl, &gfc_current_locus);
gfc_add_decl_to_function (decl);
return decl;
}
开发者ID:aosm,项目名称:libstdcxx_SUPanWheat,代码行数:33,代码来源:trans-common.c
示例2: build_equiv_decl
static tree
build_equiv_decl (tree union_type, bool is_init)
{
tree decl;
if (is_init)
{
decl = gfc_create_var (union_type, "equiv");
TREE_STATIC (decl) = 1;
return decl;
}
decl = build_decl (VAR_DECL, NULL, union_type);
DECL_ARTIFICIAL (decl) = 1;
DECL_COMMON (decl) = 1;
TREE_ADDRESSABLE (decl) = 1;
TREE_USED (decl) = 1;
/* The source location has been lost, and doesn't really matter.
We need to set it to something though. */
gfc_set_decl_location (decl, &gfc_current_locus);
gfc_add_decl_to_function (decl);
return decl;
}
开发者ID:aosm,项目名称:gcc_40,代码行数:28,代码来源:trans-common.c
示例3: make_fname_decl
static tree
make_fname_decl ()
{
const char *name = lang_hooks.decl_printable_name (current_function_decl, 0);
tree decl, type, init;
size_t length = strlen (name);
type = build_array_type (build_type_variant (char_type_node, true, false),
build_index_type (size_int (length)));
decl = build_decl (UNKNOWN_LOCATION, VAR_DECL,
get_identifier ("__function_name__"), type);
TREE_STATIC (decl) = 1;
TREE_READONLY (decl) = 1;
DECL_ARTIFICIAL (decl) = 1;
init = build_string (length + 1, name);
TREE_TYPE (init) = type;
TREE_READONLY (init) = 1;
DECL_READ_P (decl) = 1;
DECL_INITIAL (decl) = init;
TREE_USED (decl) = 1;
TREE_ADDRESSABLE (decl) = 1;
DECL_CONTEXT (decl) = current_function_decl;
return decl;
}
开发者ID:heyfluke,项目名称:gen-trace,代码行数:29,代码来源:plugin.cpp
示例4: build_field
static void
build_field (segment_info *h, tree union_type, record_layout_info rli)
{
tree field;
tree name;
HOST_WIDE_INT offset = h->offset;
unsigned HOST_WIDE_INT desired_align, known_align;
name = get_identifier (h->sym->name);
field = build_decl (FIELD_DECL, name, h->field);
gfc_set_decl_location (field, &h->sym->declared_at);
known_align = (offset & -offset) * BITS_PER_UNIT;
if (known_align == 0 || known_align > BIGGEST_ALIGNMENT)
known_align = BIGGEST_ALIGNMENT;
desired_align = update_alignment_for_field (rli, field, known_align);
if (desired_align > known_align)
DECL_PACKED (field) = 1;
DECL_FIELD_CONTEXT (field) = union_type;
DECL_FIELD_OFFSET (field) = size_int (offset);
DECL_FIELD_BIT_OFFSET (field) = bitsize_zero_node;
SET_DECL_OFFSET_ALIGN (field, known_align);
rli->offset = size_binop (MAX_EXPR, rli->offset,
size_binop (PLUS_EXPR,
DECL_FIELD_OFFSET (field),
DECL_SIZE_UNIT (field)));
h->field = field;
}
开发者ID:aosm,项目名称:gcc_40,代码行数:30,代码来源:trans-common.c
示例5: create_struct_type
static tree
create_struct_type(tree decl, size_t front_rz_size, size_t rear_rz_size)
{
// TODO make this dynamic rather than static
char type_name[50];
tree fieldfront, orig_var, fieldrear, struct_type;
gcc_assert(front_rz_size % 8 == 0 && rear_rz_size % 8 == 0);
struct_type = mf_mark(make_node (RECORD_TYPE));
// Build the front red zone
tree front_array_idx = build_index_type (size_int (front_rz_size / sizeof(unsigned int)));
tree front_rz_array = build_array_type (unsigned_type_node, front_array_idx);
fieldfront = build_decl (UNKNOWN_LOCATION,
FIELD_DECL, get_identifier ("rz_front"), front_rz_array);
DECL_ALIGN(fieldfront) = 8;
DECL_CONTEXT (fieldfront) = struct_type;
// orig variable
orig_var = build_decl (UNKNOWN_LOCATION,
FIELD_DECL, get_identifier("orig_var"), TREE_TYPE(decl));
DECL_CONTEXT (orig_var) = struct_type; // Look at comments above
DECL_CHAIN (fieldfront) = orig_var;
// Rear zone
if (COMPLETE_TYPE_P(decl)){
tree rear_array_idx = build_index_type (size_int (rear_rz_size / sizeof(unsigned int)));
tree rear_rz_array = build_array_type (unsigned_type_node, rear_array_idx);
fieldrear = build_decl (UNKNOWN_LOCATION,
FIELD_DECL, get_identifier ("rz_rear"), rear_rz_array);
DECL_ALIGN(fieldrear) = 8;
DECL_CONTEXT (fieldrear) = struct_type;
DECL_CHAIN (orig_var) = fieldrear;
}
TYPE_FIELDS (struct_type) = fieldfront;
strcpy(type_name, "rz_");
strcat(type_name, get_name(decl));
strcat(type_name, "_type");
TYPE_NAME (struct_type) = get_identifier (type_name);
layout_type (struct_type);
return struct_type;
}
开发者ID:sdzahed,项目名称:LBC-Plugin,代码行数:46,代码来源:plugin_lbc.c
示例6: add_field
static tree
add_field (const char *name, tree type, tree fields)
{
tree t = get_identifier (name);
tree field = build_decl (BUILTINS_LOCATION, FIELD_DECL, t, type);
TREE_CHAIN (field) = fields;
return field;
}
开发者ID:krichter722,项目名称:gcc,代码行数:8,代码来源:cilk-common.c
示例7: create_cilk_helper_decl
static tree
create_cilk_helper_decl (struct wrapper_data *wd)
{
char name[20];
if (wd->type == CILK_BLOCK_FOR)
sprintf (name, "_cilk_for_" HOST_WIDE_INT_PRINT_DEC, cilk_wrapper_count++);
else if (wd->type == CILK_BLOCK_SPAWN)
sprintf (name, "_cilk_spn_" HOST_WIDE_INT_PRINT_DEC, cilk_wrapper_count++);
else
gcc_unreachable ();
clean_symbol_name (name);
tree fndecl = build_decl (DECL_SOURCE_LOCATION (current_function_decl),
FUNCTION_DECL, get_identifier (name), wd->fntype);
TREE_PUBLIC (fndecl) = 0;
TREE_STATIC (fndecl) = 1;
TREE_USED (fndecl) = 1;
DECL_ARTIFICIAL (fndecl) = 0;
DECL_IGNORED_P (fndecl) = 0;
DECL_EXTERNAL (fndecl) = 0;
DECL_CONTEXT (fndecl) = wd->context;
tree block = make_node (BLOCK);
DECL_INITIAL (fndecl) = block;
TREE_USED (block) = 1;
BLOCK_SUPERCONTEXT (block) = fndecl;
gcc_assert (!DECL_SAVED_TREE (fndecl));
/* Inlining would defeat the purpose of this wrapper.
Either it secretly switches stack frames or it allocates
a stable stack frame to hold function arguments even if
the parent stack frame is stolen. */
DECL_UNINLINABLE (fndecl) = 1;
tree result_decl = build_decl (UNKNOWN_LOCATION, RESULT_DECL, NULL_TREE,
void_type_node);
DECL_ARTIFICIAL (result_decl) = 0;
DECL_IGNORED_P (result_decl) = 1;
DECL_CONTEXT (result_decl) = fndecl;
DECL_RESULT (fndecl) = result_decl;
return fndecl;
}
开发者ID:Distrotech,项目名称:gcc,代码行数:45,代码来源:cilk.c
示例8: mf_make_builtin
/* Helper for mudflap_init: construct a decl with the given category,
name, and type, mark it an external reference, and pushdecl it. */
static inline tree
mf_make_builtin (enum tree_code category, const char *name, tree type)
{
tree decl = mf_mark (build_decl (category, get_identifier (name), type));
TREE_PUBLIC (decl) = 1;
DECL_EXTERNAL (decl) = 1;
lang_hooks.decls.pushdecl (decl);
return decl;
}
开发者ID:0mp,项目名称:freebsd,代码行数:11,代码来源:tree-mudflap.c
示例9: mf_make_mf_cache_struct_type
/* Helper for mudflap_init: construct a tree corresponding to the type
struct __mf_cache { uintptr_t low; uintptr_t high; };
where uintptr_t is the FIELD_TYPE argument. */
static inline tree
mf_make_mf_cache_struct_type (tree field_type)
{
/* There is, abominably, no language-independent way to construct a
RECORD_TYPE. So we have to call the basic type construction
primitives by hand. */
tree fieldlo = build_decl (FIELD_DECL, get_identifier ("low"), field_type);
tree fieldhi = build_decl (FIELD_DECL, get_identifier ("high"), field_type);
tree struct_type = make_node (RECORD_TYPE);
DECL_CONTEXT (fieldlo) = struct_type;
DECL_CONTEXT (fieldhi) = struct_type;
TREE_CHAIN (fieldlo) = fieldhi;
TYPE_FIELDS (struct_type) = fieldlo;
TYPE_NAME (struct_type) = get_identifier ("__mf_cache");
layout_type (struct_type);
return struct_type;
}
开发者ID:0mp,项目名称:freebsd,代码行数:22,代码来源:tree-mudflap.c
示例10: start_unit_callback
static void start_unit_callback (void *gcc_data, void *user_data)
{
if (integer_type_node) {
fake_var = build_decl (VAR_DECL,
get_identifier ("_fake_var_"),
integer_type_node);
TREE_PUBLIC (fake_var) = 1;
DECL_ARTIFICIAL (fake_var) = 1;
}
}
开发者ID:IntegerCompany,项目名称:linaro-android-gcc,代码行数:10,代码来源:start_unit_plugin.c
示例11: init_ic_make_global_vars
/* Add code:
__thread gcov* __gcov_indirect_call_counters; // pointer to actual counter
__thread void* __gcov_indirect_call_callee; // actual callee address
__thread int __gcov_function_counter; // time profiler function counter
*/
static void
init_ic_make_global_vars (void)
{
tree gcov_type_ptr;
ptr_void = build_pointer_type (void_type_node);
ic_void_ptr_var
= build_decl (UNKNOWN_LOCATION, VAR_DECL,
get_identifier (
(PARAM_VALUE (PARAM_INDIR_CALL_TOPN_PROFILE) ?
"__gcov_indirect_call_topn_callee" :
"__gcov_indirect_call_callee")),
ptr_void);
TREE_PUBLIC (ic_void_ptr_var) = 1;
DECL_EXTERNAL (ic_void_ptr_var) = 1;
TREE_STATIC (ic_void_ptr_var) = 1;
DECL_ARTIFICIAL (ic_void_ptr_var) = 1;
DECL_INITIAL (ic_void_ptr_var) = NULL;
if (targetm.have_tls)
set_decl_tls_model (ic_void_ptr_var, decl_default_tls_model (ic_void_ptr_var));
varpool_node::finalize_decl (ic_void_ptr_var);
gcov_type_ptr = build_pointer_type (get_gcov_type ());
ic_gcov_type_ptr_var
= build_decl (UNKNOWN_LOCATION, VAR_DECL,
get_identifier (
(PARAM_VALUE (PARAM_INDIR_CALL_TOPN_PROFILE) ?
"__gcov_indirect_call_topn_counters" :
"__gcov_indirect_call_counters")),
gcov_type_ptr);
TREE_PUBLIC (ic_gcov_type_ptr_var) = 1;
DECL_EXTERNAL (ic_gcov_type_ptr_var) = 1;
TREE_STATIC (ic_gcov_type_ptr_var) = 1;
DECL_ARTIFICIAL (ic_gcov_type_ptr_var) = 1;
DECL_INITIAL (ic_gcov_type_ptr_var) = NULL;
if (targetm.have_tls)
set_decl_tls_model (ic_gcov_type_ptr_var, decl_default_tls_model (ic_gcov_type_ptr_var));
varpool_node::finalize_decl (ic_gcov_type_ptr_var);
}
开发者ID:3F,项目名称:gcc,代码行数:48,代码来源:tree-profile.c
示例12: vla_capture_type
static tree
vla_capture_type (tree array_type)
{
static tree ptr_id, max_id;
tree type = xref_tag (record_type, make_anon_name (), ts_current, false);
xref_basetypes (type, NULL_TREE);
type = begin_class_definition (type);
if (!ptr_id)
{
ptr_id = get_identifier ("ptr");
max_id = get_identifier ("max");
}
tree ptrtype = build_pointer_type (TREE_TYPE (array_type));
tree field = build_decl (input_location, FIELD_DECL, ptr_id, ptrtype);
finish_member_declaration (field);
field = build_decl (input_location, FIELD_DECL, max_id, sizetype);
finish_member_declaration (field);
return finish_struct (type, NULL_TREE);
}
开发者ID:nguyentu1602,项目名称:gcc,代码行数:19,代码来源:lambda.c
示例13: init_ic_make_global_vars
/* Add code:
static gcov* __gcov_indirect_call_counters; // pointer to actual counter
static void* __gcov_indirect_call_callee; // actual callee address
*/
static void
init_ic_make_global_vars (void)
{
tree gcov_type_ptr;
ptr_void = build_pointer_type (void_type_node);
ic_void_ptr_var
= build_decl (UNKNOWN_LOCATION, VAR_DECL,
get_identifier ("__gcov_indirect_call_callee"),
ptr_void);
TREE_STATIC (ic_void_ptr_var) = 1;
TREE_PUBLIC (ic_void_ptr_var) = 0;
DECL_ARTIFICIAL (ic_void_ptr_var) = 1;
DECL_INITIAL (ic_void_ptr_var) = NULL;
if (targetm.have_tls)
DECL_TLS_MODEL (ic_void_ptr_var) =
decl_default_tls_model (ic_void_ptr_var);
varpool_finalize_decl (ic_void_ptr_var);
varpool_mark_needed_node (varpool_node (ic_void_ptr_var));
gcov_type_ptr = build_pointer_type (get_gcov_type ());
ic_gcov_type_ptr_var
= build_decl (UNKNOWN_LOCATION, VAR_DECL,
get_identifier ("__gcov_indirect_call_counters"),
gcov_type_ptr);
TREE_STATIC (ic_gcov_type_ptr_var) = 1;
TREE_PUBLIC (ic_gcov_type_ptr_var) = 0;
DECL_ARTIFICIAL (ic_gcov_type_ptr_var) = 1;
DECL_INITIAL (ic_gcov_type_ptr_var) = NULL;
if (targetm.have_tls)
DECL_TLS_MODEL (ic_gcov_type_ptr_var) =
decl_default_tls_model (ic_gcov_type_ptr_var);
varpool_finalize_decl (ic_gcov_type_ptr_var);
varpool_mark_needed_node (varpool_node (ic_gcov_type_ptr_var));
}
开发者ID:AsherBond,项目名称:MondocosmOS-Dependencies,代码行数:42,代码来源:tree-profile.c
示例14: mf_make_builtin
/* Helper for mudflap_init: construct a decl with the given category,
name, and type, mark it an external reference, and pushdecl it. */
static inline tree
mf_make_builtin (enum tree_code category, const char *name, tree type)
{
tree decl = mf_mark (build_decl (UNKNOWN_LOCATION,
category, get_identifier (name), type));
TREE_PUBLIC (decl) = 1;
DECL_EXTERNAL (decl) = 1;
lang_hooks.decls.pushdecl (decl);
/* The decl was declared by the compiler. */
DECL_ARTIFICIAL (decl) = 1;
/* And we don't want debug info for it. */
DECL_IGNORED_P (decl) = 1;
return decl;
}
开发者ID:ChaosJohn,项目名称:gcc,代码行数:16,代码来源:tree-mudflap.c
示例15: push_eh_info
static void
push_eh_info ()
{
tree decl, fn = call_eh_info ();
/* Remember the pointer to the current exception info; it won't change
during this catch block. */
decl = build_decl (VAR_DECL, get_identifier ("__exception_info"),
TREE_TYPE (fn));
DECL_ARTIFICIAL (decl) = 1;
DECL_INITIAL (decl) = fn;
decl = pushdecl (decl);
cp_finish_decl (decl, fn, NULL_TREE, 0);
}
开发者ID:qiyao,项目名称:xcc,代码行数:14,代码来源:except.c
示例16: start_var_decl
tree
start_var_decl (tree type, const char *name)
{
tree var = build_decl (input_location,
VAR_DECL, get_identifier (name), type);
TREE_STATIC (var) = 1;
DECL_INITIAL (var) = error_mark_node; /* A real initializer is coming... */
DECL_IGNORED_P (var) = 1;
DECL_ARTIFICIAL (var) = 1;
DECL_CONTEXT (var) = NULL_TREE;
#ifdef OBJCPLUS
DECL_THIS_STATIC (var) = 1; /* squash redeclaration errors */
#endif
return var;
}
开发者ID:Nodplus,项目名称:gcc,代码行数:15,代码来源:objc-runtime-shared-support.c
示例17: make_triplet_val_inv
static inline void
make_triplet_val_inv (location_t loc, tree *value)
{
tree var, new_exp;
if (TREE_CODE (*value) != INTEGER_CST
&& TREE_CODE (*value) != PARM_DECL
&& TREE_CODE (*value) != VAR_DECL)
{
var = build_decl (loc, VAR_DECL, NULL_TREE, integer_type_node);
new_exp = build_modify_expr (loc, var, TREE_TYPE (var), NOP_EXPR, loc,
*value, TREE_TYPE (*value));
add_stmt (new_exp);
*value = var;
}
}
开发者ID:AHelper,项目名称:gcc,代码行数:15,代码来源:c-array-notation.c
示例18: gfc_generate_module_code
void
gfc_generate_module_code (gfc_namespace * ns)
{
gfc_namespace *n;
struct module_htab_entry *entry;
gcc_assert (ns->proc_name->backend_decl == NULL);
ns->proc_name->backend_decl
= build_decl (ns->proc_name->declared_at.lb->location,
NAMESPACE_DECL, get_identifier (ns->proc_name->name),
void_type_node);
entry = gfc_find_module (ns->proc_name->name);
if (entry->namespace_decl)
/* Buggy sourcecode, using a module before defining it? */
htab_empty (entry->decls);
entry->namespace_decl = ns->proc_name->backend_decl;
gfc_generate_module_vars (ns);
/* We need to generate all module function prototypes first, to allow
sibling calls. */
for (n = ns->contained; n; n = n->sibling)
{
gfc_entry_list *el;
if (!n->proc_name)
continue;
gfc_create_function_decl (n);
gcc_assert (DECL_CONTEXT (n->proc_name->backend_decl) == NULL_TREE);
DECL_CONTEXT (n->proc_name->backend_decl) = ns->proc_name->backend_decl;
gfc_module_add_decl (entry, n->proc_name->backend_decl);
for (el = ns->entries; el; el = el->next)
{
gcc_assert (DECL_CONTEXT (el->sym->backend_decl) == NULL_TREE);
DECL_CONTEXT (el->sym->backend_decl) = ns->proc_name->backend_decl;
gfc_module_add_decl (entry, el->sym->backend_decl);
}
}
for (n = ns->contained; n; n = n->sibling)
{
if (!n->proc_name)
continue;
gfc_generate_function_code (n);
}
}
开发者ID:DIYzzuzpb,项目名称:pic32-gcc,代码行数:48,代码来源:trans.c
示例19: build_exception_object_var
static tree
build_exception_object_var (void)
{
tree decl = DECL_FUNCTION_EXC_OBJ (current_function_decl);
if (decl == NULL)
{
decl = build_decl (DECL_SOURCE_LOCATION (current_function_decl),
VAR_DECL, get_identifier ("#exc_obj"), ptr_type_node);
DECL_IGNORED_P (decl) = 1;
DECL_ARTIFICIAL (decl) = 1;
DECL_FUNCTION_EXC_OBJ (current_function_decl) = decl;
pushdecl_function_level (decl);
}
return decl;
}
开发者ID:chinabin,项目名称:gcc-tiny,代码行数:16,代码来源:except.c
示例20: build_junk_fn
static tree build_junk_fn(unsigned id)
{
char fnname[32] = {0};
tree decl, resdecl, initial, proto;
/* Func decl */
snprintf(fnname, 31, "__func%d", id);
proto = build_varargs_function_type_list(void_type_node, NULL_TREE);
decl = build_fn_decl(fnname, proto);
SET_DECL_ASSEMBLER_NAME(decl, get_identifier(fnname));
printf(TAG "Creating junk function: %s\n", fnname);
/* Result */
resdecl=build_decl(BUILTINS_LOCATION,RESULT_DECL,NULL_TREE,void_type_node);
DECL_ARTIFICIAL(resdecl) = 1;
DECL_CONTEXT(resdecl) = decl;
DECL_RESULT(decl) = resdecl;
/* Initial */
initial = make_node(BLOCK);
TREE_USED(initial) = 1;
DECL_INITIAL(decl) = initial;
DECL_UNINLINABLE(decl) = 1;
DECL_EXTERNAL(decl) = 0;
DECL_PRESERVE_P(decl) = 1;
/* Func decl */
TREE_USED(decl) = 1;
TREE_PUBLIC(decl) = 1;
TREE_STATIC(decl) = 1;
DECL_ARTIFICIAL(decl) = 1;
/* Make the function */
push_struct_function(decl);
/* DECL_SAVED_TREE(decl) = gen_junk(); */
cfun->function_end_locus = BUILTINS_LOCATION;
gimplify_function_tree(decl);
/* Update */
cgraph_add_new_function(decl, false);
cgraph_mark_needed_node(cgraph_node(decl));
current_function_decl = NULL_TREE;
pop_cfun();
return decl;
}
开发者ID:enferex,项目名称:GOAT-Plugs,代码行数:47,代码来源:slimer.c
注:本文中的build_decl函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论