diff options
Diffstat (limited to 'compiler/GHC/Utils/Trace.hs')
-rw-r--r-- | compiler/GHC/Utils/Trace.hs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler/GHC/Utils/Trace.hs b/compiler/GHC/Utils/Trace.hs index ac29cd6fd8..5da6e6e5d9 100644 --- a/compiler/GHC/Utils/Trace.hs +++ b/compiler/GHC/Utils/Trace.hs @@ -7,6 +7,7 @@ module GHC.Utils.Trace , pprSTrace , pprTraceException , warnPprTrace + , pprTraceUserWarning , trace ) where @@ -71,6 +72,15 @@ warnPprTrace True msg x (msg $$ withFrozenCallStack traceCallStackDoc ) x +-- | For when we want to show the user a non-fatal WARNING so that they can +-- report a GHC bug, but don't want to panic. +pprTraceUserWarning :: HasCallStack => SDoc -> a -> a +pprTraceUserWarning msg x + | unsafeHasNoDebugOutput = x + | otherwise = pprDebugAndThen defaultSDocContext trace (text "WARNING:") + (msg $$ withFrozenCallStack traceCallStackDoc ) + x + traceCallStackDoc :: HasCallStack => SDoc traceCallStackDoc = hang (text "Call stack:") |