LLVMType.st
changeset 50 dbda820d4d24
parent 49 aa3ce5de5ee8
child 53 bbf3a88e2358
--- a/LLVMType.st	Wed Oct 07 06:10:55 2015 +0100
+++ b/LLVMType.st	Mon Oct 12 20:52:13 2015 +0100
@@ -229,6 +229,27 @@
 
 !LLVMType class methodsFor:'types - structures'!
 
+named: aString
+    "Create an (opaque) named structure with no members (elements).
+     Use LLVMStructType>>elementTypes: to set members.
+
+     This method comes handy when one needs to create
+     a recursive type, such as an element of linked list:
+
+     | listElemTy |
+
+     listElemTy := LLVMType named: 'listElemTy'.
+     listElemTy elementTypes: { LLVMType int32 . listElemTy pointer }.
+     listElemTy
+
+    "
+
+    self assertIsString: aString.  
+    ^ LLVM StructCreateNamed: LLVM GetGlobalContext _: aString.
+
+    "Created: / 12-10-2015 / 14:55:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 struct: memberTypes 
     ^ self struct: memberTypes packed: false