GHC.Core.Lint

ghc-9.10.0.20240413: The GHC API

Safe Haskell | None
Language | GHC2021

GHC.Core.Lint

Contents

- Debug output

Synopsis

- data LintPassResultConfig = LintPassResultConfig {
  - lpr_diagOpts :: !DiagOpts
  - lpr_platform :: !Platform
  - lpr_makeLintFlags :: !LintFlags
  - lpr_showLintWarnings :: !Bool
  - lpr_passPpr :: !SDoc
  - lpr_localsInScope :: ![Var]
  }
- data LintFlags = LF {
  - lf_check_global_ids :: Bool
  - lf_check_inline_loop_breakers :: Bool
  - lf_check_static_ptrs :: StaticPtrCheck
  - lf_report_unsat_syns :: Bool
  - lf_check_linearity :: Bool
  - lf_check_fixed_rep :: Bool
  }
- data StaticPtrCheck
  - = AllowAnywhere
  - | AllowAtTopLevel
  - | RejectEverywhere
- data LintConfig = LintConfig {
  - l_diagOpts :: !DiagOpts
  - l_platform :: !Platform
  - l_flags :: !LintFlags
  - l_vars :: ![Var]
  }
- type WarnsAndErrs = (Bag SDoc, Bag SDoc)
- lintCoreBindings' :: LintConfig -> CoreProgram -> WarnsAndErrs
- lintUnfolding :: Bool -> LintConfig -> SrcLoc -> CoreExpr -> Maybe (Bag SDoc)
- lintPassResult :: Logger -> LintPassResultConfig -> CoreProgram -> IO ()
- lintExpr :: LintConfig -> CoreExpr -> Maybe (Bag SDoc)
- lintAnnots :: SDoc -> (ModGuts -> CoreM ModGuts) -> ModGuts -> CoreM ModGuts
- lintAxioms :: Logger -> LintConfig -> SDoc -> [CoAxiom Branched] -> IO ()
- data EndPassConfig = EndPassConfig {
  - ep_dumpCoreSizes :: !Bool
  - ep_lintPassResult :: !(Maybe LintPassResultConfig)
  - ep_namePprCtx :: !NamePprCtx
  - ep_dumpFlag :: !(Maybe DumpFlag)
  - ep_prettyPass :: !SDoc
  - ep_passDetails :: !SDoc
  }
- endPassIO :: Logger -> EndPassConfig -> CoreProgram -> [CoreRule] -> IO ()
- displayLintResults :: Logger -> Bool -> SDoc -> SDoc -> WarnsAndErrs -> IO ()
- dumpPassResult :: Logger -> Bool -> NamePprCtx -> Maybe DumpFlag -> String -> SDoc -> CoreProgram -> [CoreRule] -> IO ()

# Documentation

data LintPassResultConfig Source #

Constructors

LintPassResultConfig |
Fields lpr_diagOpts :: !DiagOpts lpr_platform :: !Platform lpr_makeLintFlags :: !LintFlags lpr_showLintWarnings :: !Bool lpr_passPpr :: !SDoc lpr_localsInScope :: ![Var]

data LintFlags Source #

Constructors

LF |
Fields lf_check_global_ids :: Bool lf_check_inline_loop_breakers :: Bool lf_check_static_ptrs :: StaticPtrCheck See Note [Checking StaticPtrs] lf_report_unsat_syns :: Bool See Note [Linting type synonym applications] lf_check_linearity :: Bool See Note [Linting linearity] lf_check_fixed_rep :: Bool

data StaticPtrCheck Source #

Constructors

AllowAnywhere | Allow `makeStatic` to occur anywhere.
AllowAtTopLevel | Allow `makeStatic` calls at the top-level only.
RejectEverywhere | Reject any `makeStatic` occurrence.

#### Instances

Instances details

Eq StaticPtrCheck Source # |
Instance details Defined in GHC.Core.Lint Methods (==) :: StaticPtrCheck -> StaticPtrCheck -> Bool # (/=) :: StaticPtrCheck -> StaticPtrCheck -> Bool #

data LintConfig Source #

Constructors

LintConfig |
Fields l_diagOpts :: !DiagOpts Diagnostics opts l_platform :: !Platform Target platform l_flags :: !LintFlags Linting the result of this pass l_vars :: ![Var] `Id`s that should be treated as being in scope

type WarnsAndErrs = (Bag SDoc, Bag SDoc) Source #

lintCoreBindings' :: LintConfig -> CoreProgram -> WarnsAndErrs Source #

Type-check a `CoreProgram`. See Note [Core Lint guarantee].

lintUnfolding Source #

Arguments

:: Bool | True = is a compulsory unfolding
-> LintConfig |
-> SrcLoc |
-> CoreExpr |
-> Maybe (Bag SDoc) |

lintPassResult :: Logger -> LintPassResultConfig -> CoreProgram -> IO () Source #

lintExpr :: LintConfig -> CoreExpr -> Maybe (Bag SDoc) Source #

lintAnnots :: SDoc -> (ModGuts -> CoreM ModGuts) -> ModGuts -> CoreM ModGuts Source #

This checks whether a pass correctly looks through debug annotations (`SourceNote`). This works a bit different from other consistency checks: We check this by running the given task twice, noting all differences between the results.

lintAxioms Source #

Arguments

:: Logger |
-> LintConfig |
-> SDoc | The source of the linted axioms
-> [CoAxiom Branched] |
-> IO () |

## Debug output

data EndPassConfig Source #

Configuration for boilerplate operations at the end of a compilation pass producing Core.

Constructors

EndPassConfig |
Fields ep_dumpCoreSizes :: !Bool Whether core bindings should be dumped with the size of what they are binding (i.e. the size of the RHS of the binding). ep_lintPassResult :: !(Maybe LintPassResultConfig) Whether we should lint the result of this pass. ep_namePprCtx :: !NamePprCtx ep_dumpFlag :: !(Maybe DumpFlag) ep_prettyPass :: !SDoc ep_passDetails :: !SDoc

endPassIO :: Logger -> EndPassConfig -> CoreProgram -> [CoreRule] -> IO () Source #

displayLintResults Source #

Arguments

:: Logger |
-> Bool | If `True`, display linter warnings. If `False`, ignore linter warnings.
-> SDoc | The source of the linted program
-> SDoc | The linted program, pretty-printed
-> WarnsAndErrs |
-> IO () |

dumpPassResult :: Logger -> Bool -> NamePprCtx -> Maybe DumpFlag -> String -> SDoc -> CoreProgram -> [CoreRule] -> IO () Source #