diff options
author | Ömer Sinan Ağacan <omeragacan@gmail.com> | 2019-08-30 12:05:42 (GMT) |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-09-09 01:40:32 (GMT) |
commit | 51379b89eb08252560e911ab559205ea69d21fec (patch) | |
tree | a22051d462b8040fd4bdfb71abb04b2e13c45691 | |
parent | b0fdd7fe666ae61044f041233354765c4bb68529 (diff) | |
download | ghc-51379b89eb08252560e911ab559205ea69d21fec.zip ghc-51379b89eb08252560e911ab559205ea69d21fec.tar.gz ghc-51379b89eb08252560e911ab559205ea69d21fec.tar.bz2 |
Add a new flag -dno-typeable-binds for debugging
See the user manual entry -- this helps when debugging as generated Core
gets smaller without these bindings.
-rw-r--r-- | compiler/main/DynFlags.hs | 7 | ||||
-rw-r--r-- | compiler/typecheck/TcTypeable.hs | 6 | ||||
-rw-r--r-- | docs/users_guide/debugging.rst | 12 |
3 files changed, 21 insertions, 4 deletions
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index c4a917f..c2d0322 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -508,8 +508,9 @@ data GeneralFlag | Opt_DoCmmLinting | Opt_DoAsmLinting | Opt_DoAnnotationLinting - | Opt_NoLlvmMangler -- hidden flag - | Opt_FastLlvm -- hidden flag + | Opt_NoLlvmMangler -- hidden flag + | Opt_FastLlvm -- hidden flag + | Opt_NoTypeableBinds | Opt_WarnIsError -- -Werror; makes warnings fatal | Opt_ShowWarnGroups -- Show the group a warning belongs to @@ -3474,6 +3475,8 @@ dynamic_flags_deps = [ (NoArg (setGeneralFlag Opt_NoLlvmMangler)) -- hidden flag , make_ord_flag defGhcFlag "fast-llvm" (NoArg (setGeneralFlag Opt_FastLlvm)) -- hidden flag + , make_ord_flag defGhcFlag "dno-typeable-binds" + (NoArg (setGeneralFlag Opt_NoTypeableBinds)) , make_ord_flag defGhcFlag "ddump-debug" (setDumpFlag Opt_D_dump_debug) , make_ord_flag defGhcFlag "ddump-json" diff --git a/compiler/typecheck/TcTypeable.hs b/compiler/typecheck/TcTypeable.hs index eb679e6..e2a0e66 100644 --- a/compiler/typecheck/TcTypeable.hs +++ b/compiler/typecheck/TcTypeable.hs @@ -148,7 +148,9 @@ There are many wrinkles: -- See Note [Grand plan for Typeable] in TcTypeable. mkTypeableBinds :: TcM TcGblEnv mkTypeableBinds - = do { -- Create a binding for $trModule. + = do { dflags <- getDynFlags + ; if gopt Opt_NoTypeableBinds dflags then getGblEnv else do + { -- Create a binding for $trModule. -- Do this before processing any data type declarations, -- which need tcg_tr_module to be initialised ; tcg_env <- mkModIdBindings @@ -166,7 +168,7 @@ mkTypeableBinds ; traceTc "mkTypeableBinds" (ppr tycons) ; this_mod_todos <- todoForTyCons mod mod_id tycons ; mkTypeRepTodoBinds (this_mod_todos : prim_todos) - } } + } } } where needs_typeable_binds tc | tc `elem` [runtimeRepTyCon, vecCountTyCon, vecElemTyCon] diff --git a/docs/users_guide/debugging.rst b/docs/users_guide/debugging.rst index f966e1a..572dd15 100644 --- a/docs/users_guide/debugging.rst +++ b/docs/users_guide/debugging.rst @@ -885,3 +885,15 @@ Checking for determinism generates in decreasing order * ``-dinitial-unique=1 -dunique-increment=PRIME`` - where PRIME big enough to overflow often - nonsequential order + +Other +----- + +.. ghc-flag:: -dno-typeable-binds + :shortdesc: Don't generate bindings for Typeable methods + :type: dynamic + + This avoid generating Typeable-related bindings for modules and types. This + is useful when debugging because it gives smaller modules and dumps, but the + compiler will panic if you try to use Typeable instances of things that you + built with this flag. |