1 //===-- TypeNodes.def - Metadata about Type AST nodes -----------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This file defines the AST type info database. Each type node is
10 // enumerated by providing its name (e.g., "Builtin" or "Enum") and
11 // base class (e.g., "Type" or "TagType"). Depending on where in the
12 // abstract syntax tree the type will show up, the enumeration uses
13 // one of five different macros:
15 // TYPE(Class, Base) - A type that can show up anywhere in the AST,
16 // and might be dependent, canonical, or non-canonical. All clients
17 // will need to understand these types.
19 // ABSTRACT_TYPE(Class, Base) - An abstract class that shows up in
20 // the type hierarchy but has no concrete instances.
22 // NON_CANONICAL_TYPE(Class, Base) - A type that can show up
23 // anywhere in the AST but will never be a part of a canonical
24 // type. Clients that only need to deal with canonical types
25 // (ignoring, e.g., typedefs and other type aliases used for
26 // pretty-printing) can ignore these types.
28 // DEPENDENT_TYPE(Class, Base) - A type that will only show up
29 // within a C++ template that has not been instantiated, e.g., a
30 // type that is always dependent. Clients that do not need to deal
31 // with uninstantiated C++ templates can ignore these types.
33 // NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) - A type that
34 // is non-canonical unless it is dependent. Defaults to TYPE because
35 // it is neither reliably dependent nor reliably non-canonical.
37 // There is a sixth macro, independent of the others. Most clients
38 // will not need to use it.
40 // LEAF_TYPE(Class) - A type that never has inner types. Clients
41 // which can operate on such types more efficiently may wish to do so.
43 //===----------------------------------------------------------------------===//
46 # define ABSTRACT_TYPE(Class, Base) TYPE(Class, Base)
49 #ifndef NON_CANONICAL_TYPE
50 # define NON_CANONICAL_TYPE(Class, Base) TYPE(Class, Base)
53 #ifndef DEPENDENT_TYPE
54 # define DEPENDENT_TYPE(Class, Base) TYPE(Class, Base)
57 #ifndef NON_CANONICAL_UNLESS_DEPENDENT_TYPE
58 # define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) TYPE(Class, Base)
64 TYPE(BlockPointer, Type)
65 ABSTRACT_TYPE(Reference, Type)
66 TYPE(LValueReference, ReferenceType)
67 TYPE(RValueReference, ReferenceType)
68 TYPE(MemberPointer, Type)
69 ABSTRACT_TYPE(Array, Type)
70 TYPE(ConstantArray, ArrayType)
71 TYPE(IncompleteArray, ArrayType)
72 TYPE(VariableArray, ArrayType)
73 DEPENDENT_TYPE(DependentSizedArray, ArrayType)
74 DEPENDENT_TYPE(DependentSizedExtVector, Type)
75 DEPENDENT_TYPE(DependentAddressSpace, Type)
77 DEPENDENT_TYPE(DependentVector, Type)
78 TYPE(ExtVector, VectorType)
79 ABSTRACT_TYPE(Function, Type)
80 TYPE(FunctionProto, FunctionType)
81 TYPE(FunctionNoProto, FunctionType)
82 DEPENDENT_TYPE(UnresolvedUsing, Type)
83 NON_CANONICAL_TYPE(Paren, Type)
84 NON_CANONICAL_TYPE(Typedef, Type)
85 NON_CANONICAL_TYPE(MacroQualified, Type)
86 NON_CANONICAL_TYPE(Adjusted, Type)
87 NON_CANONICAL_TYPE(Decayed, AdjustedType)
88 NON_CANONICAL_UNLESS_DEPENDENT_TYPE(TypeOfExpr, Type)
89 NON_CANONICAL_UNLESS_DEPENDENT_TYPE(TypeOf, Type)
90 NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Decltype, Type)
91 NON_CANONICAL_UNLESS_DEPENDENT_TYPE(UnaryTransform, Type)
92 ABSTRACT_TYPE(Tag, Type)
95 NON_CANONICAL_TYPE(Elaborated, Type)
96 NON_CANONICAL_TYPE(Attributed, Type)
97 DEPENDENT_TYPE(TemplateTypeParm, Type)
98 NON_CANONICAL_TYPE(SubstTemplateTypeParm, Type)
99 DEPENDENT_TYPE(SubstTemplateTypeParmPack, Type)
100 NON_CANONICAL_UNLESS_DEPENDENT_TYPE(TemplateSpecialization, Type)
101 ABSTRACT_TYPE(Deduced, Type)
102 TYPE(Auto, DeducedType)
103 TYPE(DeducedTemplateSpecialization, DeducedType)
104 DEPENDENT_TYPE(InjectedClassName, Type)
105 DEPENDENT_TYPE(DependentName, Type)
106 DEPENDENT_TYPE(DependentTemplateSpecialization, Type)
107 NON_CANONICAL_UNLESS_DEPENDENT_TYPE(PackExpansion, Type)
108 NON_CANONICAL_TYPE(ObjCTypeParam, Type)
109 TYPE(ObjCObject, Type)
110 TYPE(ObjCInterface, ObjCObjectType)
111 TYPE(ObjCObjectPointer, Type)
120 // These types are always leaves in the type hierarchy.
125 LEAF_TYPE(InjectedClassName)
126 LEAF_TYPE(ObjCInterface)
127 LEAF_TYPE(TemplateTypeParm)
131 #undef NON_CANONICAL_UNLESS_DEPENDENT_TYPE
132 #undef DEPENDENT_TYPE
133 #undef NON_CANONICAL_TYPE