class AttributedType

Declaration

class AttributedType : public Type, public Node { /* full declaration omitted */ };

Description

An attributed type is a type to which a type attribute has been applied. The "modified type" is the fully-sugared type to which the attributed type was applied; generally it is not canonically equivalent to the attributed type. The "equivalent type" is the minimally-desugared type which the type is canonically equivalent to. For example, in the following attributed type: int32_t __attribute__((vector_size(16))) - the modified type is the TypedefType for int32_t - the equivalent type is VectorType(16, int32_t) - the canonical type is VectorType(16, int)

Declared at: clang/include/clang/AST/Type.h:4761

Inherits from: Type, FoldingSetBase::Node

Member Variables

private clang::QualType ModifiedType
private clang::QualType EquivalentType

Inherited from Type:

protected

Method Overview

Inherited from FoldingSetBase::Node:

Inherited from Type:

Inherited from ExtQualsTypeCommonBase:

    Methods

    AttributedType(clang::QualType canon,
                   attr::Kind attrKind,
                   clang::QualType modified,
                   clang::QualType equivalent)

    Declared at: clang/include/clang/AST/Type.h:4771

    Parameters

    clang::QualType canon
    attr::Kind attrKind
    clang::QualType modified
    clang::QualType equivalent

    void Profile(llvm::FoldingSetNodeID& ID)

    Declared at: clang/include/clang/AST/Type.h:4842

    Parameters

    llvm::FoldingSetNodeID& ID

    static void Profile(
        llvm::FoldingSetNodeID& ID,
        clang::AttributedType::Kind attrKind,
        clang::QualType modified,
        clang::QualType equivalent)

    Declared at: clang/include/clang/AST/Type.h:4846

    Parameters

    llvm::FoldingSetNodeID& ID
    clang::AttributedType::Kind attrKind
    clang::QualType modified
    clang::QualType equivalent

    static bool classof(const clang::Type* T)

    Declared at: clang/include/clang/AST/Type.h:4853

    Parameters

    const clang::Type* T

    clang::QualType desugar() const

    Declared at: clang/include/clang/AST/Type.h:4787

    clang::AttributedType::Kind getAttrKind() const

    Declared at: clang/include/clang/AST/Type.h:4779

    clang::QualType getEquivalentType() const

    Declared at: clang/include/clang/AST/Type.h:4784

    llvm::Optional<NullabilityKind>
    getImmediateNullability() const

    Declared at: clang/include/clang/AST/Type.h:4810

    clang::QualType getModifiedType() const

    Declared at: clang/include/clang/AST/Type.h:4783

    static clang::AttributedType::Kind
    getNullabilityAttrKind(
        clang::NullabilityKind kind)

    Description

    Retrieve the attribute kind corresponding to the given nullability kind.

    Declared at: clang/include/clang/AST/Type.h:4814

    Parameters

    clang::NullabilityKind kind

    bool isCallingConv() const

    Declared at: clang/include/clang/AST/Type.h:4808

    bool isMSTypeSpec() const

    Declared at: clang/include/clang/AST/Type.h:4806

    bool isQualifier() const

    Description

    Does this attribute behave like a type qualifier? A type qualifier adjusts a type to provide specialized rules for a specific object, like the standard const and volatile qualifiers. This includes attributes controlling things like nullability, address spaces, and ARC ownership. The value of the object is still largely described by the modified type. In contrast, many type attributes "rewrite" their modified type to produce a fundamentally different type, not necessarily related in any formalizable way to the original type. For example, calling convention and vector attributes are not simple type qualifiers. Type qualifiers are often, but not always, reflected in the canonical type.

    Declared at: clang/include/clang/AST/Type.h:4804

    bool isSugared() const

    Declared at: clang/include/clang/AST/Type.h:4786

    static Optional<clang::NullabilityKind>
    stripOuterNullability(clang::QualType& T)

    Description

    Strip off the top-level nullability annotation on the given type, if it's there.

    Declared at: clang/include/clang/AST/Type.h:4840

    Parameters

    clang::QualType& T
    The type to strip. If the type is exactly an AttributedType specifying nullability (without looking through type sugar), the nullability is returned and this type changed to the underlying modified type.

    Returns

    the top-level nullability, if present.