on master help sign in
Fix compatibility with llvm-general 3.3.2 and tighten version constraints to avoid future breakage
commit340beed77fcdc51042a1b534781b05270c4f1039 authorBenjamin Saunders <besaunde@sfu.ca> dateFri 5 Jul 2013, 01:19 (13 years ago) parent36e9a0a
2 files changed+4−3
idris.cabal+1−1 src/IRTS/CodegenLLVM.hs+3−2
idris.cabal+1−1
@@ -272,7 +272,7 @@ Executable idris
272272 haskeline>=0.7, split, directory,
273273 containers, process, transformers, filepath,
274274 directory, binary, bytestring, text, pretty,
275− language-java>=0.2.2, libffi, llvm-general>=3.3.0.6 && <3.4
275+ language-java>=0.2.2, libffi, llvm-general==3.3.2.*
276276
277277 Extensions: MultiParamTypeClasses, FunctionalDependencies,
278278 FlexibleInstances, TemplateHaskell
src/IRTS/CodegenLLVM.hs+3−2
@@ -32,6 +32,7 @@ import Control.Applicative
3232import Control.Monad.RWS
3333import Control.Monad.Writer
3434import Control.Monad.State
35+import Control.Monad.Error
3536
3637import qualified System.Info as SI (arch, os)
3738import System.IO
@@ -50,7 +51,7 @@ codegenLLVM :: [(TT.Name, SDecl)] ->
5051codegenLLVM defs file outty = withContext $ \context -> do
5152 let target = Target { arch = SI.arch, os = SI.os }
5253 let ast = codegen target (map snd defs)
53− result <- M.withModuleFromAST context ast (outputModule file outty)
54+ result <- runErrorT $ M.withModuleFromAST context ast (outputModule file outty)
5455 case result of
5556 Right _ -> return ()
5657 Left msg -> ierror msg
@@ -60,7 +61,7 @@ itWidth ITNative = 32
6061itWidth x = fromIntegral $ intTyWidth x
6162
6263outputModule :: FilePath -> OutputType -> M.Module -> IO ()
63−outputModule file Raw m = M.writeBitcodeToFile file m
64+outputModule file Raw m = either fail return <=< runErrorT $ M.writeBitcodeToFile file m
6465outputModule file Object m = withTmpFile $ \bc -> do
6566 outputModule bc Raw m
6667 exit <- rawSystem "llc" ["-filetype=obj", "--disable-fp-elim", "-o", file, bc]