Clang Project

clang_source_code/include/clang/AST/TypeNodes.def
1//===-- TypeNodes.def - Metadata about Type AST nodes -----------*- C++ -*-===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8//
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:
14//
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.
18//
19//    ABSTRACT_TYPE(Class, Base) - An abstract class that shows up in
20//    the type hierarchy but has no concrete instances.
21//
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.
27//
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.
32//
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.
36//
37//  There is a sixth macro, independent of the others.  Most clients
38//  will not need to use it.
39//
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.
42//
43//===----------------------------------------------------------------------===//
44
45#ifndef ABSTRACT_TYPE
46#  define ABSTRACT_TYPE(Class, Base) TYPE(Class, Base)
47#endif
48
49#ifndef NON_CANONICAL_TYPE
50#  define NON_CANONICAL_TYPE(Class, Base) TYPE(Class, Base)
51#endif
52
53#ifndef DEPENDENT_TYPE
54#  define DEPENDENT_TYPE(Class, Base) TYPE(Class, Base)
55#endif
56
57#ifndef NON_CANONICAL_UNLESS_DEPENDENT_TYPE
58#  define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) TYPE(Class, Base)
59#endif
60
61TYPE(Builtin, Type)
62TYPE(Complex, Type)
63TYPE(Pointer, Type)
64TYPE(BlockPointer, Type)
65ABSTRACT_TYPE(Reference, Type)
66TYPE(LValueReference, ReferenceType)
67TYPE(RValueReference, ReferenceType)
68TYPE(MemberPointer, Type)
69ABSTRACT_TYPE(Array, Type)
70TYPE(ConstantArray, ArrayType)
71TYPE(IncompleteArray, ArrayType)
72TYPE(VariableArray, ArrayType)
73DEPENDENT_TYPE(DependentSizedArray, ArrayType)
74DEPENDENT_TYPE(DependentSizedExtVector, Type)
75DEPENDENT_TYPE(DependentAddressSpace, Type)
76TYPE(Vector, Type)
77DEPENDENT_TYPE(DependentVector, Type)
78TYPE(ExtVector, VectorType)
79ABSTRACT_TYPE(Function, Type)
80TYPE(FunctionProto, FunctionType)
81TYPE(FunctionNoProto, FunctionType)
82DEPENDENT_TYPE(UnresolvedUsing, Type)
83NON_CANONICAL_TYPE(Paren, Type)
84NON_CANONICAL_TYPE(Typedef, Type)
85NON_CANONICAL_TYPE(Adjusted, Type)
86NON_CANONICAL_TYPE(Decayed, AdjustedType)
87NON_CANONICAL_UNLESS_DEPENDENT_TYPE(TypeOfExpr, Type)
88NON_CANONICAL_UNLESS_DEPENDENT_TYPE(TypeOf, Type)
89NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Decltype, Type)
90NON_CANONICAL_UNLESS_DEPENDENT_TYPE(UnaryTransform, Type)
91ABSTRACT_TYPE(Tag, Type)
92TYPE(Record, TagType)
93TYPE(Enum, TagType)
94NON_CANONICAL_TYPE(Elaborated, Type)
95NON_CANONICAL_TYPE(Attributed, Type)
96DEPENDENT_TYPE(TemplateTypeParm, Type)
97NON_CANONICAL_TYPE(SubstTemplateTypeParm, Type)
98DEPENDENT_TYPE(SubstTemplateTypeParmPack, Type)
99NON_CANONICAL_UNLESS_DEPENDENT_TYPE(TemplateSpecialization, Type)
100ABSTRACT_TYPE(Deduced, Type)
101TYPE(Auto, DeducedType)
102TYPE(DeducedTemplateSpecialization, DeducedType)
103DEPENDENT_TYPE(InjectedClassName, Type)
104DEPENDENT_TYPE(DependentName, Type)
105DEPENDENT_TYPE(DependentTemplateSpecialization, Type)
106NON_CANONICAL_UNLESS_DEPENDENT_TYPE(PackExpansion, Type)
107NON_CANONICAL_TYPE(ObjCTypeParam, Type)
108TYPE(ObjCObject, Type)
109TYPE(ObjCInterface, ObjCObjectType)
110TYPE(ObjCObjectPointer, Type)
111TYPE(Pipe, Type)
112TYPE(Atomic, Type)
113
114#ifdef LAST_TYPE
115LAST_TYPE(Atomic)
116#undef LAST_TYPE
117#endif
118
119// These types are always leaves in the type hierarchy.
120#ifdef LEAF_TYPE
121LEAF_TYPE(Enum)
122LEAF_TYPE(Builtin)
123LEAF_TYPE(Record)
124LEAF_TYPE(InjectedClassName)
125LEAF_TYPE(ObjCInterface)
126LEAF_TYPE(TemplateTypeParm)
127#undef LEAF_TYPE
128#endif
129
130#undef NON_CANONICAL_UNLESS_DEPENDENT_TYPE
131#undef DEPENDENT_TYPE
132#undef NON_CANONICAL_TYPE
133#undef ABSTRACT_TYPE
134#undef TYPE
135