/* Add ATTR to the attributes of the current function. If there is no such function, save it to be added to the attributes of the next function. */ static void sh_add_function_attribute (const char *attr) { tree id = get_identifier (attr); if (current_function_decl) decl_attributes (¤t_function_decl, tree_cons (id, NULL_TREE, NULL_TREE), 0); else { *sh_deferred_function_attributes_tail = tree_cons (id, NULL_TREE, *sh_deferred_function_attributes_tail); sh_deferred_function_attributes_tail = &TREE_CHAIN (*sh_deferred_function_attributes_tail); } }
static void mark_current_function_as_interrupt (void) { tree name; if (current_function_decl == NULL_TREE) { warning (0, "cannot set interrupt attribute: no current function"); return; } name = get_identifier ("interrupt"); if (name == NULL_TREE || TREE_CODE (name) != IDENTIFIER_NODE) { warning (0, "cannot set interrupt attribute: no such identifier"); return; } decl_attributes (¤t_function_decl, tree_cons (name, NULL_TREE, NULL_TREE), 0); }
void apply_tm_attr (tree fndecl, tree attr) { decl_attributes (&TREE_TYPE (fndecl), tree_cons (attr, NULL, NULL), 0); }
void i386_pe_adjust_class_at_definition (tree t) { tree member; gcc_assert (CLASS_TYPE_P (t)); if (lookup_attribute ("dllexport", TYPE_ATTRIBUTES (t)) != NULL_TREE) { tree tmv = TYPE_MAIN_VARIANT (t); /* Make sure that we set dllexport attribute to typeinfo's base declaration, as otherwise it would fail to be exported as it isn't a class-member. */ if (tmv != NULL_TREE && CLASSTYPE_TYPEINFO_VAR (tmv) != NULL_TREE) { tree na, ti_decl = CLASSTYPE_TYPEINFO_VAR (tmv); na = tree_cons (get_identifier ("dllexport"), NULL_TREE, NULL_TREE); decl_attributes (&ti_decl, na, 0); } /* Check static VAR_DECL's. */ for (member = TYPE_FIELDS (t); member; member = DECL_CHAIN (member)) if (TREE_CODE (member) == VAR_DECL) maybe_add_dllexport (member); /* Check FUNCTION_DECL's. */ for (member = TYPE_METHODS (t); member; member = DECL_CHAIN (member)) if (TREE_CODE (member) == FUNCTION_DECL) { tree thunk; maybe_add_dllexport (member); /* Also add the attribute to its thunks. */ for (thunk = DECL_THUNKS (member); thunk; thunk = TREE_CHAIN (thunk)) maybe_add_dllexport (thunk); } /* Check vtables */ for (member = CLASSTYPE_VTABLES (t); member; member = DECL_CHAIN (member)) if (TREE_CODE (member) == VAR_DECL) maybe_add_dllexport (member); } else if (lookup_attribute ("dllimport", TYPE_ATTRIBUTES (t)) != NULL_TREE) { /* We don't actually add the attribute to the decl, just set the flag that signals that the address of this symbol is not a compile-time constant. Any subsequent out-of-class declaration of members wil cause the DECL_DLLIMPORT_P flag to be unset. (See tree.c: merge_dllimport_decl_attributes). That is just right since out-of class declarations can only be a definition. */ /* Check static VAR_DECL's. */ for (member = TYPE_FIELDS (t); member; member = DECL_CHAIN (member)) if (TREE_CODE (member) == VAR_DECL) maybe_add_dllimport (member); /* Check FUNCTION_DECL's. */ for (member = TYPE_METHODS (t); member; member = DECL_CHAIN (member)) if (TREE_CODE (member) == FUNCTION_DECL) { tree thunk; maybe_add_dllimport (member); /* Also add the attribute to its thunks. */ for (thunk = DECL_THUNKS (member); thunk; thunk = DECL_CHAIN (thunk)) maybe_add_dllimport (thunk); } /* Check vtables */ for (member = CLASSTYPE_VTABLES (t); member; member = DECL_CHAIN (member)) if (TREE_CODE (member) == VAR_DECL) maybe_add_dllimport (member); /* We leave typeinfo tables alone. We can't mark TI objects as dllimport, since the address of a secondary VTT may be needed for static initialization of a primary VTT. VTT's of dllimport'd classes should always be link-once COMDAT. */ } }
static tree /* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ gimplify_cp_loop (tree cond, tree body, tree incr, tree attrs, bool cond_is_first, tree inner_foreach) /* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ { tree top, entry, exit, cont_block, break_block, stmt_list, t; location_t stmt_locus; stmt_locus = input_location; stmt_list = NULL_TREE; entry = NULL_TREE; /* APPLE LOCAL begin C* language */ /* Order of label addition to stack is important for objc's foreach-stmt. */ /* APPLE LOCAL radar 4667060 */ if (inner_foreach == integer_zero_node) { cont_block = begin_bc_block (bc_continue); break_block = begin_bc_block (bc_break); } else { break_block = begin_bc_block (bc_break); cont_block = begin_bc_block (bc_continue); } /* APPLE LOCAL end C* language */ /* If condition is zero don't generate a loop construct. */ if (cond && integer_zerop (cond)) { top = NULL_TREE; exit = NULL_TREE; if (cond_is_first) { t = build_bc_goto (bc_break); append_to_statement_list (t, &stmt_list); } } else { /* If we use a LOOP_EXPR here, we have to feed the whole thing back through the main gimplifier to lower it. Given that we have to gimplify the loop body NOW so that we can resolve break/continue stmts, seems easier to just expand to gotos. */ top = build1 (LABEL_EXPR, void_type_node, NULL_TREE); /* If we have an exit condition, then we build an IF with gotos either out of the loop, or to the top of it. If there's no exit condition, then we just build a jump back to the top. */ exit = build_and_jump (&LABEL_EXPR_LABEL (top)); /* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ /* Add the attributes to the 'top' label. */ decl_attributes (&LABEL_EXPR_LABEL (top), attrs, 0); /* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ if (cond && !integer_nonzerop (cond)) { t = build_bc_goto (bc_break); exit = fold_build3 (COND_EXPR, void_type_node, cond, exit, t); gimplify_stmt (&exit); if (cond_is_first) { if (incr) { entry = build1 (LABEL_EXPR, void_type_node, NULL_TREE); t = build_and_jump (&LABEL_EXPR_LABEL (entry)); } else t = build_bc_goto (bc_continue); append_to_statement_list (t, &stmt_list); } } } /* APPLE LOCAL begin radar 4547045 */ /* Pop foreach's inner loop break label so outer loop's break label becomes target of inner loop body's break statements. */ t = NULL_TREE; gimplify_stmt (&body); gimplify_stmt (&incr); body = finish_bc_block (bc_continue, cont_block, body); /* APPLE LOCAL begin radar 4547045 */ /* Push back inner loop's own 'break' label so rest of code works seemlessly. */ /* APPLE LOCAL radar 4667060 */ append_to_statement_list (top, &stmt_list); append_to_statement_list (body, &stmt_list); append_to_statement_list (incr, &stmt_list); append_to_statement_list (entry, &stmt_list); append_to_statement_list (exit, &stmt_list); annotate_all_with_locus (&stmt_list, stmt_locus); return finish_bc_block (bc_break, break_block, stmt_list); }