LLVMModule.st
changeset 38 52be9bfdf7e1
parent 37 0933f973bc22
child 43 597181c496f0
--- a/LLVMModule.st	Mon Sep 14 11:12:31 2015 +0100
+++ b/LLVMModule.st	Wed Sep 16 05:32:46 2015 +0100
@@ -248,17 +248,22 @@
     self writeBitcodeToFile: bitcode.
     assembly := bitcode withSuffix:'s'.  
     [ 
-        (OperatingSystem executeCommand: (LLVMConfig bindir , Filename separator , 'llc ' , bitcode pathName)) ifFalse:[ 
-            self error: 'Failed to generate assembly'.
+        | errorOutput |
+
+        errorOutput := String new writeStream.
+        (OperatingSystem executeCommand: (LLVMConfig bindir , Filename separator , 'llc ' , bitcode pathName) errorTo: errorOutput) ifTrue:[
+            aStream nextPutAll: assembly contents asString.
+        ] ifFalse:[ 
+            aStream nextPutAll: 'Failed to generate assembly:'; cr; cr.
+            aStream nextPutAll: errorOutput contents
         ].
-        aStream nextPutAll: assembly contents asString.
     ] ensure:[ 
         bitcode remove.
         assembly remove.
     ].
 
     "Created: / 05-08-2015 / 23:46:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 07-08-2015 / 14:09:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 15-09-2015 / 18:21:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !LLVMModule methodsFor:'writing-bitcode'!