Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
-
b26bb2ea
by VeryMilkyJoe at 2026-03-27T04:41:38-04:00
5 changed files:
- compiler/GHC.hs
- compiler/GHC/CoreToStg/AddImplicitBinds.hs
- compiler/GHC/Unit/Module/Location.hs
- testsuite/tests/ghc-api/fixed-nodes/FixedNodes.hs
- testsuite/tests/ghc-api/fixed-nodes/ModuleGraphInvariants.hs
Changes:
| ... | ... | @@ -79,7 +79,13 @@ module GHC ( |
| 79 | 79 | ModuleGraph, emptyMG, mapMG, mkModuleGraph, mgModSummaries,
|
| 80 | 80 | mgLookupModule,
|
| 81 | 81 | ModSummary(..), ms_mod_name, ModLocation(..),
|
| 82 | - pattern ModLocation,
|
|
| 82 | + ml_hs_file,
|
|
| 83 | + ml_hi_file,
|
|
| 84 | + ml_dyn_hi_file,
|
|
| 85 | + ml_obj_file,
|
|
| 86 | + ml_dyn_obj_file,
|
|
| 87 | + ml_hie_file,
|
|
| 88 | + ml_bytecode_file,
|
|
| 83 | 89 | getModSummary,
|
| 84 | 90 | getModuleGraph,
|
| 85 | 91 | isLoaded,
|
| ... | ... | @@ -1575,7 +1581,7 @@ pprParenSymName a = parenSymOcc (getOccName a) (ppr (getName a)) |
| 1575 | 1581 | -- a module by using 'getModSummary'
|
| 1576 | 1582 | --
|
| 1577 | 1583 | -- XXX: Explain pre-conditions
|
| 1578 | -getModuleSourceAndFlags :: ModSummary -> IO (String, StringBuffer, DynFlags)
|
|
| 1584 | +getModuleSourceAndFlags :: ModSummary -> IO (FilePath, StringBuffer, DynFlags)
|
|
| 1579 | 1585 | getModuleSourceAndFlags m = do
|
| 1580 | 1586 | case ml_hs_file $ ms_location m of
|
| 1581 | 1587 | Nothing -> throwIO $ mkApiErr (ms_hspp_opts m) (text "No source available for module " <+> ppr (ms_mod m))
|
| ... | ... | @@ -10,7 +10,7 @@ import GHC.Prelude |
| 10 | 10 | |
| 11 | 11 | import GHC.CoreToStg.Prep( CorePrepPgmConfig(..) )
|
| 12 | 12 | |
| 13 | -import GHC.Unit( ModLocation(..) )
|
|
| 13 | +import GHC.Unit( ModLocation(..), ml_hs_file )
|
|
| 14 | 14 | |
| 15 | 15 | import GHC.Core
|
| 16 | 16 | import GHC.Core.DataCon( DataCon, dataConWorkId, dataConWrapId )
|
| ... | ... | @@ -2,22 +2,19 @@ |
| 2 | 2 | {-# LANGUAGE ViewPatterns #-}
|
| 3 | 3 | -- | Module location
|
| 4 | 4 | module GHC.Unit.Module.Location
|
| 5 | - ( ModLocation
|
|
| 6 | - ( ..
|
|
| 7 | - , ml_hs_file
|
|
| 8 | - , ml_hi_file
|
|
| 9 | - , ml_dyn_hi_file
|
|
| 10 | - , ml_obj_file
|
|
| 11 | - , ml_dyn_obj_file
|
|
| 12 | - , ml_hie_file
|
|
| 13 | - , ml_bytecode_file
|
|
| 14 | - )
|
|
| 15 | - , pattern ModLocation
|
|
| 5 | + ( ModLocation(..)
|
|
| 16 | 6 | , addBootSuffix
|
| 17 | 7 | , addBootSuffixLocn
|
| 18 | 8 | , addBootSuffixLocnOut
|
| 19 | 9 | , removeBootSuffix
|
| 20 | 10 | , mkFileSrcSpan
|
| 11 | + , ml_hs_file
|
|
| 12 | + , ml_hi_file
|
|
| 13 | + , ml_dyn_hi_file
|
|
| 14 | + , ml_obj_file
|
|
| 15 | + , ml_dyn_obj_file
|
|
| 16 | + , ml_hie_file
|
|
| 17 | + , ml_bytecode_file
|
|
| 21 | 18 | )
|
| 22 | 19 | where
|
| 23 | 20 | |
| ... | ... | @@ -128,33 +125,30 @@ mkFileSrcSpan mod_loc |
| 128 | 125 | -- Helpers for backwards compatibility
|
| 129 | 126 | -- ----------------------------------------------------------------------------
|
| 130 | 127 | |
| 131 | -{-# COMPLETE ModLocation #-}
|
|
| 132 | - |
|
| 133 | -pattern ModLocation :: Maybe FilePath -> FilePath -> FilePath -> FilePath -> FilePath -> FilePath -> FilePath -> ModLocation
|
|
| 134 | -pattern ModLocation
|
|
| 135 | - { ml_hs_file
|
|
| 136 | - , ml_hi_file
|
|
| 137 | - , ml_dyn_hi_file
|
|
| 138 | - , ml_obj_file
|
|
| 139 | - , ml_dyn_obj_file
|
|
| 140 | - , ml_hie_file
|
|
| 141 | - , ml_bytecode_file
|
|
| 142 | - } <- OsPathModLocation
|
|
| 143 | - { ml_hs_file_ospath = (fmap unsafeDecodeUtf -> ml_hs_file)
|
|
| 144 | - , ml_hi_file_ospath = (unsafeDecodeUtf -> ml_hi_file)
|
|
| 145 | - , ml_dyn_hi_file_ospath = (unsafeDecodeUtf -> ml_dyn_hi_file)
|
|
| 146 | - , ml_obj_file_ospath = (unsafeDecodeUtf -> ml_obj_file)
|
|
| 147 | - , ml_dyn_obj_file_ospath = (unsafeDecodeUtf -> ml_dyn_obj_file)
|
|
| 148 | - , ml_hie_file_ospath = (unsafeDecodeUtf -> ml_hie_file)
|
|
| 149 | - , ml_bytecode_file_ospath = (unsafeDecodeUtf -> ml_bytecode_file)
|
|
| 150 | - } where
|
|
| 151 | - ModLocation ml_hs_file ml_hi_file ml_dyn_hi_file ml_obj_file ml_dyn_obj_file ml_hie_file ml_bytecode_file
|
|
| 152 | - = OsPathModLocation
|
|
| 153 | - { ml_hs_file_ospath = fmap unsafeEncodeUtf ml_hs_file
|
|
| 154 | - , ml_hi_file_ospath = unsafeEncodeUtf ml_hi_file
|
|
| 155 | - , ml_dyn_hi_file_ospath = unsafeEncodeUtf ml_dyn_hi_file
|
|
| 156 | - , ml_obj_file_ospath = unsafeEncodeUtf ml_obj_file
|
|
| 157 | - , ml_dyn_obj_file_ospath = unsafeEncodeUtf ml_dyn_obj_file
|
|
| 158 | - , ml_hie_file_ospath = unsafeEncodeUtf ml_hie_file
|
|
| 159 | - , ml_bytecode_file_ospath = unsafeEncodeUtf ml_bytecode_file
|
|
| 160 | - } |
|
| 128 | +ml_hs_file :: ModLocation -> Maybe FilePath
|
|
| 129 | +{-# INLINE ml_hs_file #-}
|
|
| 130 | +ml_hs_file = fmap unsafeDecodeUtf . ml_hs_file_ospath
|
|
| 131 | + |
|
| 132 | +ml_hi_file :: ModLocation -> FilePath
|
|
| 133 | +{-# INLINE ml_hi_file #-}
|
|
| 134 | +ml_hi_file = unsafeDecodeUtf . ml_hi_file_ospath
|
|
| 135 | + |
|
| 136 | +ml_dyn_hi_file :: ModLocation -> FilePath
|
|
| 137 | +{-# INLINE ml_dyn_hi_file #-}
|
|
| 138 | +ml_dyn_hi_file = unsafeDecodeUtf . ml_dyn_hi_file_ospath
|
|
| 139 | + |
|
| 140 | +ml_obj_file :: ModLocation -> FilePath
|
|
| 141 | +{-# INLINE ml_obj_file #-}
|
|
| 142 | +ml_obj_file = unsafeDecodeUtf . ml_obj_file_ospath
|
|
| 143 | + |
|
| 144 | +ml_dyn_obj_file :: ModLocation -> FilePath
|
|
| 145 | +{-# INLINE ml_dyn_obj_file #-}
|
|
| 146 | +ml_dyn_obj_file = unsafeDecodeUtf . ml_dyn_obj_file_ospath
|
|
| 147 | + |
|
| 148 | +ml_hie_file :: ModLocation -> FilePath
|
|
| 149 | +{-# INLINE ml_hie_file #-}
|
|
| 150 | +ml_hie_file = unsafeDecodeUtf . ml_hie_file_ospath
|
|
| 151 | + |
|
| 152 | +ml_bytecode_file :: ModLocation -> FilePath
|
|
| 153 | +{-# INLINE ml_bytecode_file #-}
|
|
| 154 | +ml_bytecode_file = unsafeDecodeUtf . ml_bytecode_file_ospath |
| ... | ... | @@ -31,7 +31,7 @@ convertToFixed (ModuleNodeCompile ms) = |
| 31 | 31 | -- with the module summary information
|
| 32 | 32 | let modName = ms_mod_name ms
|
| 33 | 33 | modLoc = ms_location ms
|
| 34 | - in ModuleNodeFixed (msKey ms) (ms_location ms) { ml_hs_file = Nothing}
|
|
| 34 | + in ModuleNodeFixed (msKey ms) (ms_location ms) { ml_hs_file_ospath = Nothing }
|
|
| 35 | 35 | |
| 36 | 36 | |
| 37 | 37 | -- | Load a module graph and report the result
|
| ... | ... | @@ -29,7 +29,7 @@ convertToFixed :: ModuleNodeInfo -> ModuleNodeInfo |
| 29 | 29 | convertToFixed (ModuleNodeCompile ms) =
|
| 30 | 30 | let modName = ms_mod_name ms
|
| 31 | 31 | modLoc = ms_location ms
|
| 32 | - in ModuleNodeFixed (msKey ms) (ms_location ms) { ml_hs_file = Nothing}
|
|
| 32 | + in ModuleNodeFixed (msKey ms) (ms_location ms) { ml_hs_file_ospath = Nothing }
|
|
| 33 | 33 | |
| 34 | 34 | -- | Test a module graph and report if it matches expected invariant violations
|
| 35 | 35 | testModuleGraph :: String -> ModuleGraph -> [ModuleGraphInvariantError] -> Ghc ()
|