diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2020-11-12 10:36:58 +0100 |
---|---|---|
committer | Sylvain Henry <sylvain@haskus.fr> | 2020-12-14 19:45:13 +0100 |
commit | d0e8c10d587e4b9984526d0dfcfcb258b75733b8 (patch) | |
tree | e0993719d76f87a0f4f8eccef089526217bf5bb4 /testsuite/tests/ghc-api | |
parent | 92377c27e1a48d0d3776f65c7074dfeb122b46db (diff) | |
download | haskell-d0e8c10d587e4b9984526d0dfcfcb258b75733b8.tar.gz |
Move Unit related fields from DynFlags to HscEnv
The unit database cache, the home unit and the unit state were stored in
DynFlags while they ought to be stored in the compiler session state
(HscEnv). This patch fixes this.
It introduces a new UnitEnv type that should be used in the future to
handle separate unit environments (especially host vs target units).
Related to #17957
Bump haddock submodule
Diffstat (limited to 'testsuite/tests/ghc-api')
-rw-r--r-- | testsuite/tests/ghc-api/T7478/T7478.hs | 3 | ||||
-rw-r--r-- | testsuite/tests/ghc-api/T9595.hs | 11 |
2 files changed, 7 insertions, 7 deletions
diff --git a/testsuite/tests/ghc-api/T7478/T7478.hs b/testsuite/tests/ghc-api/T7478/T7478.hs index 2fa0f6095e..89fd61a22c 100644 --- a/testsuite/tests/ghc-api/T7478/T7478.hs +++ b/testsuite/tests/ghc-api/T7478/T7478.hs @@ -11,6 +11,7 @@ import qualified GHC.Utils.Outputable as GHC import qualified GHC.Driver.Ppr as GHC import GHC.Driver.Monad (liftIO) import GHC.Utils.Outputable (PprStyle, queryQual) +import GHC.Unit.State compileInGhc :: [FilePath] -- ^ Targets -> (String -> IO ()) -- ^ handler for each SevOutput message @@ -43,7 +44,7 @@ compileInGhc targets handlerOutput = do _ -> error "fileFromTarget: not a known target" collectSrcError handlerOutput flags _ SevOutput _srcspan msg - = handlerOutput $ GHC.showSDocForUser flags alwaysQualify msg + = handlerOutput $ GHC.showSDocForUser flags emptyUnitState alwaysQualify msg collectSrcError _ _ _ _ _ _ = return () diff --git a/testsuite/tests/ghc-api/T9595.hs b/testsuite/tests/ghc-api/T9595.hs index 468b63a342..9a5450fbd3 100644 --- a/testsuite/tests/ghc-api/T9595.hs +++ b/testsuite/tests/ghc-api/T9595.hs @@ -3,18 +3,18 @@ module Main where import GHC import GHC.Unit.State import GHC.Driver.Monad -import GHC.Utils.Outputable -import System.Environment import GHC.Driver.Session +import GHC.Driver.Env +import GHC.Utils.Outputable import GHC.Unit.Module +import System.Environment main = do [libdir] <- getArgs _ <- runGhc (Just libdir) $ do dflags <- getSessionDynFlags setSessionDynFlags dflags - dflags <- getSessionDynFlags - let state = unitState dflags + state <- hsc_units <$> getSession liftIO $ print (mkModuleName "GHC.Utils.Outputable" `elem` listVisibleModuleNames state) _ <- runGhc (Just libdir) $ do dflags <- getSessionDynFlags @@ -23,7 +23,6 @@ main = (PackageArg "ghc") (ModRenaming True [])] }) - dflags <- getSessionDynFlags - let state = unitState dflags + state <- hsc_units <$> getSession liftIO $ print (mkModuleName "GHC.Utils.Outputable" `elem` listVisibleModuleNames state) return () |