summaryrefslogtreecommitdiff
path: root/compiler/GHC/Driver/MakeFile.hs
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2021-01-13 18:24:21 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-03-08 18:24:07 -0500
commitdaa6363f49df0dceb2c460da500461e564aa9ea2 (patch)
tree49891c015240ed281c603fdaebb0f26f49d47a6b /compiler/GHC/Driver/MakeFile.hs
parente483775c3ff39523d18c44f04b4842518437fba8 (diff)
downloadhaskell-daa6363f49df0dceb2c460da500461e564aa9ea2.tar.gz
DynFlags: move temp file management into HscEnv (#17957)
Diffstat (limited to 'compiler/GHC/Driver/MakeFile.hs')
-rw-r--r--compiler/GHC/Driver/MakeFile.hs11
1 files changed, 6 insertions, 5 deletions
diff --git a/compiler/GHC/Driver/MakeFile.hs b/compiler/GHC/Driver/MakeFile.hs
index 57377212cb..f71b2e17b9 100644
--- a/compiler/GHC/Driver/MakeFile.hs
+++ b/compiler/GHC/Driver/MakeFile.hs
@@ -31,7 +31,7 @@ import GHC.Types.SourceError
import GHC.Types.SrcLoc
import Data.List (partition)
import GHC.Data.FastString
-import GHC.SysTools.FileCleanup
+import GHC.Utils.TmpFs
import GHC.Iface.Load (cannotFindModule)
@@ -82,7 +82,8 @@ doMkDependHS srcs = do
when (null (depSuffixes dflags)) $ liftIO $
throwGhcExceptionIO (ProgramError "You must specify at least one -dep-suffix")
- files <- liftIO $ beginMkDependHS logger dflags
+ tmpfs <- hsc_tmpfs <$> getSession
+ files <- liftIO $ beginMkDependHS logger tmpfs dflags
-- Do the downsweep to find all the modules
targets <- mapM (\s -> GHC.guessTarget s Nothing) srcs
@@ -131,11 +132,11 @@ data MkDepFiles
mkd_tmp_file :: FilePath, -- Name of the temporary file
mkd_tmp_hdl :: Handle } -- Handle of the open temporary file
-beginMkDependHS :: Logger -> DynFlags -> IO MkDepFiles
-beginMkDependHS logger dflags = do
+beginMkDependHS :: Logger -> TmpFs -> DynFlags -> IO MkDepFiles
+beginMkDependHS logger tmpfs dflags = do
-- open a new temp file in which to stuff the dependency info
-- as we go along.
- tmp_file <- newTempName logger dflags TFL_CurrentModule "dep"
+ tmp_file <- newTempName logger tmpfs dflags TFL_CurrentModule "dep"
tmp_hdl <- openFile tmp_file WriteMode
-- open the makefile