这篇教程C++ DECL_CONTEXT函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中DECL_CONTEXT函数的典型用法代码示例。如果您正苦于以下问题:C++ DECL_CONTEXT函数的具体用法?C++ DECL_CONTEXT怎么用?C++ DECL_CONTEXT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了DECL_CONTEXT函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: build_capture_proxytreebuild_capture_proxy (tree member){ tree var, object, fn, closure, name, lam, type; if (PACK_EXPANSION_P (member)) member = PACK_EXPANSION_PATTERN (member); closure = DECL_CONTEXT (member); fn = lambda_function (closure); lam = CLASSTYPE_LAMBDA_EXPR (closure); /* The proxy variable forwards to the capture field. */ object = build_fold_indirect_ref (DECL_ARGUMENTS (fn)); object = finish_non_static_data_member (member, object, NULL_TREE); if (REFERENCE_REF_P (object)) object = TREE_OPERAND (object, 0); /* Remove the __ inserted by add_capture. */ if (DECL_NORMAL_CAPTURE_P (member)) name = get_identifier (IDENTIFIER_POINTER (DECL_NAME (member)) + 2); else name = DECL_NAME (member); type = lambda_proxy_type (object); if (DECL_VLA_CAPTURE_P (member)) { /* Rebuild the VLA type from the pointer and maxindex. */ tree field = next_initializable_field (TYPE_FIELDS (type)); tree ptr = build_simple_component_ref (object, field); field = next_initializable_field (DECL_CHAIN (field)); tree max = build_simple_component_ref (object, field); type = build_cplus_array_type (TREE_TYPE (TREE_TYPE (ptr)), build_index_type (max)); type = build_reference_type (type); REFERENCE_VLA_OK (type) = true; object = convert (type, ptr); } var = build_decl (input_location, VAR_DECL, name, type); SET_DECL_VALUE_EXPR (var, object); DECL_HAS_VALUE_EXPR_P (var) = 1; DECL_ARTIFICIAL (var) = 1; TREE_USED (var) = 1; DECL_CONTEXT (var) = fn; if (name == this_identifier) { gcc_assert (LAMBDA_EXPR_THIS_CAPTURE (lam) == member); LAMBDA_EXPR_THIS_CAPTURE (lam) = var; } if (fn == current_function_decl) insert_capture_proxy (var); else vec_safe_push (LAMBDA_EXPR_PENDING_PROXIES (lam), var); return var;}
开发者ID:alisw,项目名称:gcc-toolchain,代码行数:60,
示例2: vxworks_emutls_var_fieldsstatic treevxworks_emutls_var_fields (tree type, tree *name){ tree field, next_field; *name = get_identifier ("__tls_var"); field = build_decl (BUILTINS_LOCATION, FIELD_DECL, get_identifier ("size"), unsigned_type_node); DECL_CONTEXT (field) = type; next_field = field; field = build_decl (BUILTINS_LOCATION, FIELD_DECL, get_identifier ("module_id"), unsigned_type_node); DECL_CONTEXT (field) = type; DECL_CHAIN (field) = next_field; next_field = field; field = build_decl (BUILTINS_LOCATION, FIELD_DECL, get_identifier ("offset"), unsigned_type_node); DECL_CONTEXT (field) = type; DECL_CHAIN (field) = next_field; return field;}
开发者ID:BoxianLai,项目名称:moxiedev,代码行数:25,
示例3: pushdecltreepushdecl (tree decl){ if (global_bindings_p ()) DECL_CONTEXT (decl) = current_translation_unit; else { /* External objects aren't nested. For debug info insert a copy of the decl into the binding level. */ if (DECL_EXTERNAL (decl)) { tree orig = decl; decl = copy_node (decl); DECL_CONTEXT (orig) = NULL_TREE; } DECL_CONTEXT (decl) = current_function_decl; } /* Put the declaration on the list. */ DECL_CHAIN (decl) = current_binding_level->names; current_binding_level->names = decl; /* For the declaration of a type, set its name if it is not already set. */ if (TREE_CODE (decl) == TYPE_DECL && TYPE_NAME (TREE_TYPE (decl)) == 0) { if (DECL_SOURCE_LINE (decl) == 0) TYPE_NAME (TREE_TYPE (decl)) = decl; else TYPE_NAME (TREE_TYPE (decl)) = DECL_NAME (decl); } return decl;}
开发者ID:mohammadsavadkuhi,项目名称:gcc,代码行数:34,
示例4: cplus_expand_constanttreecplus_expand_constant (tree cst){ switch (TREE_CODE (cst)) { case PTRMEM_CST: { tree type = TREE_TYPE (cst); tree member; /* Find the member. */ member = PTRMEM_CST_MEMBER (cst); /* We can't lower this until the class is complete. */ if (!COMPLETE_TYPE_P (DECL_CONTEXT (member))) return cst; if (TREE_CODE (member) == FIELD_DECL) { /* Find the offset for the field. */ cst = byte_position (member); while (!same_type_p (DECL_CONTEXT (member), TYPE_PTRMEM_CLASS_TYPE (type))) { /* The MEMBER must have been nestled within an anonymous aggregate contained in TYPE. Find the anonymous aggregate. */ member = lookup_anon_field (TYPE_PTRMEM_CLASS_TYPE (type), DECL_CONTEXT (member)); cst = size_binop (PLUS_EXPR, cst, byte_position (member)); } cst = fold (build_nop (type, cst)); } else { tree delta; tree pfn; expand_ptrmemfunc_cst (cst, &delta, &pfn); cst = build_ptrmemfunc1 (type, delta, pfn); } } break; case CONSTRUCTOR: { constructor_elt *elt; unsigned HOST_WIDE_INT idx; FOR_EACH_VEC_SAFE_ELT (CONSTRUCTOR_ELTS (cst), idx, elt) elt->value = cplus_expand_constant (elt->value); } default: /* There's nothing to do. */ break; } return cst;}
开发者ID:Gd58,项目名称:gcc,代码行数:59,
示例5: associated_typestatic treeassociated_type (tree decl){ /* APPLE LOCAL begin mainline 2005-10-12 */ return (DECL_CONTEXT (decl) && TYPE_P (DECL_CONTEXT (decl))) ? DECL_CONTEXT (decl) : NULL_TREE; /* APPLE LOCAL end mainline 2005-10-12 */}
开发者ID:DJHartley,项目名称:iphone-dev,代码行数:8,
示例6: java_mangle_declvoidjava_mangle_decl (tree decl){ /* A copy of the check from the beginning of lhd_set_decl_assembler_name. */ /* set_decl_assembler_name may be called on TYPE_DECL to record ODR name for C++ types. By default types have no ODR names. */ if (TREE_CODE (decl) == TYPE_DECL) return; /* The language-independent code should never use the DECL_ASSEMBLER_NAME for lots of DECLs. Only FUNCTION_DECLs and VAR_DECLs for variables with static storage duration need a real DECL_ASSEMBLER_NAME. */ gcc_assert (TREE_CODE (decl) == FUNCTION_DECL || (TREE_CODE (decl) == VAR_DECL && (TREE_STATIC (decl) || DECL_EXTERNAL (decl) || TREE_PUBLIC (decl)))); /* Mangling only applies to class members. */ if (DECL_CONTEXT (decl) && TYPE_P (DECL_CONTEXT (decl))) { init_mangling (); switch (TREE_CODE (decl)) { case VAR_DECL: if (DECL_LANG_SPECIFIC (decl)) { if (DECL_CLASS_FIELD_P (decl)) { mangle_class_field (decl); break; } else if (DECL_VTABLE_P (decl)) { mangle_vtable (DECL_CONTEXT (decl)); break; } } mangle_field_decl (decl); break; case FUNCTION_DECL: if (DECL_LANG_SPECIFIC (decl) && DECL_LOCAL_CNI_METHOD_P (decl)) mangle_local_cni_method_decl (decl); else mangle_method_decl (decl); break; default: gcc_unreachable (); } SET_DECL_ASSEMBLER_NAME (decl, finish_mangling ()); } else lhd_set_decl_assembler_name (decl);}
开发者ID:arm-embedded,项目名称:gcc-arm-none-eabi.debian,代码行数:58,
示例7: java_mangle_declvoidjava_mangle_decl (tree decl){ /* A copy of the check from the beginning of lhd_set_decl_assembler_name. Only FUNCTION_DECLs and VAR_DECLs for variables with static storage duration need a real DECL_ASSEMBLER_NAME. */ gcc_assert (TREE_CODE (decl) == FUNCTION_DECL || (TREE_CODE (decl) == VAR_DECL && (TREE_STATIC (decl) || DECL_EXTERNAL (decl) || TREE_PUBLIC (decl)))); /* Mangling only applies to class members. */ if (DECL_CONTEXT (decl) && TYPE_P (DECL_CONTEXT (decl))) { init_mangling (); switch (TREE_CODE (decl)) { case VAR_DECL: if (DECL_LANG_SPECIFIC (decl)) { if (DECL_CLASS_FIELD_P (decl)) { mangle_class_field (decl); break; } else if (DECL_VTABLE_P (decl)) { mangle_vtable (DECL_CONTEXT (decl)); break; } } mangle_field_decl (decl); break; case FUNCTION_DECL: if (DECL_LANG_SPECIFIC (decl) && DECL_LOCAL_CNI_METHOD_P (decl)) mangle_local_cni_method_decl (decl); else mangle_method_decl (decl); break; default: gcc_unreachable (); } SET_DECL_ASSEMBLER_NAME (decl, finish_mangling ()); } else lhd_set_decl_assembler_name (decl);}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.toolchain,代码行数:50,
示例8: pp_cxx_original_namespace_definitionstatic voidpp_cxx_original_namespace_definition (cxx_pretty_printer *pp, tree t){ pp_cxx_identifier (pp, "namespace"); if (DECL_CONTEXT (t)) pp_cxx_nested_name_specifier (pp, DECL_CONTEXT (t)); if (DECL_NAME (t)) pp_cxx_unqualified_id (pp, t); pp_cxx_whitespace (pp); pp_cxx_left_brace (pp); /* We do not print the namespace-body. */ pp_cxx_whitespace (pp); pp_cxx_right_brace (pp);}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:14,
示例9: pp_cxx_qualified_idstatic voidpp_cxx_qualified_id (cxx_pretty_printer *pp, tree t){ switch (TREE_CODE (t)) { /* A pointer-to-member is always qualified. */ case PTRMEM_CST: pp_cxx_nested_name_specifier (pp, PTRMEM_CST_CLASS (t)); pp_cxx_unqualified_id (pp, PTRMEM_CST_MEMBER (t)); break; /* In Standard C++, functions cannot possibly be used as nested-name-specifiers. However, there are situations where is "makes sense" to output the surrounding function name for the purpose of emphasizing on the scope kind. Just printing the function name might not be sufficient as it may be overloaded; so, we decorate the function with its signature too. FIXME: This is probably the wrong pretty-printing for conversion functions and some function templates. */ case OVERLOAD: t = OVL_CURRENT (t); case FUNCTION_DECL: if (DECL_FUNCTION_MEMBER_P (t)) pp_cxx_nested_name_specifier (pp, DECL_CONTEXT (t)); pp_cxx_unqualified_id (pp, DECL_CONSTRUCTOR_P (t) ? DECL_CONTEXT (t) : t); pp_cxx_parameter_declaration_clause (pp, TREE_TYPE (t)); break; case OFFSET_REF: case SCOPE_REF: pp_cxx_nested_name_specifier (pp, TREE_OPERAND (t, 0)); pp_cxx_unqualified_id (pp, TREE_OPERAND (t, 1)); break; default: { tree scope = TYPE_P (t) ? TYPE_CONTEXT (t) : DECL_CONTEXT (t); if (scope != pp->enclosing_scope) { pp_cxx_nested_name_specifier (pp, scope); pp_cxx_template_keyword_if_needed (pp, scope, t); } pp_cxx_unqualified_id (pp, t); } break; }}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:48,
示例10: gfc_generate_module_codevoidgfc_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,
示例11: make_alias_fortreemake_alias_for (tree function, tree newid){ tree alias = build_decl (FUNCTION_DECL, newid, TREE_TYPE (function)); DECL_LANG_SPECIFIC (alias) = DECL_LANG_SPECIFIC (function); cxx_dup_lang_specific_decl (alias); DECL_CONTEXT (alias) = NULL; TREE_READONLY (alias) = TREE_READONLY (function); TREE_THIS_VOLATILE (alias) = TREE_THIS_VOLATILE (function); TREE_PUBLIC (alias) = 0; DECL_INTERFACE_KNOWN (alias) = 1; DECL_NOT_REALLY_EXTERN (alias) = 1; DECL_THIS_STATIC (alias) = 1; DECL_SAVED_FUNCTION_DATA (alias) = NULL; DECL_DESTRUCTOR_P (alias) = 0; DECL_CONSTRUCTOR_P (alias) = 0; DECL_CLONED_FUNCTION (alias) = NULL_TREE; DECL_EXTERNAL (alias) = 0; DECL_ARTIFICIAL (alias) = 1; DECL_NO_STATIC_CHAIN (alias) = 1; DECL_PENDING_INLINE_P (alias) = 0; DECL_INLINE (alias) = 0; DECL_DECLARED_INLINE_P (alias) = 0; DECL_DEFERRED_FN (alias) = 0; DECL_USE_TEMPLATE (alias) = 0; DECL_TEMPLATE_INSTANTIATED (alias) = 0; DECL_TEMPLATE_INFO (alias) = NULL; DECL_INITIAL (alias) = error_mark_node; 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;}
开发者ID:asdlei00,项目名称:freebsd,代码行数:34,
示例12: make_fname_declstatic treemake_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,
示例13: ubsan_type_descriptor_typestatic treeubsan_type_descriptor_type (void){ static const char *field_names[3] = { "__typekind", "__typeinfo", "__typename" }; tree fields[3], ret; tree itype = build_range_type (sizetype, size_zero_node, NULL_TREE); tree flex_arr_type = build_array_type (char_type_node, itype); ret = make_node (RECORD_TYPE); for (int i = 0; i < 3; i++) { fields[i] = build_decl (UNKNOWN_LOCATION, FIELD_DECL, get_identifier (field_names[i]), (i == 2) ? flex_arr_type : short_unsigned_type_node); DECL_CONTEXT (fields[i]) = ret; if (i) DECL_CHAIN (fields[i - 1]) = fields[i]; } TYPE_FIELDS (ret) = fields[0]; TYPE_NAME (ret) = get_identifier ("__ubsan_type_descriptor"); layout_type (ret); return ret;}
开发者ID:acoxepochlabs,项目名称:gcc,代码行数:25,
示例14: pp_cxx_namespace_alias_definitionstatic voidpp_cxx_namespace_alias_definition (cxx_pretty_printer *pp, tree t){ pp_cxx_identifier (pp, "namespace"); if (DECL_CONTEXT (t)) pp_cxx_nested_name_specifier (pp, DECL_CONTEXT (t)); pp_cxx_unqualified_id (pp, t); pp_cxx_whitespace (pp); pp_equal (pp); pp_cxx_whitespace (pp); if (DECL_CONTEXT (DECL_NAMESPACE_ALIAS (t))) pp_cxx_nested_name_specifier (pp, DECL_CONTEXT (DECL_NAMESPACE_ALIAS (t))); pp_cxx_qualified_id (pp, DECL_NAMESPACE_ALIAS (t)); pp_cxx_semicolon (pp);}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:16,
示例15: lto_input_ts_decl_minimal_tree_pointersstatic voidlto_input_ts_decl_minimal_tree_pointers (struct lto_input_block *ib, struct data_in *data_in, tree expr){ DECL_NAME (expr) = stream_read_tree (ib, data_in); DECL_CONTEXT (expr) = stream_read_tree (ib, data_in);}
开发者ID:pdziepak,项目名称:gcc,代码行数:7,
示例16: lhd_set_decl_assembler_name/* Set the DECL_ASSEMBLER_NAME for DECL. */voidlhd_set_decl_assembler_name (tree decl){ /* The language-independent code should never use the DECL_ASSEMBLER_NAME for lots of DECLs. Only FUNCTION_DECLs and VAR_DECLs for variables with static storage duration need a real DECL_ASSEMBLER_NAME. */ gcc_assert (TREE_CODE (decl) == FUNCTION_DECL || (TREE_CODE (decl) == VAR_DECL && (TREE_STATIC (decl) || DECL_EXTERNAL (decl) || TREE_PUBLIC (decl)))); /* By default, assume the name to use in assembly code is the same as that used in the source language. (That's correct for C, and GCC used to set DECL_ASSEMBLER_NAME to the same value as DECL_NAME in build_decl, so this choice provides backwards compatibility with existing front-ends. Can't use just the variable's own name for a variable whose scope is less than the whole compilation. Concatenate a distinguishing number - we use the DECL_UID. */ if (TREE_PUBLIC (decl) || DECL_CONTEXT (decl) == NULL_TREE) SET_DECL_ASSEMBLER_NAME (decl, DECL_NAME (decl)); else { const char *name = IDENTIFIER_POINTER (DECL_NAME (decl)); char *label; ASM_FORMAT_PRIVATE_NAME (label, name, DECL_UID (decl)); SET_DECL_ASSEMBLER_NAME (decl, get_identifier (label)); }}
开发者ID:RodneyBates,项目名称:M3Devel,代码行数:34,
示例17: write_ts_decl_minimal_tree_pointersstatic voidwrite_ts_decl_minimal_tree_pointers (struct output_block *ob, tree expr, bool ref_p){ stream_write_tree (ob, DECL_NAME (expr), ref_p); stream_write_tree (ob, DECL_CONTEXT (expr), ref_p);}
开发者ID:delkon,项目名称:gcc,代码行数:7,
示例18: create_struct_varstatic treecreate_struct_var (tree type, tree decl, location_t location){ char type_name[50]; tree tmp_var; strcpy(type_name, "rz_"); strcat(type_name, get_name(decl)); tmp_var = build_decl (location, VAR_DECL, get_identifier(type_name), type); /* The variable was declared by the compiler. */ DECL_ARTIFICIAL (tmp_var) = 1; /* And we don't want debug info for it. */ DECL_IGNORED_P (tmp_var) = 1; /* Make the variable writable. */ TREE_READONLY (tmp_var) = 0; DECL_EXTERNAL (tmp_var) = 0; TREE_STATIC (tmp_var) = 0; TREE_USED (tmp_var) = 1; DECL_CONTEXT(tmp_var) = cfun->decl; return tmp_var;}
开发者ID:sdzahed,项目名称:LBC-Plugin,代码行数:29,
示例19: ubsan_source_location_typestatic treeubsan_source_location_type (void){ static const char *field_names[3] = { "__filename", "__line", "__column" }; tree fields[3], ret; tree const_char_type = build_qualified_type (char_type_node, TYPE_QUAL_CONST); ret = make_node (RECORD_TYPE); for (int i = 0; i < 3; i++) { fields[i] = build_decl (UNKNOWN_LOCATION, FIELD_DECL, get_identifier (field_names[i]), (i == 0) ? build_pointer_type (const_char_type) : unsigned_type_node); DECL_CONTEXT (fields[i]) = ret; if (i) DECL_CHAIN (fields[i - 1]) = fields[i]; } TYPE_FIELDS (ret) = fields[0]; TYPE_NAME (ret) = get_identifier ("__ubsan_source_location"); layout_type (ret); return ret;}
开发者ID:acoxepochlabs,项目名称:gcc,代码行数:25,
示例20: pp_cxx_function_definitionvoidpp_cxx_function_definition (cxx_pretty_printer *pp, tree t){ tree saved_scope = pp->enclosing_scope; pp_cxx_decl_specifier_seq (pp, t); pp_cxx_declarator (pp, t); pp_needs_newline (pp) = true; pp->enclosing_scope = DECL_CONTEXT (t); if (DECL_SAVED_TREE (t)) { tree body = DECL_SAVED_TREE (t); if (TREE_CODE (body) == COMPOUND_STMT && TREE_CODE (COMPOUND_BODY (body)) == CTOR_INITIALIZER) { body = COMPOUND_BODY (body); pp_cxx_ctor_initializer (pp, body); body = TREE_CHAIN (body); } pp_cxx_statement (pp, body); } else { pp_cxx_semicolon (pp); pp_needs_newline (pp) = true; } pp_flush (pp); pp->enclosing_scope = saved_scope;}
开发者ID:Fokycnuk,项目名称:gcc,代码行数:28,
示例21: cplus_expand_constanttreecplus_expand_constant (tree cst){ switch (TREE_CODE (cst)) { case PTRMEM_CST: { tree type = TREE_TYPE (cst); tree member; /* Find the member. */ member = PTRMEM_CST_MEMBER (cst); if (TREE_CODE (member) == FIELD_DECL) { /* Find the offset for the field. */ cst = byte_position (member); while (!same_type_p (DECL_CONTEXT (member), TYPE_PTRMEM_CLASS_TYPE (type))) { /* The MEMBER must have been nestled within an anonymous aggregate contained in TYPE. Find the anonymous aggregate. */ member = lookup_anon_field (TYPE_PTRMEM_CLASS_TYPE (type), DECL_CONTEXT (member)); cst = size_binop (PLUS_EXPR, cst, byte_position (member)); } cst = fold (build_nop (type, cst)); } else { tree delta; tree pfn; expand_ptrmemfunc_cst (cst, &delta, &pfn); cst = build_ptrmemfunc1 (type, delta, pfn); } } break; default: /* There's nothing to do. */ break; } return cst;}
开发者ID:mbref,项目名称:gcc-412-microblaze,代码行数:47,
示例22: create_struct_typestatic treecreate_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,
示例23: is_capture_proxyboolis_capture_proxy (tree decl){ return (VAR_P (decl) && DECL_HAS_VALUE_EXPR_P (decl) && !DECL_ANON_UNION_VAR_P (decl) && LAMBDA_FUNCTION_P (DECL_CONTEXT (decl)));}
开发者ID:nguyentu1602,项目名称:gcc,代码行数:8,
示例24: write_ts_decl_minimal_tree_pointersstatic voidwrite_ts_decl_minimal_tree_pointers (struct output_block *ob, tree expr, bool ref_p){ stream_write_tree (ob, DECL_NAME (expr), ref_p); stream_write_tree (ob, DECL_CONTEXT (expr), ref_p); lto_output_location (ob, DECL_SOURCE_LOCATION (expr));}
开发者ID:Samsara00,项目名称:DragonFlyBSD,代码行数:8,
示例25: error_not_base_typetreeerror_not_base_type (tree basetype, tree type){ if (TREE_CODE (basetype) == FUNCTION_DECL) basetype = DECL_CONTEXT (basetype); error ("type %qT is not a base type for type %qT", basetype, type); return error_mark_node;}
开发者ID:aosm,项目名称:gcc_42,代码行数:8,
示例26: create_cilk_helper_declstatic treecreate_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,
示例27: copy_var_decltreecopy_var_decl (tree var, tree name, tree type){ tree copy = build_decl (DECL_SOURCE_LOCATION (var), VAR_DECL, name, type); TREE_ADDRESSABLE (copy) = TREE_ADDRESSABLE (var); TREE_THIS_VOLATILE (copy) = TREE_THIS_VOLATILE (var); DECL_GIMPLE_REG_P (copy) = DECL_GIMPLE_REG_P (var); DECL_ARTIFICIAL (copy) = DECL_ARTIFICIAL (var); DECL_IGNORED_P (copy) = DECL_IGNORED_P (var); DECL_CONTEXT (copy) = DECL_CONTEXT (var); TREE_NO_WARNING (copy) = TREE_NO_WARNING (var); TREE_USED (copy) = 1; DECL_SEEN_IN_BIND_EXPR_P (copy) = 1; DECL_ATTRIBUTES (copy) = DECL_ATTRIBUTES (var); return copy;}
开发者ID:earonesty,项目名称:gcc,代码行数:18,
示例28: add_friendvoidadd_friend (tree type, tree decl, bool complain){ tree typedecl; tree list; tree name; tree ctx; if (decl == error_mark_node) return; typedecl = TYPE_MAIN_DECL (type); list = DECL_FRIENDLIST (typedecl); name = DECL_NAME (decl); type = TREE_TYPE (typedecl); while (list) { if (name == FRIEND_NAME (list)) { tree friends = FRIEND_DECLS (list); for (; friends ; friends = TREE_CHAIN (friends)) { if (decl == TREE_VALUE (friends)) { if (complain) warning (OPT_Wredundant_decls, "%qD is already a friend of class %qT", decl, type); return; } } maybe_add_class_template_decl_list (type, decl, /*friend_p=*/1); TREE_VALUE (list) = tree_cons (NULL_TREE, decl, TREE_VALUE (list)); return; } list = TREE_CHAIN (list); } ctx = DECL_CONTEXT (decl); if (ctx && CLASS_TYPE_P (ctx) && !uses_template_parms (ctx)) perform_or_defer_access_check (TYPE_BINFO (ctx), decl, decl, tf_warning_or_error); maybe_add_class_template_decl_list (type, decl, /*friend_p=*/1); DECL_FRIENDLIST (typedecl) = tree_cons (DECL_NAME (decl), build_tree_list (NULL_TREE, decl), DECL_FRIENDLIST (typedecl)); if (!uses_template_parms (type)) DECL_BEFRIENDING_CLASSES (decl) = tree_cons (NULL_TREE, type, DECL_BEFRIENDING_CLASSES (decl));}
开发者ID:AHelper,项目名称:gcc,代码行数:57,
示例29: find_fieldref_indexintfind_fieldref_index (CPool *cpool, tree decl){ int class_index = find_class_constant (cpool, DECL_CONTEXT (decl)); int name_type_index = find_name_and_type_constant (cpool, DECL_NAME (decl), TREE_TYPE (decl)); return find_constant1 (cpool, CONSTANT_Fieldref, (class_index << 16) | name_type_index);}
开发者ID:IntegerCompany,项目名称:linaro-android-gcc,代码行数:9,
注:本文中的DECL_CONTEXT函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ DECL_DECLARED_INLINE_P函数代码示例 C++ DECL_COMDAT函数代码示例 |