summaryrefslogtreecommitdiff
path: root/compiler/GHC/Driver/Session.hs
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2021-11-01 21:18:04 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-12-21 01:46:00 -0500
commit00b55bfcd982bed2c9fc02d9c3ca66ba9d41bb5c (patch)
tree7bb39528df6cdb359a45a6726f14e3abd2626157 /compiler/GHC/Driver/Session.hs
parent8ea79a16c57a9fcfd091ab7f4aa457e100fa42b5 (diff)
downloadhaskell-00b55bfcd982bed2c9fc02d9c3ca66ba9d41bb5c.tar.gz
Introduce -dlint flag
As suggested in #20601, this is a short-hand for enabling the usual GHC-internal sanity checks one typically leans on when debugging runtime crashes.
Diffstat (limited to 'compiler/GHC/Driver/Session.hs')
-rw-r--r--compiler/GHC/Driver/Session.hs18
1 files changed, 18 insertions, 0 deletions
diff --git a/compiler/GHC/Driver/Session.hs b/compiler/GHC/Driver/Session.hs
index be30e36052..d1c29bc824 100644
--- a/compiler/GHC/Driver/Session.hs
+++ b/compiler/GHC/Driver/Session.hs
@@ -2535,6 +2535,8 @@ dynamic_flags_deps = [
(setDumpFlag Opt_D_dump_hi_diffs)
, make_ord_flag defGhcFlag "ddump-rtti"
(setDumpFlag Opt_D_dump_rtti)
+ , make_ord_flag defGhcFlag "dlint"
+ (NoArg enableDLint)
, make_ord_flag defGhcFlag "dcore-lint"
(NoArg (setGeneralFlag Opt_DoCoreLinting))
, make_ord_flag defGhcFlag "dlinear-core-lint"
@@ -3922,6 +3924,22 @@ enableUnusedBinds = mapM_ setWarningFlag unusedBindsFlags
disableUnusedBinds :: DynP ()
disableUnusedBinds = mapM_ unSetWarningFlag unusedBindsFlags
+-- | Things you get with `-dlint`.
+enableDLint :: DynP ()
+enableDLint = do
+ mapM_ setGeneralFlag dLintFlags
+ addWayDynP WayDebug
+ where
+ dLintFlags :: [GeneralFlag]
+ dLintFlags =
+ [ Opt_DoCoreLinting
+ , Opt_DoStgLinting
+ , Opt_DoCmmLinting
+ , Opt_DoAsmLinting
+ , Opt_CatchNonexhaustiveCases
+ , Opt_LlvmFillUndefWithGarbage
+ ]
+
enableGlasgowExts :: DynP ()
enableGlasgowExts = do setGeneralFlag Opt_PrintExplicitForalls
mapM_ setExtensionFlag glasgowExtsFlags