[commit: ghc] wip/merge: Filter input to abiHash early (4fab5c7)

git at git.haskell.org git at git.haskell.org
Wed Nov 19 22:45:08 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/merge
Link       : http://ghc.haskell.org/trac/ghc/changeset/4fab5c73061ea4395ac808de08c23adf2a3fb870/ghc

>---------------------------------------------------------------

commit 4fab5c73061ea4395ac808de08c23adf2a3fb870
Author: Mateusz Kowalczyk <fuuzetsu at fuuzetsu.co.uk>
Date:   Tue Nov 18 22:21:03 2014 -0600

    Filter input to abiHash early
    
    Summary:
    This is already done near the only call site so why not. It is ugly to
    see it at 'abiHash' itself.
    
    Test Plan: validate
    
    Reviewers: austin
    
    Reviewed By: austin
    
    Subscribers: thomie, carter
    
    Differential Revision: https://phabricator.haskell.org/D491


>---------------------------------------------------------------

4fab5c73061ea4395ac808de08c23adf2a3fb870
 ghc/Main.hs | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/ghc/Main.hs b/ghc/Main.hs
index c1ee247..4fd7803 100644
--- a/ghc/Main.hs
+++ b/ghc/Main.hs
@@ -236,7 +236,7 @@ main' postLoadMode dflags0 args flagWarnings = do
        StopBefore p           -> liftIO (oneShot hsc_env p srcs)
        DoInteractive          -> ghciUI srcs Nothing
        DoEval exprs           -> ghciUI srcs $ Just $ reverse exprs
-       DoAbiHash              -> abiHash srcs
+       DoAbiHash              -> abiHash (map fst srcs)
        ShowPackages           -> liftIO $ showPackages dflags6
 
   liftIO $ dumpFinalStats dflags6
@@ -798,7 +798,13 @@ the package chagnes, so during registration Cabal calls ghc --abi-hash
 to get a hash of the package's ABI.
 -}
 
-abiHash :: [(String, Maybe Phase)] -> Ghc ()
+-- | Print ABI hash of input modules.
+--
+-- The resulting hash is the MD5 of the GHC version used (Trac #5328,
+-- see 'hiVersion') and of the existing ABI hash from each module (see
+-- 'mi_mod_hash').
+abiHash :: [String] -- ^ List of module names
+        -> Ghc ()
 abiHash strs = do
   hsc_env <- getSession
   let dflags = hsc_dflags hsc_env
@@ -813,7 +819,7 @@ abiHash strs = do
            _error    -> throwGhcException $ CmdLineError $ showSDoc dflags $
                           cannotFindInterface dflags modname r
 
-  mods <- mapM find_it (map fst strs)
+  mods <- mapM find_it strs
 
   let get_iface modl = loadUserInterface False (text "abiHash") modl
   ifaces <- initIfaceCheck hsc_env $ mapM get_iface mods



More information about the ghc-commits mailing list