@@ -22,7 +22,7 @@ import Config (objectExtension, bitcodeExtension,
22
22
llvmToObjectCommand ,
23
23
removeLPVMSection )
24
24
import Control.Monad ( (>=>) , unless )
25
- import Control.Monad.Trans (liftIO )
25
+ import Control.Monad.Trans (liftIO , lift )
26
26
import Control.Monad.Trans.Except
27
27
import Control.Monad.Trans.State
28
28
import qualified Data.ByteString as BS
@@ -42,7 +42,7 @@ import System.IO (openFile, hClose, Handle,
42
42
IOMode (WriteMode ), hPutStrLn )
43
43
import System.Process (proc , readCreateProcessWithExitCode )
44
44
import System.FilePath ((-<.>) )
45
- import System.Directory (getPermissions , writable , doesFileExist )
45
+ import System.Directory (getPermissions , writable , doesFileExist , removeFile )
46
46
import Util (createLocalCacheFile )
47
47
import LLVM
48
48
import Data.String
@@ -86,6 +86,7 @@ emitObjectFile m f = do
86
86
liftIO $ createLocalCacheFile filename
87
87
let (cmd,cmdLine) = llvmToObjectCommand llFilename filename userOptions
88
88
runOSCmd cmd cmdLine
89
+ lift $ removeFile llFilename
89
90
90
91
91
92
-- | With the LLVM AST representation of a LPVM Module, create a
@@ -99,10 +100,11 @@ emitBitcodeFile m f = do
99
100
userOptions <- gets options
100
101
let (cmd,cmdLine) = llvmToBitcodeCommand llFilename filename userOptions
101
102
runOSCmd cmd cmdLine
103
+ lift $ removeFile llFilename
102
104
103
105
104
- -- | With the LLVM AST representation of a LPVM Module, create a target LLVM
105
- -- Assembly file. This function forms the basis for all LLVM code generation.
106
+ -- | Create a target LLVM Assembly (.ll) file. This function forms the basis
107
+ -- for all LLVM code generation.
106
108
emitAssemblyFile :: ModSpec -> FilePath -> Compiler FilePath
107
109
emitAssemblyFile m f = do
108
110
let filename = f -<.> Config. assemblyExtension
0 commit comments