本文整理汇总了C++中DECL_ATTRIBUTES函数的典型用法代码示例。如果您正苦于以下问题:C++ DECL_ATTRIBUTES函数的具体用法?C++ DECL_ATTRIBUTES怎么用?C++ DECL_ATTRIBUTES使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DECL_ATTRIBUTES函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: maybe_add_dllexport
static inline void maybe_add_dllexport (tree decl)
{
if (i386_pe_type_dllexport_p (decl))
{
tree decl_attrs = DECL_ATTRIBUTES (decl);
if (lookup_attribute ("dllexport", decl_attrs) != NULL_TREE)
/* Already done. */
return;
DECL_ATTRIBUTES (decl) = tree_cons (get_identifier ("dllexport"),
NULL_TREE, decl_attrs);
}
}
示例3: get_attribute
const_tree get_attribute(const char* attr_name, const_tree decl)
{
const_tree attr = lookup_attribute(attr_name, DECL_ATTRIBUTES(decl));
if (attr && TREE_VALUE(attr))
return attr;
return NULL_TREE;
}
示例4: write_ts_decl_common_tree_pointers
static void
write_ts_decl_common_tree_pointers (struct output_block *ob, tree expr,
bool ref_p)
{
stream_write_tree (ob, DECL_SIZE (expr), ref_p);
stream_write_tree (ob, DECL_SIZE_UNIT (expr), ref_p);
/* Note, DECL_INITIAL is not handled here. Since DECL_INITIAL needs
special handling in LTO, it must be handled by streamer hooks. */
stream_write_tree (ob, DECL_ATTRIBUTES (expr), ref_p);
/* Do not stream DECL_ABSTRACT_ORIGIN. We cannot handle debug information
for early inlining so drop it on the floor instead of ICEing in
dwarf2out.c. */
if (TREE_CODE (expr) == PARM_DECL)
streamer_write_chain (ob, TREE_CHAIN (expr), ref_p);
if ((TREE_CODE (expr) == VAR_DECL
|| TREE_CODE (expr) == PARM_DECL)
&& DECL_HAS_VALUE_EXPR_P (expr))
stream_write_tree (ob, DECL_VALUE_EXPR (expr), ref_p);
if (TREE_CODE (expr) == VAR_DECL)
stream_write_tree (ob, DECL_DEBUG_EXPR (expr), ref_p);
}
示例5: solaris_insert_attributes
void
solaris_insert_attributes (tree decl, tree *attributes)
{
tree *x, next;
if (solaris_pending_aligns != NULL && TREE_CODE (decl) == VAR_DECL)
for (x = &solaris_pending_aligns; *x; x = &TREE_CHAIN (*x))
{
tree name = TREE_PURPOSE (*x);
tree value = TREE_VALUE (*x);
if (DECL_NAME (decl) == name)
{
if (lookup_attribute ("aligned", DECL_ATTRIBUTES (decl))
|| lookup_attribute ("aligned", *attributes))
warning (0, "ignoring %<#pragma align%> for explicitly "
"aligned %q+D", decl);
else
*attributes = tree_cons (get_identifier ("aligned"), value,
*attributes);
next = TREE_CHAIN (*x);
ggc_free (*x);
*x = next;
break;
}
}
if (solaris_pending_inits != NULL && TREE_CODE (decl) == FUNCTION_DECL)
for (x = &solaris_pending_inits; *x; x = &TREE_CHAIN (*x))
{
tree name = TREE_PURPOSE (*x);
if (DECL_NAME (decl) == name)
{
*attributes = tree_cons (get_identifier ("init"), NULL,
*attributes);
*attributes = tree_cons (get_identifier ("used"), NULL,
*attributes);
next = TREE_CHAIN (*x);
ggc_free (*x);
*x = next;
break;
}
}
if (solaris_pending_finis != NULL && TREE_CODE (decl) == FUNCTION_DECL)
for (x = &solaris_pending_finis; *x; x = &TREE_CHAIN (*x))
{
tree name = TREE_PURPOSE (*x);
if (DECL_NAME (decl) == name)
{
*attributes = tree_cons (get_identifier ("fini"), NULL,
*attributes);
*attributes = tree_cons (get_identifier ("used"), NULL,
*attributes);
next = TREE_CHAIN (*x);
ggc_free (*x);
*x = next;
break;
}
}
}
示例6: lto_input_ts_decl_common_tree_pointers
static void
lto_input_ts_decl_common_tree_pointers (struct lto_input_block *ib,
struct data_in *data_in, tree expr)
{
DECL_SIZE (expr) = stream_read_tree (ib, data_in);
DECL_SIZE_UNIT (expr) = stream_read_tree (ib, data_in);
DECL_ATTRIBUTES (expr) = stream_read_tree (ib, data_in);
/* Do not stream DECL_ABSTRACT_ORIGIN. We cannot handle debug information
for early inlining so drop it on the floor instead of ICEing in
dwarf2out.c. */
if (TREE_CODE (expr) == PARM_DECL)
TREE_CHAIN (expr) = streamer_read_chain (ib, data_in);
if ((TREE_CODE (expr) == VAR_DECL
|| TREE_CODE (expr) == PARM_DECL)
&& DECL_HAS_VALUE_EXPR_P (expr))
SET_DECL_VALUE_EXPR (expr, stream_read_tree (ib, data_in));
if (TREE_CODE (expr) == VAR_DECL)
{
tree dexpr = stream_read_tree (ib, data_in);
if (dexpr)
SET_DECL_DEBUG_EXPR (expr, dexpr);
}
}
示例7: solaris_output_init_fini
void
solaris_output_init_fini (FILE *file, tree decl)
{
if (lookup_attribute ("init", DECL_ATTRIBUTES (decl)))
{
fprintf (file, "\t.pushsection\t\".init\"\n");
ASM_OUTPUT_CALL (file, decl);
fprintf (file, "\t.popsection\n");
}
if (lookup_attribute ("fini", DECL_ATTRIBUTES (decl)))
{
fprintf (file, "\t.pushsection\t\".fini\"\n");
ASM_OUTPUT_CALL (file, decl);
fprintf (file, "\t.popsection\n");
}
}
示例8: decide_is_function_needed
static bool
decide_is_function_needed (struct cgraph_node *node, tree decl)
{
if (MAIN_NAME_P (DECL_NAME (decl))
&& TREE_PUBLIC (decl))
{
node->local.externally_visible = true;
return true;
}
/* If the user told us it is used, then it must be so. */
if (node->local.externally_visible)
return true;
/* ??? If the assembler name is set by hand, it is possible to assemble
the name later after finalizing the function and the fact is noticed
in assemble_name then. This is arguably a bug. */
if (DECL_ASSEMBLER_NAME_SET_P (decl)
&& TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
return true;
/* With -fkeep-inline-functions we are keeping all inline functions except
for extern inline ones. */
if (flag_keep_inline_functions
&& DECL_DECLARED_INLINE_P (decl)
&& !DECL_EXTERNAL (decl)
&& !lookup_attribute ("always_inline", DECL_ATTRIBUTES (decl)))
return true;
/* If we decided it was needed before, but at the time we didn't have
the body of the function available, then it's still needed. We have
to go back and re-check its dependencies now. */
if (node->needed)
return true;
/* Externally visible functions must be output. The exception is
COMDAT functions that must be output only when they are needed.
When not optimizing, also output the static functions. (see
PR24561), but don't do so for always_inline functions, functions
declared inline and nested functions. These was optimized out
in the original implementation and it is unclear whether we want
to change the behavior here. */
if (((TREE_PUBLIC (decl)
|| (!optimize && !node->local.disregard_inline_limits
&& !DECL_DECLARED_INLINE_P (decl)
&& !node->origin))
&& !flag_whole_program)
&& !DECL_COMDAT (decl) && !DECL_EXTERNAL (decl))
return true;
/* Constructors and destructors are reachable from the runtime by
some mechanism. */
if (DECL_STATIC_CONSTRUCTOR (decl) || DECL_STATIC_DESTRUCTOR (decl))
return true;
return false;
}
示例9: c_disregard_inline_limits
int
c_disregard_inline_limits (tree fn)
{
if (lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn)) != NULL)
return 1;
return (!flag_really_no_inline && DECL_DECLARED_INLINE_P (fn)
&& DECL_EXTERNAL (fn));
}
示例10: copy_var_decl
tree
copy_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;
}
示例11: build_module_descriptor
void
build_module_descriptor (long vers, tree attr)
{
tree decls, *chain = NULL;
#ifdef OBJCPLUS
push_lang_context (lang_name_c); /* extern "C" */
#endif
objc_module_template = objc_start_struct (get_identifier (UTAG_MODULE));
/* long version; */
decls = add_field_decl (long_integer_type_node, "version", &chain);
/* long size; */
add_field_decl (long_integer_type_node, "size", &chain);
/* char *name; */
add_field_decl (string_type_node, "name", &chain);
/* struct _objc_symtab *symtab; */
add_field_decl (build_pointer_type (xref_tag (RECORD_TYPE,
get_identifier (UTAG_SYMTAB))),
"symtab", &chain);
objc_finish_struct (objc_module_template, decls);
/* Create an instance of "_objc_module". */
UOBJC_MODULES_decl = start_var_decl (objc_module_template,
/* FIXME - why the conditional
if the symbol is the
same. */
flag_next_runtime ? "_OBJC_Module" : "_OBJC_Module");
/* This is the root of the metadata for defined classes and categories, it
is referenced by the runtime and, therefore, needed. */
DECL_PRESERVE_P (UOBJC_MODULES_decl) = 1;
/* Squash `defined but not used' warning. */
TREE_USED (UOBJC_MODULES_decl) = 1;
/* Allow the runtime to mark meta-data such that it can be assigned to target
specific sections by the back-end. */
if (attr)
DECL_ATTRIBUTES (UOBJC_MODULES_decl) = attr;
finish_var_decl (UOBJC_MODULES_decl,
init_module_descriptor (TREE_TYPE (UOBJC_MODULES_decl),
vers));
#ifdef OBJCPLUS
pop_lang_context ();
#endif
}
示例12: gate_latent_entropy
static bool gate_latent_entropy(void)
{
// don't bother with noreturn functions for now
if (TREE_THIS_VOLATILE(current_function_decl))
return false;
// gcc-4.5 doesn't discover some trivial noreturn functions
if (EDGE_COUNT(EXIT_BLOCK_PTR_FOR_FN(cfun)->preds) == 0)
return false;
return lookup_attribute("latent_entropy", DECL_ATTRIBUTES(current_function_decl)) != NULL_TREE;
}
示例13: instrument_assignments_plugin_exec
static unsigned int instrument_assignments_plugin_exec(void)
{
#ifdef DEBUG
fprintf(stderr, "* Inspecting function `%s'\n", FN_NAME);
#endif
basic_block bb;
FOR_EACH_BB(bb) {
gimple_stmt_iterator gsi;
for (gsi = gsi_start_bb(bb) ; !gsi_end_p(gsi) ; gsi_next(&gsi)) {
gimple curr_stmt = gsi_stmt(gsi);
tree lhs = gimple_get_lhs(curr_stmt);
// We only care about assignments to “real” variables – i.e. not
// variable versions that were created as part of the transformation
// to SSA form.
if (gimple_code(curr_stmt) == GIMPLE_ASSIGN
&& lhs != NULL_TREE && TREE_CODE(lhs) != SSA_NAME && DECL_P(lhs)) {
tree attrlist = DECL_ATTRIBUTES(lhs);
tree attr = lookup_attribute("instrument", attrlist);
// the princess is in another castle
if (attr == NULL_TREE) continue;
// read the variable id that was passed to the `instrument'
// attribute
const_tree arg = TREE_VALUE(TREE_VALUE(attr));
tree var_id = build_int_cst(NULL_TREE, tree_low_cst (arg, 1));
#ifdef DEBUG
fprintf(stderr, " > found assignment to instrumented variable `%s': \n\t", get_name(lhs));
print_gimple_stmt(stderr, curr_stmt, 0, 0);
fprintf(stderr, "\tbase address of `%s' is %p\n", get_name(lhs), get_base_address(lhs));
#endif
// insert our instrumentation function before the current
// statement and pass along the rhs (i.e. the new value)
tree rhs = gimple_op(curr_stmt, 1);
insert_instrumentation_fn(curr_stmt, var_id, rhs);
}
}
}
#ifdef DEBUG
fprintf(stderr, "\n");
#endif
return 0;
}
示例14: i386_pe_determine_dllexport_p
static bool
i386_pe_determine_dllexport_p (tree decl)
{
if (TREE_CODE (decl) != VAR_DECL && TREE_CODE (decl) != FUNCTION_DECL)
return false;
/* Don't export local clones of dllexports. */
if (!TREE_PUBLIC (decl))
return false;
if (lookup_attribute ("dllexport", DECL_ATTRIBUTES (decl)))
return true;
return false;
}
示例15: varpool_create_variable_alias
varpool_node *
varpool_create_variable_alias (tree alias, tree decl)
{
varpool_node *alias_node;
gcc_assert (TREE_CODE (decl) == VAR_DECL);
gcc_assert (TREE_CODE (alias) == VAR_DECL);
alias_node = varpool_node_for_decl (alias);
alias_node->alias = true;
alias_node->definition = true;
alias_node->alias_target = decl;
if (lookup_attribute ("weakref", DECL_ATTRIBUTES (alias)) != NULL)
alias_node->weakref = true;
return alias_node;
}