summaryrefslogtreecommitdiff
path: root/compiler/backpack
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2017-02-02 14:37:24 -0500
committerBen Gamari <ben@smart-cactus.org>2017-02-02 22:13:53 -0500
commitbbd3c399939311ec3e308721ab87ca6b9443f358 (patch)
tree1a398f3857502ab42f350008f83b7c67f0d9ff1e /compiler/backpack
parent6128b2ffbe36ed2779583e05ee9d817eaafc1c9c (diff)
downloadhaskell-bbd3c399939311ec3e308721ab87ca6b9443f358.tar.gz
Ditch static flags
This patch converts the 4 lasting static flags (read from the command line and unsafely stored in immutable global variables) into dynamic flags. Most use cases have been converted into reading them from a DynFlags. In cases for which we don't have easy access to a DynFlags, we read from 'unsafeGlobalDynFlags' that is set at the beginning of each 'runGhc'. It's not perfect (not thread-safe) but it is still better as we can set/unset these 4 flags before each run when using GHC API. Updates haddock submodule. Rebased and finished by: bgamari Test Plan: validate Reviewers: goldfire, erikd, hvr, austin, simonmar, bgamari Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2839 GHC Trac Issues: #8440
Diffstat (limited to 'compiler/backpack')
-rw-r--r--compiler/backpack/DriverBkp.hs11
1 files changed, 6 insertions, 5 deletions
diff --git a/compiler/backpack/DriverBkp.hs b/compiler/backpack/DriverBkp.hs
index 595cb25174..25ef62409e 100644
--- a/compiler/backpack/DriverBkp.hs
+++ b/compiler/backpack/DriverBkp.hs
@@ -508,9 +508,9 @@ mkBackpackMsg = do
-- | 'PprStyle' for Backpack messages; here we usually want the module to
-- be qualified (so we can tell how it was instantiated.) But we try not
-- to qualify packages so we can use simple names for them.
-backpackStyle :: PprStyle
-backpackStyle =
- mkUserStyle
+backpackStyle :: DynFlags -> PprStyle
+backpackStyle dflags =
+ mkUserStyle dflags
(QueryQualify neverQualifyNames
alwaysQualifyModules
neverQualifyPackages) AllTheWay
@@ -529,7 +529,8 @@ msgUnitId pk = do
dflags <- getDynFlags
level <- getBkpLevel
liftIO . backpackProgressMsg level dflags
- $ "Instantiating " ++ renderWithStyle dflags (ppr pk) backpackStyle
+ $ "Instantiating " ++ renderWithStyle dflags (ppr pk)
+ (backpackStyle dflags)
-- | Message when we include a Backpack unit.
msgInclude :: (Int,Int) -> UnitId -> BkpM ()
@@ -538,7 +539,7 @@ msgInclude (i,n) uid = do
level <- getBkpLevel
liftIO . backpackProgressMsg level dflags
$ showModuleIndex (i, n) ++ "Including " ++
- renderWithStyle dflags (ppr uid) backpackStyle
+ renderWithStyle dflags (ppr uid) (backpackStyle dflags)
-- ----------------------------------------------------------------------------
-- Conversion from PackageName to HsComponentId