diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2020-10-15 17:55:34 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-10-29 03:53:52 -0400 |
commit | 0e9f6defbdc1f691ff7197b21e68ac16ffa4ab59 (patch) | |
tree | 1c9d9848db07596c19221fd195db81cdf6430385 /compiler/GHC/Driver/Session.hs | |
parent | 795908dc4eab8e8b40cb318a2adbe4a4d4126c74 (diff) | |
download | haskell-0e9f6defbdc1f691ff7197b21e68ac16ffa4ab59.tar.gz |
Split GHC.Driver.Types
I was working on making DynFlags stateless (#17957), especially by
storing loaded plugins into HscEnv instead of DynFlags. It turned out to
be complicated because HscEnv is in GHC.Driver.Types but LoadedPlugin
isn't: it is in GHC.Driver.Plugins which depends on GHC.Driver.Types. I
didn't feel like introducing yet another hs-boot file to break the loop.
Additionally I remember that while we introduced the module hierarchy
(#13009) we talked about splitting GHC.Driver.Types because it contained
various unrelated types and functions, but we never executed. I didn't
feel like making GHC.Driver.Types bigger with more unrelated Plugins
related types, so finally I bit the bullet and split GHC.Driver.Types.
As a consequence this patch moves a lot of things. I've tried to put
them into appropriate modules but nothing is set in stone.
Several other things moved to avoid loops.
* Removed Binary instances from GHC.Utils.Binary for random compiler
things
* Moved Typeable Binary instances into GHC.Utils.Binary.Typeable: they
import a lot of things that users of GHC.Utils.Binary don't want to
depend on.
* put everything related to Units/Modules under GHC.Unit:
GHC.Unit.Finder, GHC.Unit.Module.{ModGuts,ModIface,Deps,etc.}
* Created several modules under GHC.Types: GHC.Types.Fixity, SourceText,
etc.
* Split GHC.Utils.Error (into GHC.Types.Error)
* Finally removed GHC.Driver.Types
Note that this patch doesn't put loaded plugins into HscEnv. It's left
for another patch.
Bump haddock submodule
Diffstat (limited to 'compiler/GHC/Driver/Session.hs')
-rw-r--r-- | compiler/GHC/Driver/Session.hs | 32 |
1 files changed, 5 insertions, 27 deletions
diff --git a/compiler/GHC/Driver/Session.hs b/compiler/GHC/Driver/Session.hs index ccc7d2b8a3..20fd137ea7 100644 --- a/compiler/GHC/Driver/Session.hs +++ b/compiler/GHC/Driver/Session.hs @@ -69,7 +69,6 @@ module GHC.Driver.Session ( putLogMsg, -- ** Safe Haskell - SafeHaskellMode(..), safeHaskellOn, safeHaskellModeEnabled, safeImportsOn, safeLanguageOn, safeInferOn, packageTrustOn, @@ -257,6 +256,7 @@ import GHC.Data.Maybe import GHC.Utils.Monad import qualified GHC.Utils.Ppr as Pretty import GHC.Types.SrcLoc +import GHC.Types.SafeHaskell import GHC.Types.Basic ( Alignment, alignmentOf, IntWithInf, treatZeroAsInf ) import GHC.Data.FastString import GHC.Utils.Fingerprint @@ -264,9 +264,9 @@ import GHC.Utils.Outputable import GHC.Settings import GHC.CmmToAsm.CFG.Weight +import GHC.Types.Error import {-# SOURCE #-} GHC.Utils.Error - ( Severity(..), MsgDoc, mkLocMessageAnn - , getCaretDiagnostic, DumpAction, TraceAction + ( DumpAction, TraceAction , defaultDumpAction, defaultTraceAction ) import GHC.Utils.Json import GHC.SysTools.Terminal ( stderrSupportsAnsiColors ) @@ -404,27 +404,6 @@ addQuoteInclude spec paths = let f = includePathsQuote spec flattenIncludes :: IncludeSpecs -> [String] flattenIncludes specs = includePathsQuote specs ++ includePathsGlobal specs --- | The various Safe Haskell modes -data SafeHaskellMode - = Sf_None -- ^ inferred unsafe - | Sf_Unsafe -- ^ declared and checked - | Sf_Trustworthy -- ^ declared and checked - | Sf_Safe -- ^ declared and checked - | Sf_SafeInferred -- ^ inferred as safe - | Sf_Ignore -- ^ @-fno-safe-haskell@ state - deriving (Eq) - -instance Show SafeHaskellMode where - show Sf_None = "None" - show Sf_Unsafe = "Unsafe" - show Sf_Trustworthy = "Trustworthy" - show Sf_Safe = "Safe" - show Sf_SafeInferred = "Safe-Inferred" - show Sf_Ignore = "Ignore" - -instance Outputable SafeHaskellMode where - ppr = text . show - -- | Contains not only a collection of 'GeneralFlag's but also a plethora of -- information relating to the compilation of a single file or GHC session data DynFlags = DynFlags { @@ -937,13 +916,13 @@ versionedFilePath platform = uniqueSubdir platform -- | The 'GhcMode' tells us whether we're doing multi-module -- compilation (controlled via the "GHC" API) or one-shot -- (single-module) compilation. This makes a difference primarily to --- the "GHC.Driver.Finder": in one-shot mode we look for interface files for +-- the "GHC.Unit.Finder": in one-shot mode we look for interface files for -- imported modules, but in multi-module mode we look for source files -- in order to check whether they need to be recompiled. data GhcMode = CompManager -- ^ @\-\-make@, GHCi, etc. | OneShot -- ^ @ghc -c Foo.hs@ - | MkDepend -- ^ @ghc -M@, see "GHC.Driver.Finder" for why we need this + | MkDepend -- ^ @ghc -M@, see "GHC.Unit.Finder" for why we need this deriving Eq instance Outputable GhcMode where @@ -5080,4 +5059,3 @@ initSDocContext dflags style = SDC -- | Initialize the pretty-printing options using the default user style initDefaultSDocContext :: DynFlags -> SDocContext initDefaultSDocContext dflags = initSDocContext dflags defaultUserStyle - |