diff options
author | nineonine <mail4chemik@gmail.com> | 2019-07-08 00:09:15 -0700 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-07-11 17:48:18 -0400 |
commit | 8449c5b699c3a1a0e363ce75b1f151b38411298f (patch) | |
tree | f2ae57a63098f022abc3465ff87a418cc3ee8746 /compiler | |
parent | b507acebdc3dbec53c54ae07175b39da4066d4f8 (diff) | |
download | haskell-8449c5b699c3a1a0e363ce75b1f151b38411298f.tar.gz |
Allow reusing temporary object files generated by GHCi by writing to -odir in case -fwrite-interface was specified (#16670)
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/main/GhcMake.hs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/compiler/main/GhcMake.hs b/compiler/main/GhcMake.hs index 8767a6e99c..81311c1e0c 100644 --- a/compiler/main/GhcMake.hs +++ b/compiler/main/GhcMake.hs @@ -2198,15 +2198,17 @@ enableCodeGenWhen condition should_modify staticLife dynLife target nodemap = -- to by the user. But we need them, so we patch their locations in -- the ModSummary with temporary files. -- - hi_file <- + (hi_file, o_file) <- + -- If ``-fwrite-interface` is specified, then the .o and .hi files + -- are written into `-odir` and `-hidir` respectively. #16670 if gopt Opt_WriteInterface dflags - then return $ ml_hi_file ms_location - else new_temp_file (hiSuf dflags) (dynHiSuf dflags) - o_temp_file <- new_temp_file (objectSuf dflags) (dynObjectSuf dflags) + then return (ml_hi_file ms_location, ml_obj_file ms_location) + else (,) <$> (new_temp_file (hiSuf dflags) (dynHiSuf dflags)) + <*> (new_temp_file (objectSuf dflags) (dynObjectSuf dflags)) return $ ms { ms_location = - ms_location {ml_hi_file = hi_file, ml_obj_file = o_temp_file} + ms_location {ml_hi_file = hi_file, ml_obj_file = o_file} , ms_hspp_opts = updOptLevel 0 $ dflags {hscTarget = target} } | otherwise = return ms |