aboutsummaryrefslogtreecommitdiff
path: root/src/comp/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/comp/lib')
-rw-r--r--src/comp/lib/llvm.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/comp/lib/llvm.rs b/src/comp/lib/llvm.rs
index 0db40e89..15fc68e4 100644
--- a/src/comp/lib/llvm.rs
+++ b/src/comp/lib/llvm.rs
@@ -1106,6 +1106,19 @@ obj builder(BuilderRef B) {
}
}
+/* Memory-managed object interface to type handles. */
+
+obj type_handle_dtor(TypeHandleRef TH) {
+ drop { llvm.LLVMDisposeTypeHandle(TH); }
+}
+
+type type_handle = rec(TypeHandleRef llth, type_handle_dtor dtor);
+
+fn mk_type_handle() -> type_handle {
+ auto th = llvm.LLVMCreateTypeHandle(llvm.LLVMOpaqueType());
+ ret rec(llth=th, dtor=type_handle_dtor(th));
+}
+
fn type_to_str(TypeRef ty) -> str {
let int kind = llvm.LLVMGetTypeKind(ty);