summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFendor <power.walross@gmail.com>2021-02-03 19:12:02 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-03-28 17:26:37 -0400
commit29d758631c0d9124485aafc89cddc4ec5a668653 (patch)
tree72efc6ad23ddc052cecd01b493384b8fbc74daab
parentb02c8ef768df33ef4845da2f15583cf143a4d0e2 (diff)
downloadhaskell-29d758631c0d9124485aafc89cddc4ec5a668653.tar.gz
Add UnitId to Target record
In the future, we want `HscEnv` to support multiple home units at the same time. This means, that there will be 'Target's that do not belong to the current 'HomeUnit'. This is an API change without changing behaviour. Update haddock submodule to incorporate API changes.
-rw-r--r--compiler/GHC.hs32
-rw-r--r--compiler/GHC/Driver/Make.hs10
-rw-r--r--compiler/GHC/Driver/MakeFile.hs2
-rw-r--r--compiler/GHC/Driver/Pipeline.hs2
-rw-r--r--compiler/GHC/Types/Target.hs3
-rw-r--r--compiler/GHC/Unit/Module/ModSummary.hs12
-rw-r--r--ghc/GHCi/UI.hs24
-rw-r--r--ghc/GHCi/UI/Info.hs4
-rw-r--r--ghc/Main.hs2
-rw-r--r--testsuite/tests/annotations/should_run/annrun01.hs2
-rw-r--r--testsuite/tests/ghc-api/T10052/T10052.hs3
-rw-r--r--testsuite/tests/ghc-api/T4891/T4891.hs2
-rw-r--r--testsuite/tests/ghc-api/T6145.hs5
-rw-r--r--testsuite/tests/ghc-api/T7478/T7478.hs5
-rw-r--r--testsuite/tests/ghc-api/T8639_api.hs2
-rw-r--r--testsuite/tests/ghc-api/annotations-literals/literals.hs1
-rw-r--r--testsuite/tests/ghc-api/annotations-literals/parsed.hs1
-rw-r--r--testsuite/tests/ghc-api/apirecomp001/myghc.hs2
-rw-r--r--testsuite/tests/ghc-api/downsweep/OldModLocation.hs2
-rw-r--r--testsuite/tests/ghc-api/downsweep/PartialDownsweep.hs2
-rw-r--r--testsuite/tests/ghc-api/target-contents/TargetContents.hs2
-rw-r--r--testsuite/tests/ghci/linking/dyn/T3372.hs6
-rw-r--r--testsuite/tests/plugins/FrontendPlugin.hs2
-rw-r--r--testsuite/tests/plugins/static-plugins.hs2
-rw-r--r--testsuite/tests/quasiquotation/T7918.hs1
-rw-r--r--utils/check-exact/Main.hs1
-rw-r--r--utils/check-ppr/Main.hs1
m---------utils/haddock0
28 files changed, 83 insertions, 50 deletions
diff --git a/compiler/GHC.hs b/compiler/GHC.hs
index 4e554e58ce..4054ead5f2 100644
--- a/compiler/GHC.hs
+++ b/compiler/GHC.hs
@@ -935,7 +935,7 @@ removeTarget :: GhcMonad m => TargetId -> m ()
removeTarget target_id
= modifySession (\h -> h{ hsc_targets = filter (hsc_targets h) })
where
- filter targets = [ t | t@(Target id _ _) <- targets, id /= target_id ]
+ filter targets = [ t | t@Target { targetId = id } <- targets, id /= target_id ]
-- | Attempts to guess what Target a string refers to. This function
-- implements the @--make@/GHCi command-line syntax for filenames:
@@ -948,23 +948,25 @@ removeTarget target_id
--
-- - otherwise interpret the string as a module name
--
-guessTarget :: GhcMonad m => String -> Maybe Phase -> m Target
-guessTarget str (Just phase)
- = return (Target (TargetFile str (Just phase)) True Nothing)
-guessTarget str Nothing
+guessTarget :: GhcMonad m => String -> Maybe UnitId -> Maybe Phase -> m Target
+guessTarget str mUnitId (Just phase)
+ = do
+ tuid <- unitIdOrHomeUnit mUnitId
+ return (Target (TargetFile str (Just phase)) True tuid Nothing)
+guessTarget str mUnitId Nothing
| isHaskellSrcFilename file
- = return (target (TargetFile file Nothing))
+ = target (TargetFile file Nothing)
| otherwise
= do exists <- liftIO $ doesFileExist hs_file
if exists
- then return (target (TargetFile hs_file Nothing))
+ then target (TargetFile hs_file Nothing)
else do
exists <- liftIO $ doesFileExist lhs_file
if exists
- then return (target (TargetFile lhs_file Nothing))
+ then target (TargetFile lhs_file Nothing)
else do
if looksLikeModuleName file
- then return (target (TargetModule (mkModuleName file)))
+ then target (TargetModule (mkModuleName file))
else do
dflags <- getDynFlags
liftIO $ throwGhcExceptionIO
@@ -979,8 +981,16 @@ guessTarget str Nothing
hs_file = file <.> "hs"
lhs_file = file <.> "lhs"
- target tid = Target tid obj_allowed Nothing
+ target tid = do
+ tuid <- unitIdOrHomeUnit mUnitId
+ pure $ Target tid obj_allowed tuid Nothing
+-- | Unwrap 'UnitId' or retrieve the 'UnitId'
+-- of the current 'HomeUnit'.
+unitIdOrHomeUnit :: GhcMonad m => Maybe UnitId -> m UnitId
+unitIdOrHomeUnit mUnitId = do
+ currentHomeUnitId <- homeUnitId . ue_home_unit . hsc_unit_env <$> getSession
+ pure (fromMaybe currentHomeUnitId mUnitId)
-- | Inform GHC that the working directory has changed. GHC will flush
-- its cache of module locations, since it may no longer be valid.
@@ -1243,7 +1253,7 @@ compileToCoreSimplified = compileCore True
compileCore :: GhcMonad m => Bool -> FilePath -> m CoreModule
compileCore simplify fn = do
-- First, set the target to the desired filename
- target <- guessTarget fn Nothing
+ target <- guessTarget fn Nothing Nothing
addTarget target
_ <- load LoadAllTargets
-- Then find dependencies
diff --git a/compiler/GHC/Driver/Make.hs b/compiler/GHC/Driver/Make.hs
index 734608b471..720df3e2c8 100644
--- a/compiler/GHC/Driver/Make.hs
+++ b/compiler/GHC/Driver/Make.hs
@@ -2287,14 +2287,20 @@ downsweep hsc_env old_summaries excl_mods allow_dup_roots
old_summary_map = mkNodeMap old_summaries
getRootSummary :: Target -> IO (Either ErrorMessages ExtendedModSummary)
- getRootSummary (Target (TargetFile file mb_phase) obj_allowed maybe_buf)
+ getRootSummary Target { targetId = TargetFile file mb_phase
+ , targetAllowObjCode = obj_allowed
+ , targetContents = maybe_buf
+ }
= do exists <- liftIO $ doesFileExist file
if exists || isJust maybe_buf
then summariseFile hsc_env old_summaries file mb_phase
obj_allowed maybe_buf
else return $ Left $ unitBag $ mkPlainMsgEnvelope noSrcSpan $
text "can't find file:" <+> text file
- getRootSummary (Target (TargetModule modl) obj_allowed maybe_buf)
+ getRootSummary Target { targetId = TargetModule modl
+ , targetAllowObjCode = obj_allowed
+ , targetContents = maybe_buf
+ }
= do maybe_summary <- summariseModule hsc_env old_summary_map NotBoot
(L rootLoc modl) obj_allowed
maybe_buf excl_mods
diff --git a/compiler/GHC/Driver/MakeFile.hs b/compiler/GHC/Driver/MakeFile.hs
index b6572bcb5b..d018c26ecf 100644
--- a/compiler/GHC/Driver/MakeFile.hs
+++ b/compiler/GHC/Driver/MakeFile.hs
@@ -86,7 +86,7 @@ doMkDependHS srcs = do
files <- liftIO $ beginMkDependHS logger tmpfs dflags
-- Do the downsweep to find all the modules
- targets <- mapM (\s -> GHC.guessTarget s Nothing) srcs
+ targets <- mapM (\s -> GHC.guessTarget s Nothing Nothing) srcs
GHC.setTargets targets
let excl_mods = depExcludeMods dflags
module_graph <- GHC.depanal excl_mods True {- Allow dup roots -}
diff --git a/compiler/GHC/Driver/Pipeline.hs b/compiler/GHC/Driver/Pipeline.hs
index 6d945f6ff1..67fd78d7fa 100644
--- a/compiler/GHC/Driver/Pipeline.hs
+++ b/compiler/GHC/Driver/Pipeline.hs
@@ -343,7 +343,7 @@ compileOne' m_tc_result mHscMessage
current_dir = takeDirectory basename
old_paths = includePaths dflags2
loadAsByteCode
- | Just (Target _ obj _) <- findTarget summary (hsc_targets hsc_env0)
+ | Just Target { targetAllowObjCode = obj } <- findTarget summary (hsc_targets hsc_env0)
, not obj
= True
| otherwise = False
diff --git a/compiler/GHC/Types/Target.hs b/compiler/GHC/Types/Target.hs
index 8f2c0649d4..6599bdac4a 100644
--- a/compiler/GHC/Types/Target.hs
+++ b/compiler/GHC/Types/Target.hs
@@ -25,6 +25,7 @@ data Target
= Target {
targetId :: TargetId, -- ^ module or filename
targetAllowObjCode :: Bool, -- ^ object code allowed?
+ targetUnitId :: UnitId, -- ^ id of the unit this target is part of
targetContents :: Maybe (InputFileBuffer, UTCTime)
-- ^ Optional in-memory buffer containing the source code GHC should
-- use for this target instead of reading it from disk.
@@ -52,7 +53,7 @@ type InputFileBuffer = StringBuffer
pprTarget :: Target -> SDoc
-pprTarget (Target id obj _) =
+pprTarget Target { targetId = id, targetAllowObjCode = obj } =
(if obj then empty else char '*') <> pprTargetId id
instance Outputable Target where
diff --git a/compiler/GHC/Unit/Module/ModSummary.hs b/compiler/GHC/Unit/Module/ModSummary.hs
index e9106d44eb..324cca33a3 100644
--- a/compiler/GHC/Unit/Module/ModSummary.hs
+++ b/compiler/GHC/Unit/Module/ModSummary.hs
@@ -6,6 +6,7 @@ module GHC.Unit.Module.ModSummary
( ExtendedModSummary (..)
, extendModSummaryNoDeps
, ModSummary (..)
+ , ms_unitid
, ms_installed_mod
, ms_mod_name
, ms_imps
@@ -98,6 +99,9 @@ data ModSummary
-- ^ The actual preprocessed source, if we have it
}
+ms_unitid :: ModSummary -> UnitId
+ms_unitid = toUnitId . moduleUnit . ms_mod
+
ms_installed_mod :: ModSummary -> InstalledModule
ms_installed_mod = fst . getModuleInstantiation . ms_mod
@@ -172,11 +176,11 @@ findTarget ms ts =
[] -> Nothing
(t:_) -> Just t
where
- summary `matches` Target (TargetModule m) _ _
- = ms_mod_name summary == m
- summary `matches` Target (TargetFile f _) _ _
+ summary `matches` Target { targetId = TargetModule m, targetUnitId = unitId }
+ = ms_mod_name summary == m && ms_unitid summary == unitId
+ summary `matches` Target { targetId = TargetFile f _, targetUnitId = unitid }
| Just f' <- ml_hs_file (ms_location summary)
- = f == f'
+ = f == f' && ms_unitid summary == unitid
_ `matches` _
= False
diff --git a/ghc/GHCi/UI.hs b/ghc/GHCi/UI.hs
index f698b5abed..a028f4e479 100644
--- a/ghc/GHCi/UI.hs
+++ b/ghc/GHCi/UI.hs
@@ -1674,7 +1674,7 @@ chooseEditFile =
Just file -> return file
Nothing -> throwGhcException (CmdLineError "No files to edit.")
- where fromTarget (GHC.Target (GHC.TargetFile f _) _ _) = Just f
+ where fromTarget GHC.Target { targetId = GHC.TargetFile f _ } = Just f
fromTarget _ = Nothing -- when would we get a module target?
@@ -1949,7 +1949,7 @@ loadModule' files = do
let (filenames, phases) = unzip files
exp_filenames <- mapM expandPath filenames
let files' = zip exp_filenames phases
- targets <- mapM (uncurry GHC.guessTarget) files'
+ targets <- mapM (\(file, phase) -> GHC.guessTarget file Nothing phase) files'
-- NOTE: we used to do the dependency anal first, so that if it
-- fails we didn't throw away the current set of modules. This would
@@ -1983,17 +1983,17 @@ addModule :: GhciMonad m => [FilePath] -> m ()
addModule files = do
revertCAFs -- always revert CAFs on load/add.
files' <- mapM expandPath files
- targets <- mapM (\m -> GHC.guessTarget m Nothing) files'
+ targets <- mapM (\m -> GHC.guessTarget m Nothing Nothing) files'
targets' <- filterM checkTarget targets
-- remove old targets with the same id; e.g. for :add *M
- mapM_ GHC.removeTarget [ tid | Target tid _ _ <- targets' ]
+ mapM_ GHC.removeTarget [ tid | Target { targetId = tid } <- targets' ]
mapM_ GHC.addTarget targets'
_ <- doLoadAndCollectInfo False LoadAllTargets
return ()
where
checkTarget :: GHC.GhcMonad m => Target -> m Bool
- checkTarget (Target (TargetModule m) _ _) = checkTargetModule m
- checkTarget (Target (TargetFile f _) _ _) = liftIO $ checkTargetFile f
+ checkTarget Target { targetId = TargetModule m } = checkTargetModule m
+ checkTarget Target { targetId = TargetFile f _ } = liftIO $ checkTargetFile f
checkTargetModule :: GHC.GhcMonad m => ModuleName -> m Bool
checkTargetModule m = do
@@ -2019,8 +2019,8 @@ addModule files = do
unAddModule :: GhciMonad m => [FilePath] -> m ()
unAddModule files = do
files' <- mapM expandPath files
- targets <- mapM (\m -> GHC.guessTarget m Nothing) files'
- mapM_ GHC.removeTarget [ tid | Target tid _ _ <- targets ]
+ targets <- mapM (\m -> GHC.guessTarget m Nothing Nothing) files'
+ mapM_ GHC.removeTarget [ tid | Target { targetId = tid } <- targets ]
_ <- doLoadAndCollectInfo False LoadAllTargets
return ()
@@ -2112,9 +2112,9 @@ setContextAfterLoad keep_ctxt ms = do
[] -> Nothing
(m:_) -> Just m
- summary `matches` Target (TargetModule m) _ _
+ summary `matches` Target { targetId = TargetModule m }
= GHC.ms_mod_name summary == m
- summary `matches` Target (TargetFile f _) _ _
+ summary `matches` Target { targetId = TargetFile f _ }
| Just f' <- GHC.ml_hs_file (GHC.ms_location summary) = f == f'
_ `matches` _
= False
@@ -3384,8 +3384,8 @@ showTargets :: GHC.GhcMonad m => m ()
showTargets = mapM_ showTarget =<< GHC.getTargets
where
showTarget :: GHC.GhcMonad m => Target -> m ()
- showTarget (Target (TargetFile f _) _ _) = liftIO (putStrLn f)
- showTarget (Target (TargetModule m) _ _) =
+ showTarget Target { targetId = TargetFile f _ } = liftIO (putStrLn f)
+ showTarget Target { targetId = TargetModule m } =
liftIO (putStrLn $ moduleNameString m)
-- -----------------------------------------------------------------------------
diff --git a/ghc/GHCi/UI/Info.hs b/ghc/GHCi/UI/Info.hs
index 144ebc4a78..db09243967 100644
--- a/ghc/GHCi/UI/Info.hs
+++ b/ghc/GHCi/UI/Info.hs
@@ -237,7 +237,7 @@ findType infos span0 string = do
guessModule :: GhcMonad m
=> Map ModuleName ModInfo -> FilePath -> MaybeT m ModuleName
guessModule infos fp = do
- target <- lift $ guessTarget fp Nothing
+ target <- lift $ guessTarget fp Nothing Nothing
case targetId target of
TargetModule mn -> return mn
TargetFile fp' _ -> guessModule' fp'
@@ -248,7 +248,7 @@ guessModule infos fp = do
Nothing -> do
fp'' <- liftIO (makeRelativeToCurrentDirectory fp')
- target' <- lift $ guessTarget fp'' Nothing
+ target' <- lift $ guessTarget fp'' Nothing Nothing
case targetId target' of
TargetModule mn -> return mn
_ -> MaybeT . pure $ findModByFp fp''
diff --git a/ghc/Main.hs b/ghc/Main.hs
index 00aeaf5028..9da5469b8a 100644
--- a/ghc/Main.hs
+++ b/ghc/Main.hs
@@ -676,7 +676,7 @@ doMake srcs = do
++ ldInputs dflags }
_ <- GHC.setSessionDynFlags dflags'
- targets <- mapM (uncurry GHC.guessTarget) hs_srcs
+ targets <- mapM (\(src, phase) -> GHC.guessTarget src Nothing phase) hs_srcs
GHC.setTargets targets
ok_flag <- GHC.load LoadAllTargets
diff --git a/testsuite/tests/annotations/should_run/annrun01.hs b/testsuite/tests/annotations/should_run/annrun01.hs
index a18f662ebb..65eec75bee 100644
--- a/testsuite/tests/annotations/should_run/annrun01.hs
+++ b/testsuite/tests/annotations/should_run/annrun01.hs
@@ -28,7 +28,7 @@ main = defaultErrorHandler defaultFatalMessager defaultFlushOut
let mod_nm = mkModuleName "Annrun01_Help"
liftIO $ putStrLn "Setting Target"
- setTargets [Target (TargetModule mod_nm) True Nothing]
+ setTargets [Target (TargetModule mod_nm) True (homeUnitId_ dflags) Nothing]
liftIO $ putStrLn "Loading Targets"
load LoadAllTargets
diff --git a/testsuite/tests/ghc-api/T10052/T10052.hs b/testsuite/tests/ghc-api/T10052/T10052.hs
index f579c0641d..2b82a41c15 100644
--- a/testsuite/tests/ghc-api/T10052/T10052.hs
+++ b/testsuite/tests/ghc-api/T10052/T10052.hs
@@ -9,7 +9,8 @@ main :: IO ()
main = do
flags <- getArgs
runGhc' flags $ do
- setTargets [Target (TargetFile "T10052-input.hs" Nothing) True Nothing]
+ dflags <- getSessionDynFlags
+ setTargets [Target (TargetFile "T10052-input.hs" Nothing) True (homeUnitId_ dflags) Nothing]
_success <- load LoadAllTargets
return ()
diff --git a/testsuite/tests/ghc-api/T4891/T4891.hs b/testsuite/tests/ghc-api/T4891/T4891.hs
index 4ae055daa4..82981a9e82 100644
--- a/testsuite/tests/ghc-api/T4891/T4891.hs
+++ b/testsuite/tests/ghc-api/T4891/T4891.hs
@@ -35,7 +35,7 @@ doit = do
dflags' <- getSessionDynFlags
primPackages <- setSessionDynFlags dflags'
dflags <- getSessionDynFlags
- target <- guessTarget "X.hs" Nothing
+ target <- guessTarget "X.hs" Nothing Nothing
setTargets [target]
load LoadAllTargets
diff --git a/testsuite/tests/ghc-api/T6145.hs b/testsuite/tests/ghc-api/T6145.hs
index ae0bca225d..3d929c8c9d 100644
--- a/testsuite/tests/ghc-api/T6145.hs
+++ b/testsuite/tests/ghc-api/T6145.hs
@@ -21,7 +21,10 @@ main = do
dflags <- getSessionDynFlags
setSessionDynFlags dflags
let mn =mkModuleName "Test"
- addTarget Target { targetId = TargetModule mn, targetAllowObjCode = True, targetContents = Nothing }
+ addTarget Target { targetId = TargetModule mn
+ , targetAllowObjCode = True
+ , targetUnitId = homeUnitId_ dflags
+ , targetContents = Nothing}
load LoadAllTargets
modSum <- getModSummary mn
p <- parseModule modSum
diff --git a/testsuite/tests/ghc-api/T7478/T7478.hs b/testsuite/tests/ghc-api/T7478/T7478.hs
index ce33e50dae..87739ec110 100644
--- a/testsuite/tests/ghc-api/T7478/T7478.hs
+++ b/testsuite/tests/ghc-api/T7478/T7478.hs
@@ -27,17 +27,18 @@ compileInGhc targets handlerOutput = do
-- Set up targets.
oldTargets <- getTargets
let oldFiles = map fileFromTarget oldTargets
- mapM_ addSingle (targets \\ oldFiles)
+ mapM_ (\filename -> addSingle filename (homeUnitId_ flags)) (targets \\ oldFiles)
mapM_ (removeTarget . targetIdFromFile) $ oldFiles \\ targets
-- Load modules to typecheck
void $ load LoadAllTargets
where
targetIdFromFile file = TargetFile file Nothing
- addSingle filename =
+ addSingle filename unitId =
addTarget Target
{ targetId = targetIdFromFile filename
, targetAllowObjCode = True
+ , targetUnitId = unitId
, targetContents = Nothing
}
diff --git a/testsuite/tests/ghc-api/T8639_api.hs b/testsuite/tests/ghc-api/T8639_api.hs
index 9c3fa3b7ab..e74b994a27 100644
--- a/testsuite/tests/ghc-api/T8639_api.hs
+++ b/testsuite/tests/ghc-api/T8639_api.hs
@@ -12,7 +12,7 @@ main
; runGhc (Just libdir) $ do
flags <- getSessionDynFlags
setSessionDynFlags (flags{ backend = Interpreter, ghcLink = LinkInMemory})
- target <- guessTarget "T8639_api_a.hs" Nothing
+ target <- guessTarget "T8639_api_a.hs" Nothing Nothing
setTargets [target]
load LoadAllTargets
imps <- mapM parseImportDecl ["import Prelude", "import System.IO", "import T8639_api_a"]
diff --git a/testsuite/tests/ghc-api/annotations-literals/literals.hs b/testsuite/tests/ghc-api/annotations-literals/literals.hs
index c216513a90..e2c21b5269 100644
--- a/testsuite/tests/ghc-api/annotations-literals/literals.hs
+++ b/testsuite/tests/ghc-api/annotations-literals/literals.hs
@@ -29,6 +29,7 @@ testOneFile libdir fileName = do
let mn =mkModuleName fileName
addTarget Target { targetId = TargetModule mn
, targetAllowObjCode = True
+ , targetUnitId = homeUnitId_ dflags
, targetContents = Nothing }
load LoadAllTargets
modSum <- getModSummary mn
diff --git a/testsuite/tests/ghc-api/annotations-literals/parsed.hs b/testsuite/tests/ghc-api/annotations-literals/parsed.hs
index a97a067ce5..06fa9ea60d 100644
--- a/testsuite/tests/ghc-api/annotations-literals/parsed.hs
+++ b/testsuite/tests/ghc-api/annotations-literals/parsed.hs
@@ -31,6 +31,7 @@ testOneFile libdir fileName = do
let mn =mkModuleName fileName
addTarget Target { targetId = TargetModule mn
, targetAllowObjCode = True
+ , targetUnitId = homeUnitId_ dflags
, targetContents = Nothing }
load LoadAllTargets
modSum <- getModSummary mn
diff --git a/testsuite/tests/ghc-api/apirecomp001/myghc.hs b/testsuite/tests/ghc-api/apirecomp001/myghc.hs
index 76dd6511ba..3d2cb9c238 100644
--- a/testsuite/tests/ghc-api/apirecomp001/myghc.hs
+++ b/testsuite/tests/ghc-api/apirecomp001/myghc.hs
@@ -30,7 +30,7 @@ main = do
, ghcLink = LinkInMemory
, verbosity = 0 -- silence please
}
- root_mod <- guessTarget "A.hs" Nothing
+ root_mod <- guessTarget "A.hs" Nothing Nothing
setTargets [root_mod]
ok <- load LoadAllTargets
when (failed ok) $ error "Couldn't load A.hs in nothing mode"
diff --git a/testsuite/tests/ghc-api/downsweep/OldModLocation.hs b/testsuite/tests/ghc-api/downsweep/OldModLocation.hs
index 122fdfd1c4..ca1740358f 100644
--- a/testsuite/tests/ghc-api/downsweep/OldModLocation.hs
+++ b/testsuite/tests/ghc-api/downsweep/OldModLocation.hs
@@ -40,7 +40,7 @@ main = do
]
]
- tgt <- guessTarget "A" Nothing
+ tgt <- guessTarget "A" Nothing Nothing
setTargets [tgt]
hsc_env <- getSession
diff --git a/testsuite/tests/ghc-api/downsweep/PartialDownsweep.hs b/testsuite/tests/ghc-api/downsweep/PartialDownsweep.hs
index bd6849a192..7a0a3ccf8d 100644
--- a/testsuite/tests/ghc-api/downsweep/PartialDownsweep.hs
+++ b/testsuite/tests/ghc-api/downsweep/PartialDownsweep.hs
@@ -162,7 +162,7 @@ go label mods cnd =
liftIO $ mapM_ writeMod mods
- tgt <- guessTarget "A" Nothing
+ tgt <- guessTarget "A" Nothing Nothing
setTargets [tgt]
diff --git a/testsuite/tests/ghc-api/target-contents/TargetContents.hs b/testsuite/tests/ghc-api/target-contents/TargetContents.hs
index e6be1befd5..685e799fc6 100644
--- a/testsuite/tests/ghc-api/target-contents/TargetContents.hs
+++ b/testsuite/tests/ghc-api/target-contents/TargetContents.hs
@@ -119,11 +119,13 @@ go label targets mods = do
where
mkTarget t mod@(name,_,_,_,sync) = do
src <- liftIO $ genMod mod
+ dflags <- getSessionDynFlags
return $ if not (name `elem` targets)
then Nothing
else Just $ Target
{ targetId = TargetFile (name++".hs") Nothing
, targetAllowObjCode = False
+ , targetUnitId = homeUnitId_ dflags
, targetContents =
case sync of
OnDisk -> Nothing
diff --git a/testsuite/tests/ghci/linking/dyn/T3372.hs b/testsuite/tests/ghci/linking/dyn/T3372.hs
index f128c9bb45..e49e0a1672 100644
--- a/testsuite/tests/ghci/linking/dyn/T3372.hs
+++ b/testsuite/tests/ghci/linking/dyn/T3372.hs
@@ -27,7 +27,7 @@ main = do let test1 = "TestMain1.hs"
line "2" $ runInServer ghc_2 $ load (test2, "Main")
line "3" $ runInServer ghc_1 $ eval "test1"
line "4" $ runInServer ghc_2 $ eval "test2"
- where line n a = putStr (n ++ ": ") >> a
+ where line n a = putStr (n ++ ": ") >> a
type ModuleName = String
type GhcServerHandle = Chan (Ghc ())
@@ -37,7 +37,7 @@ newGhcServer = do (libdir:_) <- getArgs
pChan <- newChan
let be_a_server = forever $ join (GHC.liftIO $ readChan pChan)
forkIO $ ghc be_a_server libdir
- return pChan
+ return pChan
where ghc action libdir = GHC.runGhc (Just libdir) (init >> action)
init = do df <- GHC.getSessionDynFlags
GHC.setSessionDynFlags df{GHC.ghcMode = GHC.CompManager,
@@ -51,7 +51,7 @@ runInServer h action = do me <- newChan
readChan me
load :: (FilePath,ModuleName) -> Ghc ()
-load (f,mn) = do target <- GHC.guessTarget f Nothing
+load (f,mn) = do target <- GHC.guessTarget f Nothing Nothing
GHC.setTargets [target]
res <- GHC.load GHC.LoadAllTargets
GHC.liftIO $ putStrLn ("Load " ++ showSuccessFlag res)
diff --git a/testsuite/tests/plugins/FrontendPlugin.hs b/testsuite/tests/plugins/FrontendPlugin.hs
index 7d5ed905e8..531c041f31 100644
--- a/testsuite/tests/plugins/FrontendPlugin.hs
+++ b/testsuite/tests/plugins/FrontendPlugin.hs
@@ -45,7 +45,7 @@ doMake opts srcs = do
++ ldInputs dflags }
_ <- GHC.setSessionDynFlags dflags'
- targets <- mapM (uncurry GHC.guessTarget) hs_srcs
+ targets <- mapM (\(src, phase) -> GHC.guessTarget src Nothing phase) hs_srcs
GHC.setTargets targets
ok_flag <- GHC.load LoadAllTargets
diff --git a/testsuite/tests/plugins/static-plugins.hs b/testsuite/tests/plugins/static-plugins.hs
index 5a4fe7d94c..b263c01b1d 100644
--- a/testsuite/tests/plugins/static-plugins.hs
+++ b/testsuite/tests/plugins/static-plugins.hs
@@ -65,7 +65,7 @@ main = do
GHC.setTargets []
_ <- GHC.load LoadAllTargets
- target <- guessTarget "static-plugins-module.hs" Nothing
+ target <- guessTarget "static-plugins-module.hs" Nothing Nothing
setTargets [target]
modifySession (\hsc_env -> hsc_env { hsc_static_plugins = the_plugins})
diff --git a/testsuite/tests/quasiquotation/T7918.hs b/testsuite/tests/quasiquotation/T7918.hs
index 74cd57ee0f..793398b845 100644
--- a/testsuite/tests/quasiquotation/T7918.hs
+++ b/testsuite/tests/quasiquotation/T7918.hs
@@ -66,6 +66,7 @@ test7918 = do
let target = Target {
targetId = TargetFile "T7918B.hs" Nothing
, targetAllowObjCode = True
+ , targetUnitId = homeUnitId_ dynFlags
, targetContents = Nothing
}
setTargets [target]
diff --git a/utils/check-exact/Main.hs b/utils/check-exact/Main.hs
index 48b9da62c4..1a3a5f2bf6 100644
--- a/utils/check-exact/Main.hs
+++ b/utils/check-exact/Main.hs
@@ -338,6 +338,7 @@ parseOneFile libdir fileName = do
let dflags2 = dflags `gopt_set` Opt_KeepRawTokenStream
_ <- setSessionDynFlags dflags2
addTarget Target { targetId = TargetFile fileName Nothing
+ , targetUnitId = homeUnitId_ dflags
, targetAllowObjCode = True
, targetContents = Nothing }
_ <- load LoadAllTargets
diff --git a/utils/check-ppr/Main.hs b/utils/check-ppr/Main.hs
index 0973d2ccfe..9cc921c404 100644
--- a/utils/check-ppr/Main.hs
+++ b/utils/check-ppr/Main.hs
@@ -87,6 +87,7 @@ parseOneFile libdir fileName = do
_ <- setSessionDynFlags dflags2
addTarget Target { targetId = TargetFile fileName Nothing
, targetAllowObjCode = True
+ , targetUnitId = homeUnitId_ dflags
, targetContents = Nothing }
_ <- load LoadAllTargets
graph <- getModuleGraph
diff --git a/utils/haddock b/utils/haddock
-Subproject 3699d74aac686c1e071ab050456698ff2ea8c7d
+Subproject 7afbc6b0af2c350a96c56237f3c2d3f3de20419