3 class NamedType<string name> : Type {
7 class Field<string name, Type type> {
12 // Class to describe concrete structs specified by a standard.
13 class Struct<string name> : NamedType<name> {
17 class EnumNameValue<string name, string value = "__default_enum_value__"> {
22 class Enum<string name, list<EnumNameValue> enumerations> : NamedType<name> {
23 list<EnumNameValue> Enumerations = enumerations;
26 class PtrType<Type type> : Type {
27 Type PointeeType = type;
30 class ConstType<Type type> : Type {
31 Type UnqualifiedType = type;
34 class RestrictedPtrType<Type type> : Type {
35 Type PointeeType = type;
39 def VarArgType : NamedType<"...">;
40 def VoidType : NamedType<"void">;
41 def IntType : NamedType<"int">;
42 def LongType : NamedType<"long">;
43 def UnsignedLongType : NamedType<"unsigned long">;
44 def LongLongType : NamedType<"long long">;
45 def UnsignedLongLongType : NamedType<"unsigned long long">;
46 def FloatType : NamedType<"float">;
47 def DoubleType : NamedType<"double">;
48 def LongDoubleType : NamedType<"long double">;
49 def CharType : NamedType<"char">;
52 def VoidPtr : PtrType<VoidType>;
53 def VoidPtrPtr : PtrType<VoidPtr>;
54 def RestrictedVoidPtrPtr : RestrictedPtrType<VoidPtr>;
55 def ConstVoidPtr : ConstType<VoidPtr>;
57 def SizeTType : NamedType<"size_t">;
58 def SizeTPtr : PtrType<SizeTType>;
59 def RestrictedSizeTPtr : RestrictedPtrType<SizeTType>;
61 def LongDoublePtr : PtrType<LongDoubleType>;
63 def IntMaxTType : NamedType<"intmax_t">;
64 def UIntMaxTType : NamedType<"uintmax_t">;
66 // _Noreturn is really not a type, but it is convenient to treat it as a type.
67 def NoReturn : NamedType<"_Noreturn void">;
69 //types moved from stdc.td
70 def VoidRestrictedPtr : RestrictedPtrType<VoidType>;
71 def ConstVoidRestrictedPtr : ConstType<VoidRestrictedPtr>;
73 def CharPtr : PtrType<CharType>;
74 def ConstCharPtr : ConstType<CharPtr>;
75 def CharRestrictedPtr : RestrictedPtrType<CharType>;
76 def CharRestrictedPtrPtr : RestrictedPtrType<CharPtr>;
77 def ConstCharRestrictedPtr : ConstType<CharRestrictedPtr>;
79 def OnceFlagType : NamedType<"once_flag">;
80 def OnceFlagTypePtr : PtrType<OnceFlagType>;
81 // TODO(sivachandra): Remove this non-standard type when a formal
82 // way to describe callable types is available.
83 def CallOnceFuncType : NamedType<"__call_once_func_t">;
84 def MtxTType : NamedType<"mtx_t">;
85 def MtxTTypePtr : PtrType<MtxTType>;
86 def CndTType : NamedType<"cnd_t">;
87 def CndTTypePtr : PtrType<CndTType>;
88 def ThrdStartTType : NamedType<"thrd_start_t">;
89 def ThrdTType : NamedType<"thrd_t">;
90 def ThrdTTypePtr : PtrType<ThrdTType>;
92 def IntPtr : PtrType<IntType>;
93 def RestrictedIntPtr : RestrictedPtrType<IntType>;
94 def FloatPtr : PtrType<FloatType>;
95 def DoublePtr : PtrType<DoubleType>;
97 def SigHandlerT : NamedType<"__sighandler_t">;
99 def TimeTType : NamedType<"time_t">;
101 def BSearchCompareT : NamedType<"__bsearchcompare_t">;
102 def QSortCompareT : NamedType<"__qsortcompare_t">;
104 def AtexitHandlerT : NamedType<"__atexithandler_t">;
106 def FILE : NamedType<"FILE">;
107 def FILEPtr : PtrType<FILE>;
108 def FILERestrictedPtr : RestrictedPtrType<FILE>;
110 //added because __assert_fail needs it.
111 def UnsignedType : NamedType<"unsigned">;
113 class Macro<string name> {
117 class EnumeratedNameValue<string name, string value = "__default__"> {
119 string Value = value;
124 class RetValSpec<Type type, list<Annotation> annotations = []> {
125 Type ReturnType = type;
126 list<Annotation> Annotations = annotations;
129 class ArgSpec<Type type, list<Annotation> annotations = [], string name = ""> {
131 list<Annotation> Annotations = annotations;
135 class FunctionSpec<string name, RetValSpec return, list<ArgSpec> args> {
137 RetValSpec Return = return;
138 list<ArgSpec> Args = args;
141 class ObjectSpec<string name, string type> {
146 class HeaderSpec<string name,
147 list<Macro> macros = [],
148 list<Type> types = [],
149 list<EnumeratedNameValue> enumerations = [],
150 list<FunctionSpec> functions = [],
151 list<ObjectSpec> objects = []> {
153 list<FunctionSpec> Functions = functions;
154 list<Type> Types = types;
155 list<Macro> Macros = macros;
156 list<EnumeratedNameValue> Enumerations = enumerations;
157 list<ObjectSpec> Objects = objects;
160 class StandardSpec<string name> {
162 list<HeaderSpec> Headers;