diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2021-01-12 14:56:41 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-02-22 18:27:00 -0500 |
commit | fd0945b7bfa1e36ca79d74f8e6e0918a66d62608 (patch) | |
tree | a57bd43ad0b6d87e69f36e52802d28d9c4de5076 /compiler/GHC/Driver/Pipeline.hs | |
parent | ece202297454862717cef8c06d445f8405845b28 (diff) | |
download | haskell-fd0945b7bfa1e36ca79d74f8e6e0918a66d62608.tar.gz |
Move Hooks into HscEnv
Diffstat (limited to 'compiler/GHC/Driver/Pipeline.hs')
-rw-r--r-- | compiler/GHC/Driver/Pipeline.hs | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/compiler/GHC/Driver/Pipeline.hs b/compiler/GHC/Driver/Pipeline.hs index f5cbebee51..df54f35e04 100644 --- a/compiler/GHC/Driver/Pipeline.hs +++ b/compiler/GHC/Driver/Pipeline.hs @@ -484,6 +484,7 @@ compileEmptyStub dflags hsc_env basename location mod_name = do -- libraries. link :: GhcLink -- ^ interactive or batch -> Logger -- ^ Logger + -> Hooks -> DynFlags -- ^ dynamic flags -> UnitEnv -- ^ unit environment -> Bool -- ^ attempt linking in batch mode? @@ -497,20 +498,20 @@ link :: GhcLink -- ^ interactive or batch -- exports main, i.e., we have good reason to believe that linking -- will succeed. -link ghcLink logger dflags unit_env - = lookupHook linkHook l dflags ghcLink dflags - where - l k dflags batch_attempt_linking hpt = case k of - NoLink -> return Succeeded - LinkBinary -> link' logger dflags unit_env batch_attempt_linking hpt - LinkStaticLib -> link' logger dflags unit_env batch_attempt_linking hpt - LinkDynLib -> link' logger dflags unit_env batch_attempt_linking hpt - LinkInMemory - | platformMisc_ghcWithInterpreter $ platformMisc dflags - -> -- Not Linking...(demand linker will do the job) - return Succeeded - | otherwise - -> panicBadLink LinkInMemory +link ghcLink logger hooks dflags unit_env batch_attempt_linking hpt = + case linkHook hooks of + Nothing -> case ghcLink of + NoLink -> return Succeeded + LinkBinary -> link' logger dflags unit_env batch_attempt_linking hpt + LinkStaticLib -> link' logger dflags unit_env batch_attempt_linking hpt + LinkDynLib -> link' logger dflags unit_env batch_attempt_linking hpt + LinkInMemory + | platformMisc_ghcWithInterpreter $ platformMisc dflags + -> -- Not Linking...(demand linker will do the job) + return Succeeded + | otherwise + -> panicBadLink LinkInMemory + Just h -> h ghcLink dflags batch_attempt_linking hpt panicBadLink :: GhcLink -> a @@ -937,8 +938,10 @@ pipeLoop phase input_fn = do runHookedPhase :: PhasePlus -> FilePath -> CompPipeline (PhasePlus, FilePath) runHookedPhase pp input = do - dflags <- hsc_dflags <$> getPipeSession - lookupHook runPhaseHook runPhase dflags pp input + hooks <- hsc_hooks <$> getPipeSession + case runPhaseHook hooks of + Nothing -> runPhase pp input + Just h -> h pp input -- ----------------------------------------------------------------------------- -- In each phase, we need to know into what filename to generate the |