diff options
author | Martin Liska <mliska@suse.cz> | 2014-06-04 11:44:33 +0200 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2014-06-04 09:44:33 +0000 |
commit | 8a57e88dc63d44a2f72781e4732ede00f14205cf (patch) | |
tree | 1470e3aa0e88e7cee9a286e65c00ca02080a9d9a /gcc/tree.h | |
parent | d211e4719264a66f3a310870d7459751c335ce7f (diff) | |
download | gcc-8a57e88dc63d44a2f72781e4732ede00f14205cf.zip gcc-8a57e88dc63d44a2f72781e4732ede00f14205cf.tar.gz gcc-8a57e88dc63d44a2f72781e4732ede00f14205cf.tar.bz2 |
New attribute lookup function addition
* tree.h (private_lookup_attribute_starting): New function.
(lookup_attribute_starting): Likewise.
* tree.c (private_lookup_attribute_starting): Likewise.
From-SVN: r211219
Diffstat (limited to 'gcc/tree.h')
-rw-r--r-- | gcc/tree.h | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -3736,6 +3736,10 @@ extern tree merge_type_attributes (tree, tree); and you should never call it directly. */ extern tree private_lookup_attribute (const char *, size_t, tree); +/* This function is a private implementation detail + of lookup_attribute_by_prefix() and you should never call it directly. */ +extern tree private_lookup_attribute_by_prefix (const char *, size_t, tree); + /* Given an attribute name ATTR_NAME and a list of attributes LIST, return a pointer to the attribute's list element if the attribute is part of the list, or NULL_TREE if not found. If the attribute @@ -3758,6 +3762,24 @@ lookup_attribute (const char *attr_name, tree list) return private_lookup_attribute (attr_name, strlen (attr_name), list); } +/* Given an attribute name ATTR_NAME and a list of attributes LIST, + return a pointer to the attribute's list first element if the attribute + starts with ATTR_NAME. ATTR_NAME must be in the form 'text' (not + '__text__'). */ + +static inline tree +lookup_attribute_by_prefix (const char *attr_name, tree list) +{ + gcc_checking_assert (attr_name[0] != '_'); + /* In most cases, list is NULL_TREE. */ + if (list == NULL_TREE) + return NULL_TREE; + else + return private_lookup_attribute_by_prefix (attr_name, strlen (attr_name), + list); +} + + /* This function is a private implementation detail of is_attribute_p() and you should never call it directly. */ extern bool private_is_attribute_p (const char *, size_t, const_tree); |