summaryrefslogtreecommitdiffstats
path: root/libc/spec/spec.td
diff options
context:
space:
mode:
Diffstat (limited to 'libc/spec/spec.td')
-rw-r--r--libc/spec/spec.td74
1 files changed, 74 insertions, 0 deletions
diff --git a/libc/spec/spec.td b/libc/spec/spec.td
new file mode 100644
index 00000000000..855dd6aaa77
--- /dev/null
+++ b/libc/spec/spec.td
@@ -0,0 +1,74 @@
+class Type {}
+
+class NamedType<string name> : Type {
+ string Name = name;
+}
+
+class Field<string name, Type type> {
+ string Name = name;
+ Type FieldType = type;
+}
+
+// Class to describe concrete structs specified by a standard.
+class Struct<string name> : NamedType<name> {
+ list<Field> Fields;
+}
+
+class PtrType<Type type> : Type {
+ Type PointeeType = type;
+}
+
+class ConstType<Type type> : Type {
+ Type UnqualifiedType = type;
+}
+
+class RestrictedPtrType<Type type> : Type {
+ Type PointeeType = type;
+}
+
+// Builtin types.
+def VarArgType : Type {}
+def VoidType : NamedType<"void">;
+def IntType : NamedType<"int">;
+def FloatType : NamedType<"float">;
+def DoubleType : NamedType<"double">;
+def LongDoubleType : NamedType<"long double">;
+def CharType : NamedType<"char">;
+
+class Macro<string name> {
+ string Name = name;
+}
+
+class Annotation {}
+
+class RetValSpec<Type type, list<Annotation> annotations = []> {
+ Type ReturnType = type;
+ list<Annotation> Annotations = annotations;
+}
+
+class ArgSpec<Type type, list<Annotation> annotations = [], string name = ""> {
+ Type ArgType = type;
+ list<Annotation> Annotations = annotations;
+ string Name = name;
+}
+
+class FunctionSpec<string name, RetValSpec return, list<ArgSpec> args> {
+ string Name = name;
+ RetValSpec Return = return;
+ list<ArgSpec> Args = args;
+}
+
+class HeaderSpec<string name,
+ list<Macro> macros,
+ list<Type> types,
+ list<FunctionSpec> functions> {
+ string Name = name;
+ list<FunctionSpec> Functions = functions;
+ list<Type> Types = types;
+ list<Macro> Macros = macros;
+}
+
+class StandardSpec<string name> {
+ string Name = name;
+ list<HeaderSpec> Headers;
+}
OpenPOWER on IntegriCloud