diff options
author | Herbert Valerio Riedel <hvr@gnu.org> | 2013-08-25 17:24:14 +0200 |
---|---|---|
committer | Herbert Valerio Riedel <hvr@gnu.org> | 2013-08-27 22:58:36 +0200 |
commit | a499ff73cdb27117f68f49c57c602febd09f9582 (patch) | |
tree | 46032fb4c41d50a6b4bf4185bdd7861a7c67ecd1 | |
parent | b982ab40843f360fa12a638758ee91322526625d (diff) | |
download | haskell-a499ff73cdb27117f68f49c57c602febd09f9582.tar.gz |
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@gnu.org>
-rw-r--r-- | compiler/rename/RnNames.lhs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/compiler/rename/RnNames.lhs b/compiler/rename/RnNames.lhs index 203e1e271c..cdd53d199b 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 |