Lines Matching defs:attribute

737   option would be available. This attribute will impact tool --help
2862 How to add an attribute
2868 analysis. This document explains how to add a custom attribute to Clang.
2874 Attributes in Clang are handled in three stages: parsing into a parsed attribute
2875 representation, conversion from a parsed attribute into a semantic attribute,
2876 and then the semantic handling of the attribute.
2878 Parsing of the attribute is determined by the various syntactic forms attributes
2880 information provided by the table definition of the attribute. Ultimately, the
2881 parsed representation of an attribute object is a ``ParsedAttr`` object.
2885 keywords. When implementing a custom keyword attribute, the parsing of the
2889 a ``ParsedAttr``, at which point the parsed attribute can be transformed
2890 into a semantic attribute. The process by which a parsed attribute is converted
2891 into a semantic attribute depends on the attribute definition and semantic
2892 requirements of the attribute. The end result, however, is that the semantic
2893 attribute object is attached to the ``Decl`` object, and can be obtained by a
2896 ``ParsedAttr`` objects to be converted into a semantic attribute.
2898 The structure of the semantic attribute is also governed by the attribute
2900 functionality used for the implementation of the attribute, such as a class
2907 The first step to adding a new attribute to Clang is to add its definition to
2912 ``InheritableAttr`` type, which specifies that the attribute can be inherited by
2915 attribute is written on a parameter instead of a declaration. If the attribute
2916 applies to statements, it should inherit from ``StmtAttr``. If the attribute is
2917 intended to apply to a type instead of a declaration, such an attribute should
2920 attribute that inherits from ``IgnoredAttr`` is parsed, but will generate an
2921 ignored attribute diagnostic when used, which may be useful when an attribute is
2925 semantic name of the attribute, the spellings the attribute supports, the
2926 arguments the attribute expects, and more. Most members of the ``Attr`` tablegen
2928 suffice. However, every attribute must specify at least a spelling list, a
2934 which the attribute can be spelled. For instance, a single semantic attribute
2950 ``CustomKeyword`` The attribute is spelled as a keyword, and requires
2952 ``RegularKeyword`` The attribute is spelled as a keyword. It can be
2955 exactly the same thing that a standard attribute
2969 ``Pragma`` The attribute is spelled as a ``#pragma``, and requires
2971 attribute is meant to be used by Clang, it should
2976 The C++ standard specifies that “any [non-standard attribute] that is not
2987 For example, the ``ArmStreaming`` function type attribute affects
2996 Attributes appertain to one or more subjects. If the attribute attempts to
2999 the attribute's ``SubjectList`` is defined, but the default behavior is to warn.
3014 called when determining whether an attribute appertains to the subject. For
3019 Diagnostic checking for attribute subject lists for declaration and statement
3026 process that runs daily. Generally, the documentation for an attribute is a
3029 that is named after the attribute being documented.
3031 If the attribute is not for public consumption, or is an implicitly-created
3032 attribute that has no visible spelling, the documentation list can specify the
3033 ``InternalOnly`` object. Otherwise, the attribute should have its documentation
3038 Additionally, it can specify a custom heading for the attribute, though a
3051 Documentation content (whether it is for an attribute or a category) is written
3054 After writing the documentation for the attribute, it should be locally tested
3056 Local testing requires a fresh build of clang-tblgen. To generate the attribute
3068 attribute. Attribute arguments specify both the parsed form and the semantic
3069 form of the attribute. For example, if ``Args`` is
3073 semantic attribute will require a string and integer argument.
3085 attribute. Many of them are special-purpose and beyond the scope of this
3088 If the parsed form of the attribute is more complex, or differs from the
3096 Note that setting this member to 1 will opt out of common attribute semantic
3097 handling, requiring extra implementation efforts to ensure the attribute
3100 If the attribute should not be propagated from a template declaration to an
3108 representation of the attribute.
3111 attribute. For instance, all of the CUDA-specific attributes specify ``[CUDA]``
3113 "attribute ignored" warning diagnostic is emitted. Since language options are
3117 Custom accessors can be generated for an attribute based on the spelling list
3118 for that attribute. For instance, if an attribute has two different spellings:
3121 These accessors will be generated on the semantic form of the attribute,
3128 without a semantic handler are not given a parsed attribute ``Kind`` enumerator.
3135 attribute spelled ``GNU<"interrupt">``, but with different parsing and semantic
3136 requirements. To support this feature, an attribute inheriting from
3139 corresponds to the parsed attribute's ``Kind`` enumerator. This allows
3140 attributes to share a parsed attribute kind, but have distinct semantic
3141 attribute classes. For instance, ``ParsedAttr`` is the shared
3142 parsed attribute kind, but ARMInterruptAttr and MSP430InterruptAttr are the
3145 By default, attribute arguments are parsed in an evaluated context. If the
3146 arguments for an attribute should be parsed in an unevaluated context (akin to
3150 If additional functionality is desired for the semantic form of the attribute,
3152 semantic attribute class object, with ``public`` access.
3156 generate diagnostic code. This will disallow the attribute combinations
3158 the same attribute list, different attribute list, and redeclarations, as
3166 attribute has the ``SimpleHandler`` field set to ``1`` then the function to
3167 process the attribute will be automatically generated, and nothing needs to be
3170 ``case`` for the attribute.
3172 Unless otherwise specified by the attribute definition, common semantic checking
3173 of the parsed attribute is handled automatically. This includes diagnosing
3177 If the attribute adds additional warnings, define a ``DiagGroup`` in
3180 named after the attribute's ``Spelling`` with "_"s replaced by "-"s. If there
3181 is only a single diagnostic, it is permissible to use ``InGroup<DiagGroup<"your-attribute">>``
3185 All semantic diagnostics generated for your attribute, including automatically-
3193 for an analysis pass, etc. Having added the attribute definition and conversion
3194 to the semantic representation for the attribute, what remains is to implement
3195 the custom logic requiring use of the attribute.
3198 attribute using ``hasAttr<T>()``. To obtain a pointer to the semantic
3199 representation of the attribute, ``getAttr<T>`` may be used.
3202 of an attribute by calling ``getAttrs()`` and looping over the list of