# HG changeset patch # User Jan Vrany # Date 1442381143 -3600 # Node ID a5c898296427a4298f4f74ae2761985bc30f6285 # Parent 35c51ba4e4a762880d2e6c05eeba87e19965c976 LLVM bindings: Updated LLVM_C mappings for LLVMIsAXXX() and LLVMPrintXXXToString() functions Make LLVMIsAXXX() functions to return bool instead of LLVMValueRef(). Make LLVMPrintXXXToString() functions to return generic pointer instead of char* diff -r 35c51ba4e4a7 -r a5c898296427 Cface__LLVM_C.st --- a/Cface__LLVM_C.st Mon Aug 17 10:04:39 2015 +0100 +++ b/Cface__LLVM_C.st Wed Sep 16 06:25:43 2015 +0100 @@ -51,17 +51,36 @@ definitions:definitionFile super definitions:definitionFile. - "/ A hack to map LLVMBool to #bool FFIT type - + "/ A hack to map LLVMBool to #bool FFI type definitionFile definitions do:[:each | (each isKindOf: CTypedefNode) ifTrue:[ each cName = 'LLVMBool' ifTrue:[ each type: CBoolNode new ]. ] - ] + ]. + "/ A hack to change return type of all LLVMIsAXXX() functions + "/ to bool (this avoids an extra allocation & nil test) + definitionFile definitions do:[:each | + (each isKindOf: CFunctionNode) ifTrue:[ + (each cName startsWith: 'LLVMIsA') ifTrue:[ + each return: CBoolNode new + ] + ] + ]. + "/ A hack to make all LLVMPrintXXXToString() to return + "/ generic pointer. This is necessary as we need the pointer + "/ in Smalltalk code to later invoke LLVMDisposeMessage() + definitionFile definitions do:[:each | + (each isKindOf: CFunctionNode) ifTrue:[ + ((each cName startsWith: 'LLVMPrint') and:[each cName endsWith: 'ToString']) ifTrue:[ + each return: (CPointerNode new type: (CPointerNode new type: CVoidNode new)) + ] + ] + ]. "Created: / 14-08-2015 / 11:13:24 / Jan Vrany " + "Modified: / 16-09-2015 / 06:11:27 / Jan Vrany " ! smalltalkPackage