include "clang/Basic/ASTNode.td" class TypeNode : ASTNode { TypeNode Base = base; bit Abstract = abstract; } /// A type node that is only used to represent dependent types in C++. For /// example, DependentTemplateSpecializationType is used to represent types /// where the base template-id is dependent (such as `T::foo`). Code /// that only works with non-dependent types can ignore these type nodes. class AlwaysDependent {} /// A type node that is never used to represent a canonical type, which is to /// say that it always represents some sort of type "sugar" which can /// (supposedly) be erased without affecting the formal behavior of the /// language. For example, in standard C/C++, typedefs do not introduce new /// types and do not affect the semantics of the program. Code that only /// works with canonical types can ignore these type nodes. /// /// Note that this simple story about non-canonical types is not the whole /// truth. Languages and extensions often have formation rules which differ /// based on how a type is spelled and which therefore are not consistent /// with immediately stipping away type sugar. More critically, attributes on /// typedefs can have semantic impacts in ways that are only reflected in our /// AST by preserving the typedef sugar; for example, we do not otherwise /// represent the alignment attribute on typedefs, and so it is necessary to /// preserve typedef structure into most parts of IR generation. class NeverCanonical {} /// A type node that only represents a canonical type in some dependent cases. /// For example, `std::vector` (a TemplateSpecializationType) is /// considered to be a non-canonical representation for the RecordType /// referencing the concrete ClassTemplateSpecializationDecl; but /// `std::vector` cannot be resolved to a concrete specialization /// and so remains canonical. Code which only works with non-dependent /// canonical types can ignore these nodes. class NeverCanonicalUnlessDependent {} /// A type node which never has component type structure. Some code may be /// able to operate on leaf types faster than they can on non-leaf types. /// /// For example, the function type `void (int)` is not a leaf type because it /// is structurally composed of component types (`void` and `int`). /// /// A struct type is a leaf type because its field types are not part of its /// type-expression. /// /// Nodes like `TypedefType` which are syntactically leaves but can desugar /// to types that may not be leaves should not declare this. class LeafType {} def Type : TypeNode; def BuiltinType : TypeNode, LeafType; def ComplexType : TypeNode; def PointerType : TypeNode; def BlockPointerType : TypeNode; def ReferenceType : TypeNode; def LValueReferenceType : TypeNode; def RValueReferenceType : TypeNode; def MemberPointerType : TypeNode; def ArrayType : TypeNode; def ConstantArrayType : TypeNode; def IncompleteArrayType : TypeNode; def VariableArrayType : TypeNode; def DependentSizedArrayType : TypeNode, AlwaysDependent; def DependentSizedExtVectorType : TypeNode, AlwaysDependent; def DependentAddressSpaceType : TypeNode, AlwaysDependent; def VectorType : TypeNode; def DependentVectorType : TypeNode, AlwaysDependent; def ExtVectorType : TypeNode; def MatrixType : TypeNode; def ConstantMatrixType : TypeNode; def DependentSizedMatrixType : TypeNode, AlwaysDependent; def FunctionType : TypeNode; def FunctionProtoType : TypeNode; def FunctionNoProtoType : TypeNode; def UnresolvedUsingType : TypeNode, AlwaysDependent; def ParenType : TypeNode, NeverCanonical; def TypedefType : TypeNode, NeverCanonical; def MacroQualifiedType : TypeNode, NeverCanonical; def AdjustedType : TypeNode, NeverCanonical; def DecayedType : TypeNode, NeverCanonical; def TypeOfExprType : TypeNode, NeverCanonicalUnlessDependent; def TypeOfType : TypeNode, NeverCanonicalUnlessDependent; def DecltypeType : TypeNode, NeverCanonicalUnlessDependent; def UnaryTransformType : TypeNode, NeverCanonicalUnlessDependent; def TagType : TypeNode; def RecordType : TypeNode, LeafType; def EnumType : TypeNode, LeafType; def ElaboratedType : TypeNode, NeverCanonical; def AttributedType : TypeNode, NeverCanonical; def TemplateTypeParmType : TypeNode, AlwaysDependent, LeafType; def SubstTemplateTypeParmType : TypeNode, NeverCanonical; def SubstTemplateTypeParmPackType : TypeNode, AlwaysDependent; def TemplateSpecializationType : TypeNode, NeverCanonicalUnlessDependent; def DeducedType : TypeNode; def AutoType : TypeNode; def DeducedTemplateSpecializationType : TypeNode; def InjectedClassNameType : TypeNode, AlwaysDependent, LeafType; def DependentNameType : TypeNode, AlwaysDependent; def DependentTemplateSpecializationType : TypeNode, AlwaysDependent; def PackExpansionType : TypeNode, NeverCanonicalUnlessDependent; def ObjCTypeParamType : TypeNode, NeverCanonical; def ObjCObjectType : TypeNode; def ObjCInterfaceType : TypeNode, LeafType; def ObjCObjectPointerType : TypeNode; def PipeType : TypeNode; def AtomicType : TypeNode; def ExtIntType : TypeNode; def DependentExtIntType : TypeNode, AlwaysDependent;