summaryrefslogtreecommitdiff
path: root/compiler/GHC/Utils/Trace.hs
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2022-05-13 11:12:02 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2022-05-16 14:18:11 +0100
commit4340ff9109fd3a6b7d0a81e4e82c0d8443e68c40 (patch)
tree0ac397206ffa27912e1aef1d09b24f2b50fbf318 /compiler/GHC/Utils/Trace.hs
parent93153aab656f173ac36e0c3c2b4835caaa55669b (diff)
downloadhaskell-wip/T21569.tar.gz
Adjust flags for pprTracewip/T21569
We were using defaultSDocContext for pprTrace, which suppresses lots of useful infomation. This small MR adds GHC.Utils.Outputable.traceSDocContext and uses it for pprTrace and pprTraceUserWarning. traceSDocContext is a global, and hence not influenced by flags, but that seems unavoidable. But I made the sdocPprDebug bit controlled by unsafeHasPprDebug, since we have the latter for exactly this purpose. Fixes #21569
Diffstat (limited to 'compiler/GHC/Utils/Trace.hs')
-rw-r--r--compiler/GHC/Utils/Trace.hs6
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/GHC/Utils/Trace.hs b/compiler/GHC/Utils/Trace.hs
index cc5c69abb7..c5f07df248 100644
--- a/compiler/GHC/Utils/Trace.hs
+++ b/compiler/GHC/Utils/Trace.hs
@@ -28,7 +28,7 @@ import Control.Monad.IO.Class
pprTrace :: String -> SDoc -> a -> a
pprTrace str doc x
| unsafeHasNoDebugOutput = x
- | otherwise = pprDebugAndThen defaultSDocContext trace (text str) doc x
+ | otherwise = pprDebugAndThen traceSDocContext trace (text str) doc x
pprTraceM :: Applicative f => String -> SDoc -> f ()
pprTraceM str doc = pprTrace str doc (pure ())
@@ -69,7 +69,7 @@ warnPprTrace _ _s _ x | not debugIsOn = x
warnPprTrace _ _s _msg x | unsafeHasNoDebugOutput = x
warnPprTrace False _s _msg x = x
warnPprTrace True s msg x
- = pprDebugAndThen defaultSDocContext trace (text "WARNING:")
+ = pprDebugAndThen traceSDocContext trace (text "WARNING:")
(text s $$ msg $$ withFrozenCallStack traceCallStackDoc )
x
@@ -78,7 +78,7 @@ warnPprTrace True s msg x
pprTraceUserWarning :: HasCallStack => SDoc -> a -> a
pprTraceUserWarning msg x
| unsafeHasNoDebugOutput = x
- | otherwise = pprDebugAndThen defaultSDocContext trace (text "WARNING:")
+ | otherwise = pprDebugAndThen traceSDocContext trace (text "WARNING:")
(msg $$ withFrozenCallStack traceCallStackDoc )
x