ghc-9.0.1: The GHC API
Safe HaskellNone
LanguageHaskell2010

GHC.Driver.Session

Description

Dynamic flags

Most flags are dynamic flags, which means they can change from compilation to compilation using OPTIONS_GHC pragmas, and in a multi-session GHC each session can be using different dynamic flags. Dynamic flags can also be set at the prompt in GHCi.

(c) The University of Glasgow 2005

Synopsis

Dynamic flags and associated configuration types

data DumpFlag Source #

Debugging flags

Constructors

Opt_D_dump_cmm 
Opt_D_dump_cmm_from_stg 
Opt_D_dump_cmm_raw 
Opt_D_dump_cmm_verbose_by_proc 
Opt_D_dump_cmm_verbose 
Opt_D_dump_cmm_cfg 
Opt_D_dump_cmm_cbe 
Opt_D_dump_cmm_switch 
Opt_D_dump_cmm_proc 
Opt_D_dump_cmm_sp 
Opt_D_dump_cmm_sink 
Opt_D_dump_cmm_caf 
Opt_D_dump_cmm_procmap 
Opt_D_dump_cmm_split 
Opt_D_dump_cmm_info 
Opt_D_dump_cmm_cps 
Opt_D_dump_cfg_weights

Dump the cfg used for block layout.

Opt_D_dump_asm 
Opt_D_dump_asm_native 
Opt_D_dump_asm_liveness 
Opt_D_dump_asm_regalloc 
Opt_D_dump_asm_regalloc_stages 
Opt_D_dump_asm_conflicts 
Opt_D_dump_asm_stats 
Opt_D_dump_asm_expanded 
Opt_D_dump_llvm 
Opt_D_dump_core_stats 
Opt_D_dump_deriv 
Opt_D_dump_ds 
Opt_D_dump_ds_preopt 
Opt_D_dump_foreign 
Opt_D_dump_inlinings 
Opt_D_dump_rule_firings 
Opt_D_dump_rule_rewrites 
Opt_D_dump_simpl_trace 
Opt_D_dump_occur_anal 
Opt_D_dump_parsed 
Opt_D_dump_parsed_ast 
Opt_D_dump_rn 
Opt_D_dump_rn_ast 
Opt_D_dump_simpl 
Opt_D_dump_simpl_iterations 
Opt_D_dump_spec 
Opt_D_dump_prep 
Opt_D_dump_stg 
Opt_D_dump_stg_unarised 
Opt_D_dump_stg_final 
Opt_D_dump_call_arity 
Opt_D_dump_exitify 
Opt_D_dump_stranal 
Opt_D_dump_str_signatures 
Opt_D_dump_cpranal 
Opt_D_dump_cpr_signatures 
Opt_D_dump_tc 
Opt_D_dump_tc_ast 
Opt_D_dump_hie 
Opt_D_dump_types 
Opt_D_dump_rules 
Opt_D_dump_cse 
Opt_D_dump_worker_wrapper 
Opt_D_dump_rn_trace 
Opt_D_dump_rn_stats 
Opt_D_dump_opt_cmm 
Opt_D_dump_simpl_stats 
Opt_D_dump_cs_trace 
Opt_D_dump_tc_trace 
Opt_D_dump_ec_trace 
Opt_D_dump_if_trace 
Opt_D_dump_vt_trace 
Opt_D_dump_splices 
Opt_D_th_dec_file 
Opt_D_dump_BCOs 
Opt_D_dump_ticked 
Opt_D_dump_rtti 
Opt_D_source_stats 
Opt_D_verbose_stg2stg 
Opt_D_dump_hi 
Opt_D_dump_hi_diffs 
Opt_D_dump_mod_cycles 
Opt_D_dump_mod_map 
Opt_D_dump_timings 
Opt_D_dump_view_pattern_commoning 
Opt_D_verbose_core2core 
Opt_D_dump_debug 
Opt_D_dump_json 
Opt_D_ppr_debug 
Opt_D_no_debug_output 

data GeneralFlag Source #

Enumerates the simple on-or-off dynamic flags

Constructors

Opt_DumpToFile

Append dump output to files instead of stdout.

Opt_D_faststring_stats 
Opt_D_dump_minimal_imports 
Opt_DoCoreLinting 
Opt_DoLinearCoreLinting 
Opt_DoStgLinting 
Opt_DoCmmLinting 
Opt_DoAsmLinting 
Opt_DoAnnotationLinting 
Opt_NoLlvmMangler 
Opt_FastLlvm 
Opt_NoTypeableBinds 
Opt_WarnIsError 
Opt_ShowWarnGroups 
Opt_HideSourcePaths 
Opt_PrintExplicitForalls 
Opt_PrintExplicitKinds 
Opt_PrintExplicitCoercions 
Opt_PrintExplicitRuntimeReps 
Opt_PrintEqualityRelations 
Opt_PrintAxiomIncomps 
Opt_PrintUnicodeSyntax 
Opt_PrintExpandedSynonyms 
Opt_PrintPotentialInstances 
Opt_PrintTypecheckerElaboration 
Opt_CallArity 
Opt_Exitification 
Opt_Strictness 
Opt_LateDmdAnal 
Opt_KillAbsence 
Opt_KillOneShot 
Opt_FullLaziness 
Opt_FloatIn 
Opt_LateSpecialise 
Opt_Specialise 
Opt_SpecialiseAggressively 
Opt_CrossModuleSpecialise 
Opt_StaticArgumentTransformation 
Opt_CSE 
Opt_StgCSE 
Opt_StgLiftLams 
Opt_LiberateCase 
Opt_SpecConstr 
Opt_SpecConstrKeen 
Opt_DoLambdaEtaExpansion 
Opt_IgnoreAsserts 
Opt_DoEtaReduction 
Opt_CaseMerge 
Opt_CaseFolding 
Opt_UnboxStrictFields 
Opt_UnboxSmallStrictFields 
Opt_DictsCheap 
Opt_EnableRewriteRules 
Opt_EnableThSpliceWarnings 
Opt_RegsGraph 
Opt_RegsIterative 
Opt_PedanticBottoms 
Opt_LlvmTBAA 
Opt_LlvmFillUndefWithGarbage 
Opt_IrrefutableTuples 
Opt_CmmSink 
Opt_CmmStaticPred 
Opt_CmmElimCommonBlocks 
Opt_AsmShortcutting 
Opt_OmitYields 
Opt_FunToThunk 
Opt_DictsStrict 
Opt_DmdTxDictSel 
Opt_Loopification 
Opt_CfgBlocklayout

Use the cfg based block layout algorithm.

Opt_WeightlessBlocklayout

Layout based on last instruction per block.

Opt_CprAnal 
Opt_WorkerWrapper 
Opt_SolveConstantDicts 
Opt_AlignmentSanitisation 
Opt_CatchBottoms 
Opt_NumConstantFolding 
Opt_SimplPreInlining 
Opt_IgnoreInterfacePragmas 
Opt_OmitInterfacePragmas 
Opt_ExposeAllUnfoldings 
Opt_WriteInterface 
Opt_WriteHie 
Opt_AutoSccsOnIndividualCafs 
Opt_ProfCountEntries 
Opt_Pp 
Opt_ForceRecomp 
Opt_IgnoreOptimChanges 
Opt_IgnoreHpcChanges 
Opt_ExcessPrecision 
Opt_EagerBlackHoling 
Opt_NoHsMain 
Opt_SplitSections 
Opt_StgStats 
Opt_HideAllPackages 
Opt_HideAllPluginPackages 
Opt_PrintBindResult 
Opt_Haddock 
Opt_HaddockOptions 
Opt_BreakOnException 
Opt_BreakOnError 
Opt_PrintEvldWithShow 
Opt_PrintBindContents 
Opt_GenManifest 
Opt_EmbedManifest 
Opt_SharedImplib 
Opt_BuildingCabalPackage 
Opt_IgnoreDotGhci 
Opt_GhciSandbox 
Opt_GhciHistory 
Opt_GhciLeakCheck 
Opt_ValidateHie 
Opt_LocalGhciHistory 
Opt_NoIt 
Opt_HelpfulErrors 
Opt_DeferTypeErrors 
Opt_DeferTypedHoles 
Opt_DeferOutOfScopeVariables 
Opt_PIC
-fPIC
Opt_PIE
-fPIE
Opt_PICExecutable
-pie
Opt_ExternalDynamicRefs 
Opt_Ticky 
Opt_Ticky_Allocd 
Opt_Ticky_LNE 
Opt_Ticky_Dyn_Thunk 
Opt_RPath 
Opt_RelativeDynlibPaths 
Opt_Hpc 
Opt_FlatCache 
Opt_ExternalInterpreter 
Opt_OptimalApplicativeDo 
Opt_VersionMacros 
Opt_WholeArchiveHsLibs 
Opt_SingleLibFolder 
Opt_KeepCAFs 
Opt_KeepGoing 
Opt_ByteCodeIfUnboxed 
Opt_LinkRts 
Opt_ErrorSpans 
Opt_DeferDiagnostics 
Opt_DiagnosticsShowCaret 
Opt_PprCaseAsLet 
Opt_PprShowTicks 
Opt_ShowHoleConstraints 
Opt_ShowValidHoleFits 
Opt_SortValidHoleFits 
Opt_SortBySizeHoleFits 
Opt_SortBySubsumHoleFits 
Opt_AbstractRefHoleFits 
Opt_UnclutterValidHoleFits 
Opt_ShowTypeAppOfHoleFits 
Opt_ShowTypeAppVarsOfHoleFits 
Opt_ShowDocsOfHoleFits 
Opt_ShowTypeOfHoleFits 
Opt_ShowProvOfHoleFits 
Opt_ShowMatchesOfHoleFits 
Opt_ShowLoadedModules 
Opt_HexWordLiterals 
Opt_SuppressCoercions 
Opt_SuppressVarKinds 
Opt_SuppressModulePrefixes 
Opt_SuppressTypeApplications 
Opt_SuppressIdInfo 
Opt_SuppressUnfoldings 
Opt_SuppressTypeSignatures 
Opt_SuppressUniques 
Opt_SuppressStgExts 
Opt_SuppressTicks 
Opt_SuppressTimestamps

Suppress timestamps in dumps

Opt_AutoLinkPackages 
Opt_ImplicitImportQualified 
Opt_KeepHscppFiles 
Opt_KeepHiDiffs 
Opt_KeepHcFiles 
Opt_KeepSFiles 
Opt_KeepTmpFiles 
Opt_KeepRawTokenStream 
Opt_KeepLlvmFiles 
Opt_KeepHiFiles 
Opt_KeepOFiles 
Opt_BuildDynamicToo 
Opt_DistrustAllPackages 
Opt_PackageTrust 
Opt_PluginTrustworthy 
Opt_G_NoStateHack 
Opt_G_NoOptCoercion 

data WarningFlag Source #

Constructors

Opt_WarnDuplicateExports 
Opt_WarnDuplicateConstraints 
Opt_WarnRedundantConstraints 
Opt_WarnHiShadows 
Opt_WarnImplicitPrelude 
Opt_WarnIncompletePatterns 
Opt_WarnIncompleteUniPatterns 
Opt_WarnIncompletePatternsRecUpd 
Opt_WarnOverflowedLiterals 
Opt_WarnEmptyEnumerations 
Opt_WarnMissingFields 
Opt_WarnMissingImportList 
Opt_WarnMissingMethods 
Opt_WarnMissingSignatures 
Opt_WarnMissingLocalSignatures 
Opt_WarnNameShadowing 
Opt_WarnOverlappingPatterns 
Opt_WarnTypeDefaults 
Opt_WarnMonomorphism 
Opt_WarnUnusedTopBinds 
Opt_WarnUnusedLocalBinds 
Opt_WarnUnusedPatternBinds 
Opt_WarnUnusedImports 
Opt_WarnUnusedMatches 
Opt_WarnUnusedTypePatterns 
Opt_WarnUnusedForalls 
Opt_WarnUnusedRecordWildcards 
Opt_WarnRedundantRecordWildcards 
Opt_WarnWarningsDeprecations 
Opt_WarnDeprecatedFlags 
Opt_WarnMissingMonadFailInstances 
Opt_WarnSemigroup 
Opt_WarnDodgyExports 
Opt_WarnDodgyImports 
Opt_WarnOrphans 
Opt_WarnAutoOrphans 
Opt_WarnIdentities 
Opt_WarnTabs 
Opt_WarnUnrecognisedPragmas 
Opt_WarnDodgyForeignImports 
Opt_WarnUnusedDoBind 
Opt_WarnWrongDoBind 
Opt_WarnAlternativeLayoutRuleTransitional 
Opt_WarnUnsafe 
Opt_WarnSafe 
Opt_WarnTrustworthySafe 
Opt_WarnMissedSpecs 
Opt_WarnAllMissedSpecs 
Opt_WarnUnsupportedCallingConventions 
Opt_WarnUnsupportedLlvmVersion 
Opt_WarnMissedExtraSharedLib 
Opt_WarnInlineRuleShadowing 
Opt_WarnTypedHoles 
Opt_WarnPartialTypeSignatures 
Opt_WarnMissingExportedSignatures 
Opt_WarnUntickedPromotedConstructors 
Opt_WarnDerivingTypeable 
Opt_WarnDeferredTypeErrors 
Opt_WarnDeferredOutOfScopeVariables 
Opt_WarnNonCanonicalMonadInstances 
Opt_WarnNonCanonicalMonadFailInstances 
Opt_WarnNonCanonicalMonoidInstances 
Opt_WarnMissingPatternSynonymSignatures 
Opt_WarnUnrecognisedWarningFlags 
Opt_WarnSimplifiableClassConstraints 
Opt_WarnCPPUndef 
Opt_WarnUnbangedStrictPatterns 
Opt_WarnMissingHomeModules 
Opt_WarnPartialFields 
Opt_WarnMissingExportList 
Opt_WarnInaccessibleCode 
Opt_WarnStarIsType 
Opt_WarnStarBinder 
Opt_WarnImplicitKindVars 
Opt_WarnSpaceAfterBang 
Opt_WarnMissingDerivingStrategies 
Opt_WarnPrepositiveQualifiedModule 
Opt_WarnUnusedPackages 
Opt_WarnInferredSafeImports 
Opt_WarnMissingSafeHaskellMode 
Opt_WarnCompatUnqualifiedImports 
Opt_WarnDerivingDefaults 
Opt_WarnInvalidHaddock 

data WarnReason Source #

Used when outputting warnings: if a reason is given, it is displayed. If a warning isn't controlled by a flag, this is made explicit at the point of use.

Constructors

NoReason 
Reason !WarningFlag

Warning was enabled with the flag

ErrReason !(Maybe WarningFlag)

Warning was made an error because of -Werror or -Werror=WarningFlag

Instances

Instances details
Show WarnReason # 
Instance details

Defined in GHC.Driver.Flags

Outputable WarnReason # 
Instance details

Defined in GHC.Driver.Flags

ToJson WarnReason # 
Instance details

Defined in GHC.Driver.Flags

data PlatformConstants Source #

Constructors

PlatformConstants 

Fields

newtype FlushOut Source #

Constructors

FlushOut (IO ()) 

newtype FlushErr Source #

Constructors

FlushErr (IO ()) 

data ProfAuto Source #

Constructors

NoProfAuto

no SCC annotations added

ProfAutoAll

top-level and nested functions are annotated

ProfAutoTop

top-level functions annotated only

ProfAutoExports

exported functions annotated only

ProfAutoCalls

annotate call-sites

warningGroups :: [(String, [WarningFlag])] Source #

Warning groups.

As all warnings are in the Weverything set, it is ignored when displaying to the user which group a warning is in.

warningHierarchies :: [[String]] Source #

Warning group hierarchies, where there is an explicit inclusion relation.

Each inner list is a hierarchy of warning groups, ordered from smallest to largest, where each group is a superset of the one before it.

Separating this from warningGroups allows for multiple hierarchies with no inherent relation to be defined.

The special-case Weverything group is not included.

dopt :: DumpFlag -> DynFlags -> Bool Source #

Test whether a DumpFlag is set

gopt :: GeneralFlag -> DynFlags -> Bool Source #

Test whether a GeneralFlag is set

wopt :: WarningFlag -> DynFlags -> Bool Source #

Test whether a WarningFlag is set

wopt_fatal :: WarningFlag -> DynFlags -> Bool Source #

Test whether a WarningFlag is set as fatal

wopt_set_fatal :: DynFlags -> WarningFlag -> DynFlags Source #

Mark a WarningFlag as fatal (do not set the flag)

xopt :: Extension -> DynFlags -> Bool Source #

Test whether a Extension is set

xopt_set_unlessExplSpec :: Extension -> (DynFlags -> Extension -> DynFlags) -> DynFlags -> DynFlags Source #

Set or unset a Extension, unless it has been explicitly set or unset before.

ifGeneratingDynamicToo :: MonadIO m => DynFlags -> m a -> m a -> m a Source #

dynamicOutputFile :: DynFlags -> FilePath -> FilePath Source #

Compute the path of the dynamic object corresponding to an object file.

sccProfilingEnabled :: DynFlags -> Bool Source #

Indicate if cost-centre profiling is enabled

data DynFlags Source #

Contains not only a collection of GeneralFlags but also a plethora of information relating to the compilation of a single file or GHC session

Constructors

DynFlags 

Fields

data FlagSpec flag Source #

Constructors

FlagSpec 

Fields

class HasDynFlags m where Source #

Instances

Instances details
HasDynFlags LiftM # 
Instance details

Defined in GHC.Stg.Lift.Monad

HasDynFlags Hsc # 
Instance details

Defined in GHC.Driver.Types

HasDynFlags CompPipeline # 
Instance details

Defined in GHC.Driver.Pipeline.Monad

HasDynFlags Ghc # 
Instance details

Defined in GHC.Driver.Monad

HasDynFlags CoreM # 
Instance details

Defined in GHC.Core.Opt.Monad

HasDynFlags SimplM # 
Instance details

Defined in GHC.Core.Opt.Simplify.Monad

HasDynFlags PD # 
Instance details

Defined in GHC.Cmm.Monad

HasDynFlags TcS # 
Instance details

Defined in GHC.Tc.Solver.Monad

HasDynFlags LlvmM # 
Instance details

Defined in GHC.CmmToLlvm.Base

HasDynFlags NatM # 
Instance details

Defined in GHC.CmmToAsm.Monad

HasDynFlags FCode # 
Instance details

Defined in GHC.StgToCmm.Monad

HasDynFlags CmmParse # 
Instance details

Defined in GHC.StgToCmm.ExtCode

(Monad m, HasDynFlags m) => HasDynFlags (MaybeT m) # 
Instance details

Defined in GHC.Driver.Session

ContainsDynFlags env => HasDynFlags (IOEnv env) # 
Instance details

Defined in GHC.Data.IOEnv

MonadIO m => HasDynFlags (GhcT m) # 
Instance details

Defined in GHC.Driver.Monad

(Monad m, HasDynFlags m) => HasDynFlags (ExceptT e m) # 
Instance details

Defined in GHC.Driver.Session

(Monoid a, Monad m, HasDynFlags m) => HasDynFlags (WriterT a m) # 
Instance details

Defined in GHC.Driver.Session

(Monad m, HasDynFlags m) => HasDynFlags (ReaderT a m) # 
Instance details

Defined in GHC.Driver.Session

class ContainsDynFlags t where Source #

Instances

Instances details
ContainsDynFlags (Env gbl lcl) # 
Instance details

Defined in GHC.Tc.Types

Methods

extractDynFlags :: Env gbl lcl -> DynFlags Source #

data HscTarget Source #

The target code type of the compilation (if any).

Whenever you change the target, also make sure to set ghcLink to something sensible.

HscNothing can be used to avoid generating any output, however, note that:

  • If a program uses Template Haskell the typechecker may need to run code from an imported module. To facilitate this, code generation is enabled for modules imported by modules that use template haskell. See Note [-fno-code mode].

Constructors

HscC

Generate C code.

HscAsm

Generate assembly using the native code generator.

HscLlvm

Generate assembly using the llvm code generator.

HscInterpreted

Generate bytecode. (Requires LinkInMemory)

HscNothing

Don't generate any code. See notes above.

Instances

Instances details
Eq HscTarget # 
Instance details

Defined in GHC.Driver.Session

Show HscTarget # 
Instance details

Defined in GHC.Driver.Session

isObjectTarget :: HscTarget -> Bool Source #

Will this target result in an object file on the disk?

targetRetainsAllBindings :: HscTarget -> Bool Source #

Does this target retain *all* top-level bindings for a module, rather than just the exported bindings, in the TypeEnv and compiled code (if any)? In interpreted mode we do this, so that GHCi can call functions inside a module. In HscNothing mode we also do it, so that Haddock can get access to the GlobalRdrEnv for a module after typechecking it.

data GhcMode Source #

The GhcMode tells us whether we're doing multi-module compilation (controlled via the GHC API) or one-shot (single-module) compilation. This makes a difference primarily to the GHC.Driver.Finder: in one-shot mode we look for interface files for imported modules, but in multi-module mode we look for source files in order to check whether they need to be recompiled.

Constructors

CompManager

--make, GHCi, etc.

OneShot
ghc -c Foo.hs
MkDepend

ghc -M, see GHC.Driver.Finder for why we need this

Instances

Instances details
Eq GhcMode # 
Instance details

Defined in GHC.Driver.Session

Methods

(==) :: GhcMode -> GhcMode -> Bool #

(/=) :: GhcMode -> GhcMode -> Bool #

Outputable GhcMode # 
Instance details

Defined in GHC.Driver.Session

data GhcLink Source #

What to do in the link step, if there is one.

Constructors

NoLink

Don't link at all

LinkBinary

Link object code into a binary

LinkInMemory

Use the in-memory dynamic linker (works for both bytecode and object code).

LinkDynLib

Link objects into a dynamic lib (DLL on Windows, DSO on ELF platforms)

LinkStaticLib

Link objects into a static lib

Instances

data PackageFlag Source #

Flags for manipulating packages visibility.

Constructors

ExposePackage String PackageArg ModRenaming

-package, -package-id

HidePackage String
-hide-package

Instances

Instances details
Eq PackageFlag # 
Instance details

Defined in GHC.Driver.Session

Outputable PackageFlag # 
Instance details

Defined in GHC.Driver.Session

data PackageArg Source #

We accept flags which make packages visible, but how they select the package varies; this data type reflects what selection criterion is used.

Constructors

PackageArg String

-package, by PackageName

UnitIdArg Unit

-package-id, by Unit

Instances

Instances details
Eq PackageArg # 
Instance details

Defined in GHC.Driver.Session

Show PackageArg # 
Instance details

Defined in GHC.Driver.Session

Outputable PackageArg # 
Instance details

Defined in GHC.Driver.Session

data ModRenaming Source #

Represents the renaming that may be associated with an exposed package, e.g. the rns part of -package "foo (rns)".

Here are some example parsings of the package flags (where a string literal is punned to be a ModuleName:

  • -package foo is ModRenaming True []
  • -package foo () is ModRenaming False []
  • -package foo (A) is ModRenaming False [(A, A)]
  • -package foo (A as B) is ModRenaming False [(A, B)]
  • -package foo with (A as B) is ModRenaming True [(A, B)]

Constructors

ModRenaming 

Fields

Instances

Instances details
Eq ModRenaming # 
Instance details

Defined in GHC.Driver.Session

Outputable ModRenaming # 
Instance details

Defined in GHC.Driver.Session

newtype IgnorePackageFlag Source #

Flags for manipulating the set of non-broken packages.

Constructors

IgnorePackage String
-ignore-package

Instances

Instances details
Eq IgnorePackageFlag # 
Instance details

Defined in GHC.Driver.Session

data TrustFlag Source #

Flags for manipulating package trust.

Constructors

TrustPackage String
-trust
DistrustPackage String
-distrust

Instances

Instances details
Eq TrustFlag # 
Instance details

Defined in GHC.Driver.Session

data PkgDbRef Source #

Instances

Instances details
Eq PkgDbRef # 
Instance details

Defined in GHC.Driver.Session

data Option Source #

When invoking external tools as part of the compilation pipeline, we pass these a sequence of options on the command-line. Rather than just using a list of Strings, we use a type that allows us to distinguish between filepaths and 'other stuff'. The reason for this is that this type gives us a handle on transforming filenames, and filenames only, to whatever format they're expected to be on a particular platform.

Instances

Instances details
Eq Option # 
Instance details

Defined in GHC.Utils.CliOption

Methods

(==) :: Option -> Option -> Bool #

(/=) :: Option -> Option -> Bool #

data DynLibLoader Source #

Instances

Instances details
Eq DynLibLoader # 
Instance details

Defined in GHC.Driver.Session

fFlags :: [FlagSpec GeneralFlag] Source #

These -f<blah> flags can all be reversed with -fno-<blah>

fLangFlags :: [FlagSpec Extension] Source #

These -f<blah> flags can all be reversed with -fno-<blah>

xFlags :: [FlagSpec Extension] Source #

These -Xblah flags can all be reversed with -XNoblah

wWarningFlags :: [FlagSpec WarningFlag] Source #

These -W<blah> flags can all be reversed with -Wno-<blah>

dynFlagDependencies :: DynFlags -> [ModuleName] Source #

Some modules have dependencies on others through the DynFlags rather than textual imports

makeDynFlagsConsistent :: DynFlags -> (DynFlags, [Located String]) Source #

Resolve any internal inconsistencies in a set of DynFlags. Returns the consistent DynFlags as well as a list of warnings to report to the user.

positionIndependent :: DynFlags -> Bool Source #

Are we building with -fPIE or -fPIC enabled?

homeUnit :: DynFlags -> Unit Source #

Get home unit

mkHomeModule :: DynFlags -> ModuleName -> Module Source #

Make a module in home unit

isHomeModule :: DynFlags -> Module -> Bool Source #

Test if the module comes from the home unit

Log output

putLogMsg :: DynFlags -> WarnReason -> Severity -> SrcSpan -> MsgDoc -> IO () Source #

Write an error or warning to the LogOutput.

Safe Haskell

data SafeHaskellMode Source #

The various Safe Haskell modes

Constructors

Sf_None

inferred unsafe

Sf_Unsafe

declared and checked

Sf_Trustworthy

declared and checked

Sf_Safe

declared and checked

Sf_SafeInferred

inferred as safe

Sf_Ignore

-fno-safe-haskell state

safeHaskellOn :: DynFlags -> Bool Source #

Is Safe Haskell on in some way (including inference mode)

safeImportsOn :: DynFlags -> Bool Source #

Test if Safe Imports are on in some form

safeLanguageOn :: DynFlags -> Bool Source #

Is the Safe Haskell safe language in use

safeInferOn :: DynFlags -> Bool Source #

Is the Safe Haskell safe inference mode active

packageTrustOn :: DynFlags -> Bool Source #

Is the -fpackage-trust mode on

safeDirectImpsReq :: DynFlags -> Bool Source #

Are all direct imports required to be safe for this Safe Haskell mode? Direct imports are when the code explicitly imports a module

safeImplicitImpsReq :: DynFlags -> Bool Source #

Are all implicit imports required to be safe for this Safe Haskell mode? Implicit imports are things in the prelude. e.g System.IO when print is used.

unsafeFlags :: [(String, DynFlags -> SrcSpan, DynFlags -> Bool, DynFlags -> DynFlags)] Source #

A list of unsafe flags under Safe Haskell. Tuple elements are: * name of the flag * function to get srcspan that enabled the flag * function to test if the flag is on * function to turn the flag off

unsafeFlagsForInfer :: [(String, DynFlags -> SrcSpan, DynFlags -> Bool, DynFlags -> DynFlags)] Source #

A list of unsafe flags under Safe Haskell. Tuple elements are: * name of the flag * function to get srcspan that enabled the flag * function to test if the flag is on * function to turn the flag off

LLVM Targets

data LlvmConfig Source #

See Note [LLVM Configuration] in GHC.SysTools.

Constructors

LlvmConfig 

System tool settings and locations

data GhcNameVersion Source #

Settings for what GHC this is.

data FileSettings Source #

Paths to various files and directories used by GHC, including those that provide more settings.

data PlatformMisc Source #

Platform-specific settings formerly hard-coded in Config.hs.

These should probably be all be triaged whether they can be computed from other settings or belong in another another place (like Platform above).

settings :: DynFlags -> Settings Source #

"unbuild" a Settings from a DynFlags. This shouldn't be needed in the vast majority of code. But GHCi questionably uses this to produce a default DynFlags from which to compute a flags diff for printing.

versionedAppDir :: String -> PlatformMini -> MaybeT IO FilePath Source #

The directory for this version of ghc in the user's app directory (typically something like ~.ghcx86_64-linux-7.6.3)

Manipulating DynFlags

defaultDynFlags :: Settings -> LlvmConfig -> DynFlags Source #

The normal DynFlags. Note that they are not suitable for use in this form and must be fully initialized by runGhc first.

initDynFlags :: DynFlags -> IO DynFlags Source #

Used by runGhc to partially initialize a new DynFlags value

defaultLogActionHPrintDoc :: DynFlags -> Handle -> SDoc -> IO () Source #

Like defaultLogActionHPutStrDoc but appends an extra newline.

getOpts Source #

Arguments

:: DynFlags

DynFlags to retrieve the options from

-> (DynFlags -> [a])

Relevant record accessor: one of the opt_* accessors

-> [a]

Correctly ordered extracted options

Retrieve the options corresponding to a particular opt_* field in the correct order

getVerbFlags :: DynFlags -> [String] Source #

Gets the verbosity flag for the current verbosity level. This is fed to other tools, so GHC-specific verbosity flags like -ddump-most are not included

updOptLevel :: Int -> DynFlags -> DynFlags Source #

Sets the DynFlags to be appropriate to the optimisation level

canonicalizeHomeModule :: DynFlags -> ModuleName -> Module Source #

Given a ModuleName of a signature in the home library, find out how it is instantiated. E.g., the canonical form of A in p[A=q[]:A] is q[]:A.

Parsing DynFlags

parseDynamicFlagsCmdLine Source #

Arguments

:: MonadIO m 
=> DynFlags 
-> [Located String] 
-> m (DynFlags, [Located String], [Warn])

Updated DynFlags, left-over arguments, and list of warnings.

Parse dynamic flags from a list of command line arguments. Returns the parsed DynFlags, the left-over arguments, and a list of warnings. Throws a UsageError if errors occurred during parsing (such as unknown flags or missing arguments).

parseDynamicFilePragma Source #

Arguments

:: MonadIO m 
=> DynFlags 
-> [Located String] 
-> m (DynFlags, [Located String], [Warn])

Updated DynFlags, left-over arguments, and list of warnings.

Like parseDynamicFlagsCmdLine but does not allow the package flags (-package, -hide-package, -ignore-package, -hide-all-packages, -package-db). Used to parse flags set in a modules pragma.

parseDynamicFlagsFull Source #

Arguments

:: MonadIO m 
=> [Flag (CmdLineP DynFlags)]

valid flags to match against

-> Bool

are the arguments from the command line?

-> DynFlags

current dynamic flags

-> [Located String]

arguments to parse

-> m (DynFlags, [Located String], [Warn]) 

Parses the dynamically set flags for GHC. This is the most general form of the dynamic flag parser that the other methods simply wrap. It allows saying which flags are valid flags and indicating if we are parsing arguments from the command line or from a file pragma.

Available DynFlags

allNonDeprecatedFlags :: [String] Source #

All dynamic flags option strings without the deprecated ones. These are the user facing strings for enabling and disabling options.

flagsForCompletion :: Bool -> [String] Source #

Make a list of flags for shell completion. Filter all available flags into two groups, for interactive GHC vs all other.

languageExtensions :: Maybe Language -> [Extension] Source #

The language extensions implied by the various language variants. When updating this be sure to update the flag documentation in docsusers_guideexts.

DynFlags C compiler options

Compiler configuration suitable for display to the user

SSE and AVX

Linker/compiler information

data LinkerInfo Source #

Instances

Instances details
Eq LinkerInfo # 
Instance details

Defined in GHC.Driver.Session

data CompilerInfo Source #

Instances

Instances details
Eq CompilerInfo # 
Instance details

Defined in GHC.Driver.Session

File cleanup

data FilesToClean Source #

A collection of files that must be deleted before ghc exits. The current collection is stored in an IORef in DynFlags, filesToClean.

Constructors

FilesToClean 

Fields

emptyFilesToClean :: FilesToClean Source #

An empty FilesToClean

Include specifications

data IncludeSpecs Source #

Used to differentiate the scope an include needs to apply to. We have to split the include paths to avoid accidentally forcing recursive includes since -I overrides the system search paths. See #14312.

Instances

Instances details
Show IncludeSpecs # 
Instance details

Defined in GHC.Driver.Session

addGlobalInclude :: IncludeSpecs -> [String] -> IncludeSpecs Source #

Append to the list of includes a path that shall be included using `-I` when the C compiler is called. These paths override system search paths.

addQuoteInclude :: IncludeSpecs -> [String] -> IncludeSpecs Source #

Append to the list of includes a path that shall be included using `-iquote` when the C compiler is called. These paths only apply when quoted includes are used. e.g. #include "foo.h"

flattenIncludes :: IncludeSpecs -> [String] Source #

Concatenate and flatten the list of global and quoted includes returning just a flat list of paths.

SDoc

initSDocContext :: DynFlags -> PprStyle -> SDocContext Source #

Initialize the pretty-printing options

initDefaultSDocContext :: DynFlags -> SDocContext Source #

Initialize the pretty-printing options using the default user style

Make use of the Cmm CFG

data CfgWeights Source #

Edge weights to use when generating a CFG from CMM