MCPcopy Create free account
hub / github.com/WasmEdge/WasmEdge / print_alias

Function print_alias

utils/wasi-cpp-header/src/cpp_header.rs:104–133  ·  view source on GitHub ↗
(ret: &mut String, name: &Id, dest: &TypeRef)

Source from the content-addressed store, hash-verified

102}
103
104fn print_alias(ret: &mut String, name: &Id, dest: &TypeRef) {
105 match &**dest.type_() {
106 Type::List(_) => {
107 // Don't emit arrays as top-level types; instead we special-case
108 // them in places like parameter lists so that we can pass them
109 // as pointer and length pairs.
110 }
111 _ => {
112 ret.push_str(&format!(
113 "using __wasi_{}_t = {};\n",
114 ident_name(name),
115 typeref_name(dest)
116 ));
117 ret.push_str("\n");
118
119 ret.push_str(&format!(
120 "static_assert(sizeof(__wasi_{}_t) == {}, \"witx calculated size\");\n",
121 ident_name(name),
122 dest.mem_size_align().size
123 ));
124 ret.push_str(&format!(
125 "static_assert(alignof(__wasi_{}_t) == {}, \"witx calculated align\");\n",
126 ident_name(name),
127 dest.mem_size_align().align
128 ));
129
130 ret.push_str("\n");
131 }
132 }
133}
134
135fn print_enum(ret: &mut String, name: &Id, v: &Variant) {
136 ret.push_str(&format!(

Callers 1

print_datatypeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected