summaryrefslogtreecommitdiff
path: root/ghc
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2021-06-22 12:29:47 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-07-01 03:30:36 -0400
commit6d712150f8f9400397368b45a152a694ba9d5af4 (patch)
tree40a873281b87cc2d677f416ef0b7e87da465ebf7 /ghc
parent6f097a8161dfc97be007b83fccbdb71350d786b1 (diff)
downloadhaskell-6d712150f8f9400397368b45a152a694ba9d5af4.tar.gz
Dynflags: introduce DiagOpts
Use DiagOpts for diagnostic options instead of directly querying DynFlags (#17957). Surprising performance improvements on CI: T4801(normal) ghc/alloc 313236344.0 306515216.0 -2.1% GOOD T9961(normal) ghc/alloc 384502736.0 380584384.0 -1.0% GOOD ManyAlternatives(normal) ghc/alloc 797356128.0 786644928.0 -1.3% ManyConstructors(normal) ghc/alloc 4389732432.0 4317740880.0 -1.6% T783(normal) ghc/alloc 408142680.0 402812176.0 -1.3% Metric Decrease: T4801 T9961 T783 ManyAlternatives ManyConstructors Bump haddock submodule
Diffstat (limited to 'ghc')
-rw-r--r--ghc/GHCi/UI.hs3
-rw-r--r--ghc/Main.hs3
2 files changed, 4 insertions, 2 deletions
diff --git a/ghc/GHCi/UI.hs b/ghc/GHCi/UI.hs
index afacb845de..1f5b576b6b 100644
--- a/ghc/GHCi/UI.hs
+++ b/ghc/GHCi/UI.hs
@@ -52,6 +52,7 @@ import GHC.Driver.Ppr hiding (printForUser)
import GHC.Utils.Error hiding (traceCmd)
import GHC.Driver.Monad ( modifySession )
import GHC.Driver.Config.Parser (initParserOpts)
+import GHC.Driver.Config.Diagnostic
import qualified GHC
import GHC ( LoadHowMuch(..), Target(..), TargetId(..),
Resume, SingleStep, Ghc,
@@ -3072,7 +3073,7 @@ newDynFlags interactive_only minus_opts = do
idflags0 <- GHC.getInteractiveDynFlags
(idflags1, leftovers, warns) <- DynFlags.parseDynamicFlagsCmdLine idflags0 lopts
- liftIO $ handleFlagWarnings logger idflags1 warns
+ liftIO $ handleFlagWarnings logger (initDiagOpts idflags1) warns
when (not $ null leftovers)
(throwGhcException . CmdLineError
$ "Some flags have not been recognized: "
diff --git a/ghc/Main.hs b/ghc/Main.hs
index 9f0dc68ec5..0dec4f6cbc 100644
--- a/ghc/Main.hs
+++ b/ghc/Main.hs
@@ -30,6 +30,7 @@ import GHC.Driver.MakeFile ( doMkDependHS )
import GHC.Driver.Backpack ( doBackpack )
import GHC.Driver.Plugins
import GHC.Driver.Config.Logger (initLogFlags)
+import GHC.Driver.Config.Diagnostic
import GHC.Platform
import GHC.Platform.Ways
@@ -223,7 +224,7 @@ main' postLoadMode dflags0 args flagWarnings = do
handleSourceError (\e -> do
GHC.printException e
liftIO $ exitWith (ExitFailure 1)) $ do
- liftIO $ handleFlagWarnings logger4 dflags4 flagWarnings'
+ liftIO $ handleFlagWarnings logger4 (initDiagOpts dflags4) flagWarnings'
liftIO $ showBanner postLoadMode dflags4