4747// / programs and it cannot be the type of an expression.
4848// / The default behavior is TYPE(id, parent).
4949
50+ // / SINGLETON_TYPE(SHORT_ID, id)
51+ // / This type is a singleton, i.e. there is exactly one instance of
52+ // / it, which can be found as ASTContext.The#SHORT_ID#Type.
53+ // / This is only expanded if SINGLETON_TYPE is defined, and in this
54+ // / case no other macros are expanded.
55+
5056#ifndef ALWAYS_CANONICAL_TYPE
5157#define ALWAYS_CANONICAL_TYPE (id, parent ) TYPE(id, parent)
5258#endif
8793#define LAST_TYPE (Id )
8894#endif
8995
96+ #if !defined(SINGLETON_TYPE)
97+
9098TYPE (Error, Type)
9199UNCHECKED_TYPE(Unresolved, Type)
92100UNCHECKED_TYPE(Hole, Type)
@@ -96,6 +104,7 @@ ABSTRACT_TYPE(Builtin, Type)
96104 BUILTIN_TYPE(BuiltinIntegerLiteral, AnyBuiltinIntegerType)
97105 TYPE_RANGE(AnyBuiltinInteger, BuiltinInteger, BuiltinIntegerLiteral)
98106 BUILTIN_TYPE(BuiltinFloat, BuiltinType)
107+ BUILTIN_TYPE(BuiltinJob, BuiltinType)
99108 BUILTIN_TYPE(BuiltinRawPointer, BuiltinType)
100109 BUILTIN_TYPE(BuiltinRawUnsafeContinuation, BuiltinType)
101110 BUILTIN_TYPE(BuiltinNativeObject, BuiltinType)
@@ -166,6 +175,20 @@ ABSTRACT_SUGARED_TYPE(Sugar, Type)
166175 TYPE_RANGE(Sugar, Paren, Dictionary)
167176LAST_TYPE(Dictionary) // Sugared types are last to make isa<SugarType>() fast.
168177
178+ #endif
179+
180+ #ifdef SINGLETON_TYPE
181+ SINGLETON_TYPE (IntegerLiteral, BuiltinIntegerLiteral)
182+ SINGLETON_TYPE(Job, BuiltinJob)
183+ SINGLETON_TYPE(RawPointer, BuiltinRawPointer)
184+ SINGLETON_TYPE(RawUnsafeContinuation, BuiltinRawUnsafeContinuation)
185+ SINGLETON_TYPE(NativeObject, BuiltinNativeObject)
186+ SINGLETON_TYPE(BridgeObject, BuiltinBridgeObject)
187+ SINGLETON_TYPE(UnsafeValueBuffer, BuiltinUnsafeValueBuffer)
188+ SINGLETON_TYPE(SILToken, SILToken)
189+ #undef SINGLETON_TYPE
190+ #endif
191+
169192#undef TYPE_RANGE
170193#undef ABSTRACT_SUGARED_TYPE
171194#undef ABSTRACT_TYPE
0 commit comments