summaryrefslogtreecommitdiff
path: root/compiler/GHC/HsToCore/Usage.hs
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-05-07 20:04:44 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-06-13 02:13:02 -0400
commitf6be6e432e53108075905c1fc7785d8b1f18a33f (patch)
tree299c122f83b982f3edfd4b56bcf1967191e5cb48 /compiler/GHC/HsToCore/Usage.hs
parent8dc71f5577a541168951371bd55b51a588b57813 (diff)
downloadhaskell-f6be6e432e53108075905c1fc7785d8b1f18a33f.tar.gz
Add allowVirtualUnits field in PackageState
Instead of always querying DynFlags to know whether we are allowed to use virtual units (i.e. instantiated on-the-fly, cf Note [About units] in GHC.Unit), we store it once for all in `PackageState.allowVirtualUnits`. This avoids using DynFlags too much (cf #17957) and is preliminary work for #14335.
Diffstat (limited to 'compiler/GHC/HsToCore/Usage.hs')
-rw-r--r--compiler/GHC/HsToCore/Usage.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/GHC/HsToCore/Usage.hs b/compiler/GHC/HsToCore/Usage.hs
index 7a00d75b23..97ab4ba89a 100644
--- a/compiler/GHC/HsToCore/Usage.hs
+++ b/compiler/GHC/HsToCore/Usage.hs
@@ -169,7 +169,7 @@ One way to improve this is to either:
-}
mkPluginUsage :: HscEnv -> ModIface -> IO [Usage]
mkPluginUsage hsc_env pluginModule
- = case lookupPluginModuleWithSuggestions dflags pNm Nothing of
+ = case lookupPluginModuleWithSuggestions pkgs pNm Nothing of
LookupFound _ pkg -> do
-- The plugin is from an external package:
-- search for the library files containing the plugin.
@@ -215,6 +215,7 @@ mkPluginUsage hsc_env pluginModule
where
dflags = hsc_dflags hsc_env
platform = targetPlatform dflags
+ pkgs = pkgState dflags
pNm = moduleName $ mi_module pluginModule
pPkg = moduleUnit $ mi_module pluginModule
deps = map gwib_mod $