Skip to content
Snippets Groups Projects
Commit ebc8a498 authored by Ryan Scott's avatar Ryan Scott
Browse files

Update ghcide-2.6.0.0 patch

This updates the patch to accommodate the following GHC commits:

* ghc@c5d89412

  This removes the `mi_globals` field in favor of `mi_top_env`.

* ghc@36aa7cf1

  This adds an additional `CompressionIFace` argument to the `writeIface` and
  `putWithUserData` functions.
parent 921fa269
No related branches found
No related tags found
No related merge requests found
......@@ -16,7 +16,7 @@ index b1bc9d4..0a94766 100644
home_unit_id <- uids
home_unit_env <- maybeToList $ unitEnv_lookup_maybe home_unit_id $ hsc_HUG hscEnv'
diff --git a/src/Development/IDE/Core/Compile.hs b/src/Development/IDE/Core/Compile.hs
index eba9cd6..8008537 100644
index eba9cd6..1955493 100644
--- a/src/Development/IDE/Core/Compile.hs
+++ b/src/Development/IDE/Core/Compile.hs
@@ -80,7 +80,7 @@ import Development.IDE.Core.Shake
......@@ -28,7 +28,56 @@ index eba9cd6..8008537 100644
import qualified Development.IDE.GHC.Compat as Compat
import qualified Development.IDE.GHC.Compat as GHC
import qualified Development.IDE.GHC.Compat.Util as Util
@@ -1748,19 +1748,19 @@ pathToModuleName = mkModuleName . map rep
@@ -487,7 +487,13 @@ mkHiFileResultNoCompile session tcm = do
Nothing
#endif
tcGblEnv
- let iface = iface' { mi_globals = Nothing, mi_usages = filterUsages (mi_usages iface') } -- See Note [Clearing mi_globals after generating an iface]
+ let iface = iface' { mi_usages = filterUsages (mi_usages iface')
+#if MIN_VERSION_ghc(9,11,0)
+ , mi_top_env = Nothing
+#else
+ , mi_globals = Nothing
+#endif
+ } -- See Note [Clearing mi_globals after generating an iface]
pure $! mkHiFileResult ms iface details (tmrRuntimeModules tcm) Nothing
mkHiFileResultCompile
@@ -514,6 +520,9 @@ mkHiFileResultCompile se session' tcm simplified_guts = catchErrs $ do
details
#if MIN_VERSION_ghc(9,3,0)
ms
+#endif
+#if MIN_VERSION_ghc(9,11,0)
+ (tcg_import_decls (tmrTypechecked tcm))
#endif
simplified_guts
@@ -521,7 +530,13 @@ mkHiFileResultCompile se session' tcm simplified_guts = catchErrs $ do
#if MIN_VERSION_ghc(9,4,2)
Nothing
#endif
- let final_iface = final_iface' {mi_globals = Nothing, mi_usages = filterUsages (mi_usages final_iface')} -- See Note [Clearing mi_globals after generating an iface]
+ let final_iface = final_iface' { mi_usages = filterUsages (mi_usages final_iface')
+#if MIN_VERSION_ghc(9,11,0)
+ , mi_top_env = Nothing
+#else
+ , mi_globals = Nothing
+#endif
+ } -- See Note [Clearing mi_globals after generating an iface]
-- Write the core file now
core_file <- do
@@ -529,7 +544,7 @@ mkHiFileResultCompile se session' tcm simplified_guts = catchErrs $ do
core_file = codeGutsToCoreFile iface_hash guts
iface_hash = getModuleHash final_iface
core_hash1 <- atomicFileWrite se core_fp $ \fp ->
- writeBinCoreFile fp core_file
+ writeBinCoreFile (hsc_dflags session) fp core_file
-- We want to drop references to guts and read in a serialized, compact version
-- of the core file from disk (as it is deserialised lazily)
-- This is because we don't want to keep the guts in memory for every file in
@@ -1748,19 +1763,19 @@ pathToModuleName = mkModuleName . map rep
- CPP clauses should be placed at the end of the imports section. The clauses
should be ordered by the GHC version they target from earlier to later versions,
......@@ -189,6 +238,59 @@ index caee9d5..11a4fb9 100644
unload :: HscEnv -> [Linkable] -> IO ()
unload hsc_env linkables =
diff --git a/src/Development/IDE/GHC/Compat/Iface.hs b/src/Development/IDE/GHC/Compat/Iface.hs
index d848083..60f73c0 100644
--- a/src/Development/IDE/GHC/Compat/Iface.hs
+++ b/src/Development/IDE/GHC/Compat/Iface.hs
@@ -26,7 +26,9 @@ import GHC.Driver.Session (targetProfile)
#endif
writeIfaceFile :: HscEnv -> FilePath -> ModIface -> IO ()
-#if MIN_VERSION_ghc(9,3,0)
+#if MIN_VERSION_ghc(9,11,0)
+writeIfaceFile env fp iface = Iface.writeIface (hsc_logger env) (targetProfile $ hsc_dflags env) (Iface.flagsToIfCompression $ hsc_dflags env) fp iface
+#elif MIN_VERSION_ghc(9,3,0)
writeIfaceFile env fp iface = Iface.writeIface (hsc_logger env) (targetProfile $ hsc_dflags env) fp iface
#else
writeIfaceFile env fp iface = Iface.writeIface (hsc_logger env) (hsc_dflags env) fp iface
diff --git a/src/Development/IDE/GHC/CoreFile.hs b/src/Development/IDE/GHC/CoreFile.hs
index 4fddbe7..804c6ac 100644
--- a/src/Development/IDE/GHC/CoreFile.hs
+++ b/src/Development/IDE/GHC/CoreFile.hs
@@ -31,6 +31,9 @@ import GHC.Core
import GHC.CoreToIface
import GHC.Iface.Binary
import GHC.Iface.Env
+#if MIN_VERSION_ghc(9,11,0)
+import qualified GHC.Iface.Load as Iface
+#endif
import GHC.Iface.Recomp.Binary (fingerprintBinMem)
import GHC.IfaceToCore
import GHC.Types.Id.Make
@@ -93,14 +96,20 @@ readBinCoreFile name_cache fat_hi_path = do
return (file, fp)
-- | Write a core file
-writeBinCoreFile :: FilePath -> CoreFile -> IO Fingerprint
-writeBinCoreFile core_path fat_iface = do
+writeBinCoreFile :: DynFlags -> FilePath -> CoreFile -> IO Fingerprint
+writeBinCoreFile _dflags core_path fat_iface = do
bh <- openBinMem initBinMemSize
let quietTrace =
QuietBinIFace
- putWithUserData quietTrace bh fat_iface
+ putWithUserData
+ quietTrace
+#if MIN_VERSION_ghc(9,11,0)
+ (Iface.flagsToIfCompression _dflags)
+#endif
+ bh
+ fat_iface
-- And send the result to the file
writeBinMem bh core_path
diff --git a/src/Development/IDE/GHC/Orphans.hs b/src/Development/IDE/GHC/Orphans.hs
index d8d16ca..61656e3 100644
--- a/src/Development/IDE/GHC/Orphans.hs
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment