ghc-lib-parser-9.10.1.20250103: The GHC API, decoupled from GHC versions

Safe Haskell | Ignore
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 #

Constructors

LintPassResultConfig |

Fields

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

data LintFlags #

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 #

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 # |
Instance details Defined in GHC.Core.Lint Methods (==) :: StaticPtrCheck -> StaticPtrCheck -> Bool # (/=) :: StaticPtrCheck -> StaticPtrCheck -> Bool #

data LintConfig #

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) #

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

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

lintUnfolding #

Arguments

:: Bool | True = is a compulsory unfolding
-> 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 #

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 #

Arguments

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

## Debug output

data EndPassConfig #

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 () #

displayLintResults #

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 () #