summaryrefslogtreecommitdiff
path: root/compiler/iface/MkIface.lhs
diff options
context:
space:
mode:
authorDavid Terei <davidterei@gmail.com>2011-04-25 12:14:21 -0700
committerDavid Terei <davidterei@gmail.com>2011-06-17 18:19:48 -0700
commit6de1b0f2f4fe0455df72adb7b43449586b40ba89 (patch)
treef8ef6e2b5348103132fbe0a1d419947b0cc90792 /compiler/iface/MkIface.lhs
parentf8279ea9fef8c16782a3cd5bc81cf90de3e46cb5 (diff)
downloadhaskell-6de1b0f2f4fe0455df72adb7b43449586b40ba89.tar.gz
SafeHaskell: Add safe import flag (not functional)
Diffstat (limited to 'compiler/iface/MkIface.lhs')
-rw-r--r--compiler/iface/MkIface.lhs28
1 files changed, 17 insertions, 11 deletions
diff --git a/compiler/iface/MkIface.lhs b/compiler/iface/MkIface.lhs
index 9deceb53b9..6ff91919c9 100644
--- a/compiler/iface/MkIface.lhs
+++ b/compiler/iface/MkIface.lhs
@@ -873,7 +873,8 @@ mk_usage_info pit hsc_env this_mod direct_imports used_names
| modulePackageId mod /= this_pkg
= Just UsagePackageModule{ usg_mod = mod,
- usg_mod_hash = mod_hash }
+ usg_mod_hash = mod_hash,
+ usg_safe = imp_safe }
-- for package modules, we record the module hash only
| (null used_occs
@@ -888,22 +889,27 @@ mk_usage_info pit hsc_env this_mod direct_imports used_names
| otherwise
= Just UsageHomeModule {
usg_mod_name = moduleName mod,
- usg_mod_hash = mod_hash,
- usg_exports = export_hash,
- usg_entities = Map.toList ent_hashs }
+ usg_mod_hash = mod_hash,
+ usg_exports = export_hash,
+ usg_entities = Map.toList ent_hashs,
+ usg_safe = imp_safe }
where
- maybe_iface = lookupIfaceByModule dflags hpt pit mod
- -- In one-shot mode, the interfaces for home-package
- -- modules accumulate in the PIT not HPT. Sigh.
-
- is_direct_import = mod `elemModuleEnv` direct_imports
+ maybe_iface = lookupIfaceByModule dflags hpt pit mod
+ -- In one-shot mode, the interfaces for home-package
+ -- modules accumulate in the PIT not HPT. Sigh.
Just iface = maybe_iface
finsts_mod = mi_finsts iface
hash_env = mi_hash_fn iface
mod_hash = mi_mod_hash iface
export_hash | depend_on_exports = Just (mi_exp_hash iface)
- | otherwise = Nothing
+ | otherwise = Nothing
+
+ (is_direct_import, imp_safe)
+ = case lookupModuleEnv direct_imports mod of
+ Just ((_,_,_,safe):xs) -> (True, safe)
+ Just _ -> pprPanic "mkUsage: empty direct import" empty
+ Nothing -> (False, False)
used_occs = lookupModuleEnv ent_map mod `orElse` []
@@ -1158,7 +1164,7 @@ checkDependencies hsc_env summary iface
orM = foldr f (return False)
where f m rest = do b <- m; if b then return True else rest
- dep_missing (L _ (ImportDecl (L _ mod) pkg _ _ _ _)) = do
+ dep_missing (L _ (ImportDecl (L _ mod) pkg _ _ _ _ _)) = do
find_res <- liftIO $ findImportedModule hsc_env mod pkg
case find_res of
Found _ mod