[commit: ghc] master: Make `-ddump-minimal-imports` honour `-dumpdir` flag (a499ff7)

git at git.haskell.org git at git.haskell.org
Tue Aug 27 23:37:56 CEST 2013


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/a499ff73cdb27117f68f49c57c602febd09f9582/ghc

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

commit a499ff73cdb27117f68f49c57c602febd09f9582
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date:   Sun Aug 25 17:24:14 2013 +0200

    Make `-ddump-minimal-imports` honour `-dumpdir` flag
    
    The `-dumpdir` flag was added via 668c860b361f16 but failed to
    take care of `-ddump-minimal-imports`'s output.
    This commit makes up for that omission.
    
    This addresses #7957
    
    Signed-off-by: Herbert Valerio Riedel <hvr at gnu.org>


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

a499ff73cdb27117f68f49c57c602febd09f9582
 compiler/rename/RnNames.lhs |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/compiler/rename/RnNames.lhs b/compiler/rename/RnNames.lhs
index 203e1e2..cdd53d1 100644
--- a/compiler/rename/RnNames.lhs
+++ b/compiler/rename/RnNames.lhs
@@ -41,6 +41,7 @@ import Data.Map         ( Map )
 import qualified Data.Map as Map
 import Data.List        ( partition, (\\), find )
 import qualified Data.Set as Set
+import System.FilePath  ((</>))
 import System.IO
 \end{code}
 
@@ -1468,7 +1469,7 @@ printMinimalImports imports_w_usage
        ; this_mod <- getModule
        ; dflags   <- getDynFlags
        ; liftIO $
-         do { h <- openFile (mkFilename this_mod) WriteMode
+         do { h <- openFile (mkFilename dflags this_mod) WriteMode
             ; printForUser dflags h neverQualify (vcat (map ppr imports')) }
               -- The neverQualify is important.  We are printing Names
               -- but they are in the context of an 'import' decl, and
@@ -1477,7 +1478,11 @@ printMinimalImports imports_w_usage
               -- not    import Blag( Blag.f, Blag.g )!
        }
   where
-    mkFilename this_mod = moduleNameString (moduleName this_mod) ++ ".imports"
+    mkFilename dflags this_mod
+      | Just d <- dumpDir dflags = d </> basefn
+      | otherwise                = basefn
+      where
+        basefn = moduleNameString (moduleName this_mod) ++ ".imports"
 
     mk_minimal (L l decl, used, unused)
       | null unused





More information about the ghc-commits mailing list