]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm-project/clang/include/clang/Basic/TypeNodes.td
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[FreeBSD/FreeBSD.git] / contrib / llvm-project / clang / include / clang / Basic / TypeNodes.td
1 include "clang/Basic/ASTNode.td"
2
3 class TypeNode<TypeNode base, bit abstract = 0> : ASTNode {
4         TypeNode Base = base;
5   bit Abstract = abstract;
6
7
8 /// A type node that is only used to represent dependent types in C++.  For
9 /// example, DependentTemplateSpecializationType is used to represent types
10 /// where the base template-id is dependent (such as `T::foo<U>`).  Code
11 /// that only works with non-dependent types can ignore these type nodes.
12 class AlwaysDependent {}
13
14 /// A type node that is never used to represent a canonical type, which is to
15 /// say that it always represents some sort of type "sugar" which can
16 /// (supposedly) be erased without affecting the formal behavior of the
17 /// language.  For example, in standard C/C++, typedefs do not introduce new
18 /// types and do not affect the semantics of the program.  Code that only
19 /// works with canonical types can ignore these type nodes.
20 ///
21 /// Note that this simple story about non-canonical types is not the whole
22 /// truth.  Languages and extensions often have formation rules which differ
23 /// based on how a type is spelled and which therefore are not consistent
24 /// with immediately stipping away type sugar.  More critically, attributes on
25 /// typedefs can have semantic impacts in ways that are only reflected in our
26 /// AST by preserving the typedef sugar; for example, we do not otherwise
27 /// represent the alignment attribute on typedefs, and so it is necessary to
28 /// preserve typedef structure into most parts of IR generation.
29 class NeverCanonical {}
30
31 /// A type node that only represents a canonical type in some dependent cases.
32 /// For example, `std::vector<int>` (a TemplateSpecializationType) is
33 /// considered to be a non-canonical representation for the RecordType
34 /// referencing the concrete ClassTemplateSpecializationDecl; but
35 /// `std::vector<T>` cannot be resolved to a concrete specialization
36 /// and so remains canonical.  Code which only works with non-dependent
37 /// canonical types can ignore these nodes.
38 class NeverCanonicalUnlessDependent {}
39
40 /// A type node which never has component type structure.  Some code may be
41 /// able to operate on leaf types faster than they can on non-leaf types.
42 ///
43 /// For example, the function type `void (int)` is not a leaf type because it
44 /// is structurally composed of component types (`void` and `int`).
45 ///
46 /// A struct type is a leaf type because its field types are not part of its
47 /// type-expression.
48 ///
49 /// Nodes like `TypedefType` which are syntactically leaves but can desugar
50 /// to types that may not be leaves should not declare this.
51 class LeafType {}
52
53 def Type : TypeNode<?, 1>;
54 def BuiltinType : TypeNode<Type>, LeafType;
55 def ComplexType : TypeNode<Type>;
56 def PointerType : TypeNode<Type>;
57 def BlockPointerType : TypeNode<Type>;
58 def ReferenceType : TypeNode<Type, 1>;
59 def LValueReferenceType : TypeNode<ReferenceType>;
60 def RValueReferenceType : TypeNode<ReferenceType>;
61 def MemberPointerType : TypeNode<Type>;
62 def ArrayType : TypeNode<Type, 1>;
63 def ConstantArrayType : TypeNode<ArrayType>;
64 def IncompleteArrayType : TypeNode<ArrayType>;
65 def VariableArrayType : TypeNode<ArrayType>;
66 def DependentSizedArrayType : TypeNode<ArrayType>, AlwaysDependent;
67 def DependentSizedExtVectorType : TypeNode<Type>, AlwaysDependent;
68 def DependentAddressSpaceType : TypeNode<Type>, AlwaysDependent;
69 def VectorType : TypeNode<Type>;
70 def DependentVectorType : TypeNode<Type>, AlwaysDependent;
71 def ExtVectorType : TypeNode<VectorType>;
72 def FunctionType : TypeNode<Type, 1>;
73 def FunctionProtoType : TypeNode<FunctionType>;
74 def FunctionNoProtoType : TypeNode<FunctionType>;
75 def UnresolvedUsingType : TypeNode<Type>, AlwaysDependent;
76 def ParenType : TypeNode<Type>, NeverCanonical;
77 def TypedefType : TypeNode<Type>, NeverCanonical;
78 def MacroQualifiedType : TypeNode<Type>, NeverCanonical;
79 def AdjustedType : TypeNode<Type>, NeverCanonical;
80 def DecayedType : TypeNode<AdjustedType>, NeverCanonical;
81 def TypeOfExprType : TypeNode<Type>, NeverCanonicalUnlessDependent;
82 def TypeOfType : TypeNode<Type>, NeverCanonicalUnlessDependent;
83 def DecltypeType : TypeNode<Type>, NeverCanonicalUnlessDependent;
84 def UnaryTransformType : TypeNode<Type>, NeverCanonicalUnlessDependent;
85 def TagType : TypeNode<Type, 1>;
86 def RecordType : TypeNode<TagType>, LeafType;
87 def EnumType : TypeNode<TagType>, LeafType;
88 def ElaboratedType : TypeNode<Type>, NeverCanonical;
89 def AttributedType : TypeNode<Type>, NeverCanonical;
90 def TemplateTypeParmType : TypeNode<Type>, AlwaysDependent, LeafType;
91 def SubstTemplateTypeParmType : TypeNode<Type>, NeverCanonical;
92 def SubstTemplateTypeParmPackType : TypeNode<Type>, AlwaysDependent;
93 def TemplateSpecializationType : TypeNode<Type>, NeverCanonicalUnlessDependent;
94 def DeducedType : TypeNode<Type, 1>;
95 def AutoType : TypeNode<DeducedType>;
96 def DeducedTemplateSpecializationType : TypeNode<DeducedType>;
97 def InjectedClassNameType : TypeNode<Type>, AlwaysDependent, LeafType;
98 def DependentNameType : TypeNode<Type>, AlwaysDependent;
99 def DependentTemplateSpecializationType : TypeNode<Type>, AlwaysDependent;
100 def PackExpansionType : TypeNode<Type>, NeverCanonicalUnlessDependent;
101 def ObjCTypeParamType : TypeNode<Type>, NeverCanonical;
102 def ObjCObjectType : TypeNode<Type>;
103 def ObjCInterfaceType : TypeNode<ObjCObjectType>, LeafType;
104 def ObjCObjectPointerType : TypeNode<Type>;
105 def PipeType : TypeNode<Type>;
106 def AtomicType : TypeNode<Type>;