diff -r 70dd75ab337c -r 9244f78bcf02 LLVMModule.st --- a/LLVMModule.st Fri Jun 17 23:43:23 2016 +0100 +++ b/LLVMModule.st Sat Jun 18 16:00:36 2016 +0100 @@ -18,7 +18,7 @@ LLVMDisposableObject subclass:#LLVMModule instanceVariableNames:'' classVariableNames:'' - poolDictionaries:'LLVMTypeKind' + poolDictionaries:'LLVMTypeKind LLVMVerifierFailureAction' category:'LLVM-S-Core' ! @@ -225,6 +225,25 @@ "Created: / 05-08-2015 / 23:29:13 / Jan Vrany " ! ! +!LLVMModule methodsFor:'utilities'! + +verify + "Verifies that a module is valid. If yes, this method is no-op. + If false, throws LLVMModuleVerificationError." + + | msgPtr msg | + + msgPtr := ExternalBytes new: ExternalBytes sizeofPointer. + + (LLVM VerifyModule: self _: LLVMReturnStatusAction _: msgPtr) ifTrue:[ + msg := (msgPtr pointerAt: 1) copyCStringFromHeap. + LLVM DisposeMessage: (msgPtr pointerAt: 1). + LLVMModuleVerificationError signal: msg. + ]. + + "Created: / 18-06-2016 / 15:48:28 / Jan Vrany " +! ! + !LLVMModule methodsFor:'writing-assembly'! writeAssemblyOn: aStream