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 UnsignedIntType : NamedType<"unsigned int">;
43 def LongType : NamedType<"long">;
44 def UnsignedLongType : NamedType<"unsigned long">;
45 def LongLongType : NamedType<"long long">;
46 def UnsignedLongLongType : NamedType<"unsigned long long">;
47 def FloatType : NamedType<"float">;
48 def DoubleType : NamedType<"double">;
49 def LongDoubleType : NamedType<"long double">;
50 def CharType : NamedType<"char">;
53 def VoidPtr : PtrType<VoidType>;
54 def VoidPtrPtr : PtrType<VoidPtr>;
55 def RestrictedVoidPtrPtr : RestrictedPtrType<VoidPtr>;
56 def ConstVoidPtr : ConstType<VoidPtr>;
58 def SizeTType : NamedType<"size_t">;
59 def SizeTPtr : PtrType<SizeTType>;
60 def RestrictedSizeTPtr : RestrictedPtrType<SizeTType>;
62 def WCharType : NamedType<"wchar_t">;
63 def WIntType : NamedType<"wint_t">;
65 def LongDoublePtr : PtrType<LongDoubleType>;
67 def IntMaxTType : NamedType<"intmax_t">;
68 def UIntMaxTType : NamedType<"uintmax_t">;
70 def UInt16Type : NamedType<"uint16_t">;
71 def UInt32Type : NamedType<"uint32_t">;
73 def OffTType : NamedType<"off_t">;
74 def OffTPtr : PtrType<OffTType>;
75 def SSizeTType : NamedType<"ssize_t">;
77 // _Noreturn is really not a type, but it is convenient to treat it as a type.
78 def NoReturn : NamedType<"_Noreturn void">;
80 //types moved from stdc.td
81 def VoidRestrictedPtr : RestrictedPtrType<VoidType>;
82 def ConstVoidRestrictedPtr : ConstType<VoidRestrictedPtr>;
84 def CharPtr : PtrType<CharType>;
85 def ConstCharPtr : ConstType<CharPtr>;
86 def CharRestrictedPtr : RestrictedPtrType<CharType>;
87 def CharRestrictedPtrPtr : RestrictedPtrType<CharPtr>;
88 def ConstCharRestrictedPtr : ConstType<CharRestrictedPtr>;
89 def ConstCharRestrictedPtrPtr : PtrType<ConstCharRestrictedPtr>;
91 def OnceFlagType : NamedType<"once_flag">;
92 def OnceFlagTypePtr : PtrType<OnceFlagType>;
93 // TODO(sivachandra): Remove this non-standard type when a formal
94 // way to describe callable types is available.
95 def CallOnceFuncType : NamedType<"__call_once_func_t">;
96 def MtxTType : NamedType<"mtx_t">;
97 def MtxTTypePtr : PtrType<MtxTType>;
98 def CndTType : NamedType<"cnd_t">;
99 def CndTTypePtr : PtrType<CndTType>;
100 def ThrdStartTType : NamedType<"thrd_start_t">;
101 def ThrdTType : NamedType<"thrd_t">;
102 def ThrdTTypePtr : PtrType<ThrdTType>;
104 def IntPtr : PtrType<IntType>;
105 def RestrictedIntPtr : RestrictedPtrType<IntType>;
106 def FloatPtr : PtrType<FloatType>;
107 def DoublePtr : PtrType<DoubleType>;
109 def SigHandlerT : NamedType<"__sighandler_t">;
111 def TimeTType : NamedType<"time_t">;
113 def BSearchCompareT : NamedType<"__bsearchcompare_t">;
114 def QSortCompareT : NamedType<"__qsortcompare_t">;
116 def AtexitHandlerT : NamedType<"__atexithandler_t">;
118 def FILE : NamedType<"FILE">;
119 def FILEPtr : PtrType<FILE>;
120 def FILERestrictedPtr : RestrictedPtrType<FILE>;
122 def PThreadTType : NamedType<"pthread_t">;
124 def PidT : NamedType<"pid_t">;
125 def RestrictedPidTPtr : RestrictedPtrType<PidT>;
127 def StructRUsage : NamedType<"struct rusage">;
128 def StructRUsagePtr : PtrType<StructRUsage>;
130 def StructTimevalType : NamedType<"struct timeval">;
131 def StructTimevalPtr : PtrType<StructTimevalType>;
132 def RestrictedStructTimevalPtr : RestrictedPtrType<StructTimevalType>;
134 def SuSecondsT : NamedType<"suseconds_t">;
136 //added because __assert_fail needs it.
137 def UnsignedType : NamedType<"unsigned">;
139 class Macro<string name> {
143 class EnumeratedNameValue<string name, string value = "__default__"> {
145 string Value = value;
150 class RetValSpec<Type type, list<Annotation> annotations = []> {
151 Type ReturnType = type;
152 list<Annotation> Annotations = annotations;
155 class ArgSpec<Type type, list<Annotation> annotations = [], string name = ""> {
157 list<Annotation> Annotations = annotations;
161 class FunctionSpec<string name, RetValSpec return, list<ArgSpec> args> {
163 RetValSpec Return = return;
164 list<ArgSpec> Args = args;
167 class ObjectSpec<string name, string type> {
172 class HeaderSpec<string name,
173 list<Macro> macros = [],
174 list<Type> types = [],
175 list<EnumeratedNameValue> enumerations = [],
176 list<FunctionSpec> functions = [],
177 list<ObjectSpec> objects = []> {
179 list<FunctionSpec> Functions = functions;
180 list<Type> Types = types;
181 list<Macro> Macros = macros;
182 list<EnumeratedNameValue> Enumerations = enumerations;
183 list<ObjectSpec> Objects = objects;
186 class StandardSpec<string name> {
188 list<HeaderSpec> Headers;