X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Fiface%2FMkIface.lhs;h=f76ac41773eeb83da6778e3ce73f9a547ff76d3a;hb=0f800dc9f3dc695cd06d0fdd7799a52c37241752;hp=5c32a291fe31e926c17c7dcfbf2dfdfc05e44e8e;hpb=0c53bd0e1b02dea0bde32cd7eb8ccb5ee2d3719e;p=ghc-hetmet.git diff --git a/ghc/compiler/iface/MkIface.lhs b/ghc/compiler/iface/MkIface.lhs index 5c32a29..f76ac41 100644 --- a/ghc/compiler/iface/MkIface.lhs +++ b/ghc/compiler/iface/MkIface.lhs @@ -185,7 +185,6 @@ import IfaceSyn ( IfaceDecl(..), IfaceClassOp(..), IfaceConDecl(..), import LoadIface ( readIface, loadInterface ) import BasicTypes ( Version, initialVersion, bumpVersion ) import TcRnMonad -import TcRnTypes ( mkModDeps ) import HscTypes ( ModIface(..), ModDetails(..), ModGuts(..), IfaceExport, HscEnv(..), hscEPS, Dependencies(..), FixItem(..), @@ -215,7 +214,7 @@ import OccName ( OccName, OccEnv, mkOccEnv, lookupOccEnv, emptyOccEnv, isEmptyOccSet, intersectOccSet, intersectsOccSet, occNameFS, isTcOcc ) import Module ( Module, moduleFS, - ModLocation(..), mkSysModuleFS, moduleUserString, + ModLocation(..), mkModuleFS, moduleString, ModuleEnv, emptyModuleEnv, lookupModuleEnv, extendModuleEnv_C ) @@ -235,7 +234,7 @@ import DATA_IOREF ( writeIORef ) import Monad ( when ) import List ( insert ) import Maybes ( orElse, mapCatMaybes, isNothing, isJust, - fromJust, expectJust, MaybeErr(..) ) + expectJust, MaybeErr(..) ) \end{code} @@ -322,7 +321,7 @@ mkIface hsc_env maybe_old_iface -- Debug printing ; when (isJust pp_orphs && dopt Opt_WarnOrphans dflags) - (printDump (fromJust pp_orphs)) + (printDump (expectJust "mkIface" pp_orphs)) ; when (dopt Opt_D_dump_hi_diffs dflags) (printDump pp_diffs) ; dumpIfSet_dyn dflags Opt_D_dump_hi "FINAL INTERFACE" (pprModIface new_iface) @@ -641,7 +640,7 @@ bump_unless False v = bumpVersion v \begin{code} mkUsageInfo :: HscEnv -> HomeModules - -> ModuleEnv (Module, Maybe Bool, SrcSpan) + -> ModuleEnv (Module, Bool, SrcSpan) -> [(Module, IsBootInterface)] -> NameSet -> IO [Usage] mkUsageInfo hsc_env hmods dir_imp_mods dep_mods used_names @@ -657,7 +656,6 @@ mk_usage_info pit hsc_env hmods dir_imp_mods dep_mods proto_used_names = mapCatMaybes mkUsage dep_mods -- ToDo: do we need to sort into canonical order? where - dflags = hsc_dflags hsc_env hpt = hsc_HPT hsc_env used_names = mkNameSet $ -- Eliminate duplicates @@ -677,9 +675,9 @@ mk_usage_info pit hsc_env hmods dir_imp_mods dep_mods proto_used_names mod = nameModule name add_item occs _ = occ:occs - import_all mod = case lookupModuleEnv dir_imp_mods mod of - Just (_,imp_all,_) -> isNothing imp_all - Nothing -> False + depend_on_exports mod = case lookupModuleEnv dir_imp_mods mod of + Just (_,no_imp,_) -> not no_imp + Nothing -> True -- We want to create a Usage for a home module if -- a) we used something from; has something in used_names @@ -692,7 +690,7 @@ mk_usage_info pit hsc_env hmods dir_imp_mods dep_mods proto_used_names | isNothing maybe_iface -- We can't depend on it if we didn't || not (isHomeModule hmods mod) -- even open the interface! || (null used_occs - && not all_imported + && isNothing export_vers && not orphan_mod) = Nothing -- Record no usage info @@ -713,9 +711,8 @@ mk_usage_info pit hsc_env hmods dir_imp_mods dep_mods proto_used_names version_env = mi_ver_fn iface mod_vers = mi_mod_vers iface rules_vers = mi_rule_vers iface - all_imported = import_all mod - export_vers | all_imported = Just (mi_exp_vers iface) - | otherwise = Nothing + export_vers | depend_on_exports mod = Just (mi_exp_vers iface) + | otherwise = Nothing -- The sort is to put them into canonical order used_occs = lookupModuleEnv ent_map mod `orElse` [] @@ -729,7 +726,7 @@ mkIfaceExports :: NameSet -> [(Module, [GenAvailInfo OccName])] -- Group by module and sort by occurrence -- This keeps the list in canonical order mkIfaceExports exports - = [ (mkSysModuleFS fs, eltsFM avails) + = [ (mkModuleFS fs, eltsFM avails) | (fs, avails) <- fmToList groupFM ] where @@ -771,7 +768,7 @@ checkOldIface :: HscEnv checkOldIface hsc_env mod_summary source_unchanged maybe_iface = do { showPass (hsc_dflags hsc_env) - ("Checking old interface for " ++ moduleUserString (ms_mod mod_summary)) ; + ("Checking old interface for " ++ moduleString (ms_mod mod_summary)) ; ; initIfaceCheck hsc_env $ check_old_iface mod_summary source_unchanged maybe_iface @@ -899,7 +896,7 @@ checkModUsage (Usage { usg_name = mod_name, usg_mod = old_mod_vers, -- CHECK EXPORT LIST if checkExportList maybe_old_export_vers new_export_vers then out_of_date_vers (ptext SLIT(" Export list changed")) - (fromJust maybe_old_export_vers) + (expectJust "checkModUsage" maybe_old_export_vers) new_export_vers else