summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2012-10-17 01:10:49 +0100
committerIan Lynagh <igloo@earth.li>2012-10-17 01:47:02 +0100
commit51da4ee2401983359db9caad3902a98a8f505431 (patch)
treefbe27e603ba558f84d94cefaca4f14c9cd047348
parent6e771fa19dbb7edc116b5974124229a2725103e8 (diff)
downloadhaskell-51da4ee2401983359db9caad3902a98a8f505431.tar.gz
Put header and timestamp in dump files
-rw-r--r--compiler/main/ErrUtils.lhs14
1 files changed, 8 insertions, 6 deletions
diff --git a/compiler/main/ErrUtils.lhs b/compiler/main/ErrUtils.lhs
index b13cded064..7b1f55fb11 100644
--- a/compiler/main/ErrUtils.lhs
+++ b/compiler/main/ErrUtils.lhs
@@ -50,6 +50,7 @@ import Data.List
import qualified Data.Set as Set
import Data.IORef
import Data.Ord
+import Data.Time
import Control.Monad
import System.IO
@@ -232,9 +233,6 @@ dumpSDoc :: DynFlags -> GeneralFlag -> String -> SDoc -> IO ()
dumpSDoc dflags flag hdr doc
= do let mFile = chooseDumpFile dflags flag
case mFile of
- -- write the dump to a file
- -- don't add the header in this case, we can see what kind
- -- of dump it is from the filename.
Just fileName
-> do
let gdref = generatedDumps dflags
@@ -245,9 +243,13 @@ dumpSDoc dflags flag hdr doc
writeIORef gdref (Set.insert fileName gd)
createDirectoryIfMissing True (takeDirectory fileName)
handle <- openFile fileName mode
- let doc'
- | null hdr = doc
- | otherwise = doc $$ blankLine
+ doc' <- if null hdr
+ then return doc
+ else do t <- getCurrentTime
+ let d = text (show t)
+ $$ blankLine
+ $$ doc
+ return $ mkDumpDoc hdr d
defaultLogActionHPrintDoc dflags handle doc' defaultDumpStyle
hClose handle