diff options
author | Phil Ruffwind <rf@rufflewind.com> | 2017-01-10 14:31:55 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2017-01-10 14:32:18 -0500 |
commit | 22845adcc51b40040b9d526c36d2d36edbb11dd7 (patch) | |
tree | 788ba7c72b24f4e3054066022be172557331bf0e /compiler/nativeGen/AsmCodeGen.hs | |
parent | 35a5b60390f2a400d06a2209eb03b7fd6ccffdab (diff) | |
download | haskell-22845adcc51b40040b9d526c36d2d36edbb11dd7.tar.gz |
Fix terminal corruption bug and clean up SDoc interface.
- Fix #13076 by wrapping `printDoc_` so that the terminal color is
reset even if an exception occurs.
- Add `printSDoc`, `printSDocLn`, and `bufLeftRenderSDoc` to keep `SDoc`
values abstract (they are wrappers of `printDoc_`, `printDoc`, and
`bufLeftRender` respectively).
- Remove unused function: `printForAsm`
Test Plan: manual
Reviewers: RyanGlScott, austin, dfeuer, bgamari
Reviewed By: dfeuer, bgamari
Subscribers: dfeuer, mpickering, thomie
Differential Revision: https://phabricator.haskell.org/D2932
GHC Trac Issues: #13076
Diffstat (limited to 'compiler/nativeGen/AsmCodeGen.hs')
-rw-r--r-- | compiler/nativeGen/AsmCodeGen.hs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/compiler/nativeGen/AsmCodeGen.hs b/compiler/nativeGen/AsmCodeGen.hs index 0a15638cc4..7cc7a2804d 100644 --- a/compiler/nativeGen/AsmCodeGen.hs +++ b/compiler/nativeGen/AsmCodeGen.hs @@ -346,8 +346,7 @@ finishNativeGen dflags modLoc bufh@(BufHandle _ _ h) us ngs dump_stats (Linear.pprStats (concat (ngs_natives ngs)) linearStats) -- write out the imports - Pretty.printDoc Pretty.LeftMode (pprCols dflags) h - $ withPprStyleDoc dflags (mkCodeStyle AsmStyle) + printSDocLn Pretty.LeftMode dflags h (mkCodeStyle AsmStyle) $ makeImportsDoc dflags (concat (ngs_imports ngs)) return us' where @@ -481,8 +480,8 @@ cmmNativeGens dflags this_mod modLoc ncgImpl h dbgMap = go emitNativeCode :: DynFlags -> BufHandle -> SDoc -> IO () emitNativeCode dflags h sdoc = do - {-# SCC "pprNativeCode" #-} Pretty.bufLeftRender h - $ withPprStyleDoc dflags (mkCodeStyle AsmStyle) sdoc + {-# SCC "pprNativeCode" #-} bufLeftRenderSDoc dflags h + (mkCodeStyle AsmStyle) sdoc -- dump native code dumpIfSet_dyn dflags |