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 VaListType : NamedType<"va_list">;
41 def VoidType : NamedType<"void">;
42 def IntType : NamedType<"int">;
43 def UnsignedIntType : NamedType<"unsigned int">;
44 def LongType : NamedType<"long">;
45 def UnsignedLongType : NamedType<"unsigned long">;
46 def LongLongType : NamedType<"long long">;
47 def UnsignedLongLongType : NamedType<"unsigned long long">;
48 def FloatType : NamedType<"float">;
49 def DoubleType : NamedType<"double">;
50 def LongDoubleType : NamedType<"long double">;
51 def CharType : NamedType<"char">;
54 def VoidPtr : PtrType<VoidType>;
55 def VoidPtrPtr : PtrType<VoidPtr>;
56 def RestrictedVoidPtrPtr : RestrictedPtrType<VoidPtr>;
57 def ConstVoidPtr : ConstType<VoidPtr>;
59 def SizeTType : NamedType<"size_t">;
60 def SizeTPtr : PtrType<SizeTType>;
61 def RestrictedSizeTPtr : RestrictedPtrType<SizeTType>;
63 def WCharType : NamedType<"wchar_t">;
64 def WIntType : NamedType<"wint_t">;
66 def LongDoublePtr : PtrType<LongDoubleType>;
68 def IntMaxTType : NamedType<"intmax_t">;
69 def UIntMaxTType : NamedType<"uintmax_t">;
71 def UInt16Type : NamedType<"uint16_t">;
72 def UInt32Type : NamedType<"uint32_t">;
74 def OffTType : NamedType<"off_t">;
75 def OffTPtr : PtrType<OffTType>;
76 def SSizeTType : NamedType<"ssize_t">;
78 // _Noreturn is really not a type, but it is convenient to treat it as a type.
79 def NoReturn : NamedType<"_Noreturn void">;
81 //types moved from stdc.td
82 def VoidRestrictedPtr : RestrictedPtrType<VoidType>;
83 def ConstVoidRestrictedPtr : ConstType<VoidRestrictedPtr>;
85 def CharPtr : PtrType<CharType>;
86 def ConstCharPtr : ConstType<CharPtr>;
87 def CharRestrictedPtr : RestrictedPtrType<CharType>;
88 def CharRestrictedPtrPtr : RestrictedPtrType<CharPtr>;
89 def ConstCharRestrictedPtr : ConstType<CharRestrictedPtr>;
90 def ConstCharRestrictedPtrPtr : PtrType<ConstCharRestrictedPtr>;
92 def OnceFlagType : NamedType<"once_flag">;
93 def OnceFlagTypePtr : PtrType<OnceFlagType>;
94 // TODO(sivachandra): Remove this non-standard type when a formal
95 // way to describe callable types is available.
96 def CallOnceFuncType : NamedType<"__call_once_func_t">;
97 def MtxTType : NamedType<"mtx_t">;
98 def MtxTTypePtr : PtrType<MtxTType>;
99 def CndTType : NamedType<"cnd_t">;
100 def CndTTypePtr : PtrType<CndTType>;
101 def ThrdStartTType : NamedType<"thrd_start_t">;
102 def ThrdTType : NamedType<"thrd_t">;
103 def ThrdTTypePtr : PtrType<ThrdTType>;
105 def IntPtr : PtrType<IntType>;
106 def RestrictedIntPtr : RestrictedPtrType<IntType>;
107 def FloatPtr : PtrType<FloatType>;
108 def DoublePtr : PtrType<DoubleType>;
110 def SigHandlerT : NamedType<"__sighandler_t">;
112 def TimeTType : NamedType<"time_t">;
114 def BSearchCompareT : NamedType<"__bsearchcompare_t">;
115 def QSortCompareT : NamedType<"__qsortcompare_t">;
117 def AtexitHandlerT : NamedType<"__atexithandler_t">;
119 def FILE : NamedType<"FILE">;
120 def FILEPtr : PtrType<FILE>;
121 def FILERestrictedPtr : RestrictedPtrType<FILE>;
123 def PThreadTType : NamedType<"pthread_t">;
125 def PidT : NamedType<"pid_t">;
126 def RestrictedPidTPtr : RestrictedPtrType<PidT>;
128 def StructRUsage : NamedType<"struct rusage">;
129 def StructRUsagePtr : PtrType<StructRUsage>;
131 def StructTimevalType : NamedType<"struct timeval">;
132 def StructTimevalPtr : PtrType<StructTimevalType>;
133 def RestrictedStructTimevalPtr : RestrictedPtrType<StructTimevalType>;
135 def SuSecondsT : NamedType<"suseconds_t">;
137 //added because __assert_fail needs it.
138 def UnsignedType : NamedType<"unsigned">;
140 class Macro<string name> {
144 class EnumeratedNameValue<string name, string value = "__default__"> {
146 string Value = value;
151 class RetValSpec<Type type, list<Annotation> annotations = []> {
152 Type ReturnType = type;
153 list<Annotation> Annotations = annotations;
156 class ArgSpec<Type type, list<Annotation> annotations = [], string name = ""> {
158 list<Annotation> Annotations = annotations;
162 class FunctionSpec<string name, RetValSpec return, list<ArgSpec> args> {
164 RetValSpec Return = return;
165 list<ArgSpec> Args = args;
168 class ObjectSpec<string name, string type> {
173 class HeaderSpec<string name,
174 list<Macro> macros = [],
175 list<Type> types = [],
176 list<EnumeratedNameValue> enumerations = [],
177 list<FunctionSpec> functions = [],
178 list<ObjectSpec> objects = []> {
180 list<FunctionSpec> Functions = functions;
181 list<Type> Types = types;
182 list<Macro> Macros = macros;
183 list<EnumeratedNameValue> Enumerations = enumerations;
184 list<ObjectSpec> Objects = objects;
187 class StandardSpec<string name> {
189 list<HeaderSpec> Headers;