GCC Middle and Back End API Reference
attribs.c File Reference

Data Structures

struct  substring
struct  attribute_hasher
struct  scoped_attributes

Functions

static hashval_t substring_hash ()
static scoped_attributesfind_attribute_namespace (const char *)
static void register_scoped_attribute (const struct attribute_spec *, scoped_attributes *)
static void extract_attribute_substring ()
scoped_attributesregister_scoped_attributes (const struct attribute_spec *attributes, const char *ns)
static scoped_attributesfind_attribute_namespace ()
void init_attributes ()
void register_attribute ()
struct attribute_speclookup_scoped_attribute_spec ()
struct attribute_speclookup_attribute_spec ()
tree decl_attributes ()
bool cxx11_attribute_p ()
tree get_attribute_name ()
tree get_attribute_namespace ()
void apply_tm_attr ()

Variables

static struct attribute_specattribute_tables [4]
static vec< scoped_attributesattributes_table
static bool attributes_initialized = false
static struct attribute_spec empty_attribute_table []

Function Documentation

void apply_tm_attr ( )
Subroutine of set_method_tm_attributes.  Apply TM attribute ATTR
   to the method FNDECL.   

References decl_attributes().

bool cxx11_attribute_p ( )
Return TRUE iff ATTR has been parsed by the front-end as a C++-11
   attribute.

   When G++ parses a C++11 attribute, it is represented as
   a TREE_LIST which TREE_PURPOSE is itself a TREE_LIST.  TREE_PURPOSE
   (TREE_PURPOSE (ATTR)) is the namespace of the attribute, and the
   TREE_VALUE (TREE_PURPOSE (ATTR)) is its non-qualified name.  Please
   use get_attribute_namespace and get_attribute_name to retrieve the
   namespace and name of the attribute, as these accessors work with
   GNU attributes as well.   

Referenced by decl_attributes(), get_attribute_name(), and get_attribute_namespace().

tree decl_attributes ( )
Process the attributes listed in ATTRIBUTES and install them in *NODE,
   which is either a DECL (including a TYPE_DECL) or a TYPE.  If a DECL,
   it should be modified in place; if a TYPE, a copy should be created
   unless ATTR_FLAG_TYPE_IN_PLACE is set in FLAGS.  FLAGS gives further
   information, in the form of a bitwise OR of flags in enum attribute_flags
   from tree.h.  Depending on these flags, some attributes may be
   returned to be applied at a later stage (for example, to apply
   a decl attribute to the declaration rather than to its type).   

References ATTR_FLAG_ARRAY_NEXT, ATTR_FLAG_BUILT_IN, ATTR_FLAG_CXX11, ATTR_FLAG_DECL_NEXT, ATTR_FLAG_FUNCTION_NEXT, ATTR_FLAG_TYPE_IN_PLACE, attributes_initialized, build_pointer_type(), build_qualified_type(), build_type_attribute_variant(), chainon(), copy_list(), cxx11_attribute_p(), attribute_spec::decl_required, error(), attribute_spec::function_type_required, get_attribute_name(), get_attribute_namespace(), get_identifier(), attribute_spec::handler, inform(), init_attributes(), input_location, is_attribute_p(), list_length(), lookup_attribute(), lookup_attribute_spec(), lookup_scoped_attribute_spec(), attribute_spec::max_length, attribute_spec::min_length, attribute_spec::name, relayout_decl(), simple_cst_equal(), targetm, attribute_spec::type_required, and warning().

Referenced by add_builtin_function_common(), apply_tm_attr(), and init_block_move_fn().

static void extract_attribute_substring ( )
static
Return base name of the attribute.  Ie '__attr__' is turned into 'attr'.
   To avoid need for copying, we simply return length of the string.   

References substring::length, and substring::str.

Referenced by lookup_scoped_attribute_spec().

static scoped_attributes* find_attribute_namespace ( const char *  )
static
static scoped_attributes* find_attribute_namespace ( )
static
Return the namespace which name is NS, NULL if none exist.   

References scoped_attributes::ns.

tree get_attribute_name ( )
Return the name of the attribute ATTR.  This accessor works on GNU
   and C++11 (scoped) attributes.

   Please read the comments of cxx11_attribute_p to understand the
   format of attributes.   

References cxx11_attribute_p().

Referenced by attribute_hash_list(), attribute_list_contained(), comp_type_attributes(), decl_attributes(), lookup_ident_attribute(), merge_attributes(), private_lookup_attribute(), and remove_attribute().

tree get_attribute_namespace ( )
Return the namespace of the attribute ATTR.  This accessor works on
   GNU and C++11 (scoped) attributes.  On GNU attributes,
   it returns an identifier tree for the string "gnu".

   Please read the comments of cxx11_attribute_p to understand the
   format of attributes.   

References cxx11_attribute_p(), and get_identifier().

Referenced by decl_attributes().

struct attribute_spec* lookup_attribute_spec ( )
read
Return the spec for the attribute named NAME.  If NAME is a TREE_LIST,
   it also specifies the attribute namespace.   

References get_identifier(), and lookup_scoped_attribute_spec().

Referenced by comp_type_attributes(), and decl_attributes().

struct attribute_spec* lookup_scoped_attribute_spec ( )
read
Return the spec for the scoped attribute with namespace NS and
   name NAME.    

References extract_attribute_substring(), find_attribute_namespace(), substring::length, substring::str, and substring_hash().

Referenced by decl_attributes(), and lookup_attribute_spec().

void register_attribute ( )
Insert a single ATTR into the attribute table.   

References find_attribute_namespace(), and register_scoped_attribute().

static void register_scoped_attribute ( const struct attribute_spec attr,
scoped_attributes name_space 
)
static
scoped_attributes* register_scoped_attributes ( const struct attribute_spec attributes,
const char *  ns 
)
read
Insert an array of attributes ATTRIBUTES into a namespace.  This
   array must be NULL terminated.  NS is the name of attribute
   namespace.  The function returns the namespace into which the
   attributes have been registered.   

References scoped_attributes::attribute_hash, scoped_attributes::attributes, hash_table< Descriptor, Allocator >::create(), find_attribute_namespace(), memset(), attribute_spec::name, scoped_attributes::ns, and register_scoped_attribute().

Referenced by init_attributes().

static hashval_t substring_hash ( )
inlinestatic
Simple hash function to avoid need to scan whole string.   

Referenced by attribute_hasher::hash(), lookup_scoped_attribute_spec(), and register_scoped_attribute().


Variable Documentation

struct attribute_spec* attribute_tables[4]
static
@verbatim Functions dealing with attribute handling, used by most front ends.

Copyright (C) 1992-2013 Free Software Foundation, Inc.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see http://www.gnu.org/licenses/.

Table of the tables of attributes (common, language, format, machine)
   searched.   
bool attributes_initialized = false
static

Referenced by decl_attributes(), and init_attributes().

vec<scoped_attributes> attributes_table
static
The table of scope attributes.   
struct attribute_spec empty_attribute_table[]
static
Initial value:
{
{ NULL, 0, 0, false, false, false, NULL, false }
}
Default empty table of attributes.   

Referenced by init_attributes().