summaryrefslogtreecommitdiff
path: root/compiler/GHC/Unit
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2021-01-22 18:20:15 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-01-29 04:04:12 -0500
commit18e106a8dfdae50c3078558382209f53794a8c97 (patch)
tree6f9e10dbfc50a977bbb82ecf31a75e1a12aa8d1c /compiler/GHC/Unit
parent6fc920847f65e9b9f347bde42b2f9ec624468cfd (diff)
downloadhaskell-18e106a8dfdae50c3078558382209f53794a8c97.tar.gz
Add missing .hi-boot dependencies with ghc -M (#14482)
Diffstat (limited to 'compiler/GHC/Unit')
-rw-r--r--compiler/GHC/Unit/Module/Location.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/GHC/Unit/Module/Location.hs b/compiler/GHC/Unit/Module/Location.hs
index 6f239227f0..ff5354bfdb 100644
--- a/compiler/GHC/Unit/Module/Location.hs
+++ b/compiler/GHC/Unit/Module/Location.hs
@@ -5,6 +5,7 @@ module GHC.Unit.Module.Location
, addBootSuffix_maybe
, addBootSuffixLocn
, addBootSuffixLocnOut
+ , removeBootSuffix
)
where
@@ -54,6 +55,13 @@ instance Outputable ModLocation where
addBootSuffix :: FilePath -> FilePath
addBootSuffix path = path ++ "-boot"
+-- | Remove the @-boot@ suffix to .hs, .hi and .o files
+removeBootSuffix :: FilePath -> FilePath
+removeBootSuffix "-boot" = []
+removeBootSuffix (x:xs) = x : removeBootSuffix xs
+removeBootSuffix [] = error "removeBootSuffix: no -boot suffix"
+
+
-- | Add the @-boot@ suffix if the @Bool@ argument is @True@
addBootSuffix_maybe :: IsBootInterface -> FilePath -> FilePath
addBootSuffix_maybe is_boot path = case is_boot of