compiler/front/options

    Dark Mode
Search:
  Source   Edit

Types

Cfile = object
  nimname*: string           ## Original name of the nim file, constructed
                             ## from the module name.
  cname*, obj*: AbsoluteFile
  flags*: set[CfileFlag]
  customArgs*: string
  Source   Edit
CfileFlag {.pure.} = enum
  Cached,                   ## no need to recompile this time
  External                   ## file was introduced via .compile pragma
  Source   Edit
CfileList = seq[Cfile]
  Source   Edit
ConfigRef = ref object
  active*: CurrentConf
  spellSuggestMax*: int      ## max number of spelling suggestions for typos
  verbosity*: CompilerVerbosity ## how verbose the compiler is
  arguments*: string         ## the arguments to be passed to the program that
                             ## should be run
  linesCompiled*: int
  m*: MsgConfig
  unitSep*: string           ## Unit separator between compiler messages
  evalTemplateCounter*: int  ## Template instantiation depth used to guard
                             ## against infinite expansion recursion
  exitcode*: int8
  hintProcessingDots*: bool  ## true for dots, false for filenames
  lastCmdTime*: float ## Start of the last compiler commmand - set
                      ## in the `main.mainCommand` and then read to generate 'successX'
                      ## message
  headerFile*: string
  ideCmd*: IdeCmd
  oldNewlines*: bool
  mainPackageId*: int
  errorCounter*: int
  hintCounter*: int
  warnCounter*: int
  errorMax*: int             ## Maximum number of errors before compilation will be terminated
  maxLoopIterationsVM*: int  ## VM: max iterations of all loops
  packageCache*: StringTableRef ## absolute path -> absolute path
  jsonBuildFile*: AbsoluteFile
  nimStdlibVersion*: NimVer
  cfileSpecificOptions*: StringTableRef ## File specific compilation options for C backend.
                                        ## Modified by `{.localPassc.}`
  inputMode*: ProjectInputMode ## how the main module is sourced
  lastMsgWasDot*: set[StdOrrKind] ## the last compiler message was a single '.'
  projectMainIdx*: FileIndex ## the canonical path id of the main module
  commandLineSrcIdx*: FileIndex ## used by `commands` to base paths off for
                                ## path, lib, and other additions; default
                                ## to `lineinfos.commandLineIdx` and
                                ## altered by `nimconf` as needed
  command*: string           ## the main command (e.g. cc, check, scan, etc)
  commandArgs*: seq[string]  ## any arguments after the main command
  commandLine*: string
  extraCmds*: seq[string]    ## for writeJsonBuildInstructions
  keepComments*: bool        ## whether the parser needs to keep comments
  docSeeSrcUrl*: string ## if empty, no seeSrc will be
                        ## generated. The string uses the formatting variables `path` and
                        ## `line`.
  docRoot*: string           ## see nim --fullhelp for --docRoot
  docCmd*: string            ## see nim --fullhelp for --docCmd
  configFiles*: seq[AbsoluteFile] ## List of config files that have been
                                  ## processed during compilation.
  externalToLink*: seq[string] ## files to link in addition to the file
                               ## we compiled. Modified by the `{.link.}` pragma and `--link`
                               ## command-line flag.
  linkOptions*: string       ## Additional linking options, modified by the
                             ## `{.passl.}` pragma
  compileOptions*: string    ## Additional compilation options, modified by
                             ## the `{.passc.}` pragma
  cCompilerPath*: string
  toCompile*: CfileList
  suggestionResultHook*: proc (result: Suggest) {.closure.}
  suggestMaxResults*: int
  lastLineInfo*: TLineInfo
  writelnHook*: proc (conf: ConfigRef; output: string; flags: MsgFlags) {.
      closure.}              ## All
                             ## textual output from the compiler goes through this callback.
  writeHook*: proc (conf: ConfigRef; output: string; flags: MsgFlags) {.closure.}
  structuredReportHook*: ReportHook ## callback that is invoked when an enabled report is passed to report
                                    ## handling. The callback is meant to handle rendering/displaying of
                                    ## the report
  astDiagToLegacyReport*: proc (conf: ConfigRef; d: PAstDiag): Report
  setMsgFormat*: proc (config: ConfigRef; fmt: MsgFormatKind) {.closure.} ## callback that sets the message format for legacy reporting, needs to
                                                                          ## set before CLI handling, because reports are just that awful
  hack*: HackController      ## Configuration values for debug printing
  when defined(nimDebugUtils):
      debugUtilsStack*: seq[string] ## which proc name to stop trace output
                                    ## len is also used for output indent level
    
  toDebugProc*: StringTableRef ## maps identifiers to the name of the IR to print to the standard
                               ## output
  toDebugIr*: set[IrName] ## the IRs which should always be always printed to the standard
                          ## output
  when defined(nimDebugUnreportedErrors):
      unreportedErrors*: OrderedTable[NodeId, PNode]

  
every global configuration fields marked with '*' are subject to the incremental compilation mechanisms (+) means "part of the dependency"   Source   Edit
HackController = object
  semStack*: bool            ## Show `| context` entries in the call tracer
  reportInTrace*: bool       ## Error messages are shown with matching indentation
                             ## if report was triggered during execution of the
                             ## sem trace
  semTraceData*: bool        ## For each sem step show processed data, or only
                             ## procedure calls.
  bypassWriteHookForTrace*: bool ## Output trace reports directly into
                                 ## the `echo` instead of going through the `ConfigRef.writeln` hook.
                                 ## This is useful for environments such as nimsuggest, which discard
                                 ## the output.
  
additional configuration switches to control the behavior of the debug printer. Most of them are for compiler debugging, and for now they can't be set up from the cli/defines - in the future this will be changed. For now you can just edit defaultHackController value in this module as you see fit.   Source   Edit
IdeCmd = enum
  ideNone, ideSug, ideCon, ideDef, ideUse, ideDus, ideChk, ideMod, ideHighlight,
  ideOutline, ideKnown, ideMsg, ideProject
  Source   Edit
IrName = enum
  irTransf = "transf", irMirIn = "mir_in", irMirOut = "mir_out",
  irCgir = "cgir", irVm = "vm"
Names of the IRs that can be rendered to the standard output for debugging purposes.   Source   Edit
MsgConfig = object
  trackPos*: TLineInfo
  trackPosAttached*: bool    ## whether the tracking position was attached to
                             ## some close token.
  errorOutputs*: TErrorOutputs ## Allowed output streams for messages.
  msgContext*: seq[tuple[info: TLineInfo, detail: PSym]] ## \ Contextual
                                                         ## 
                                                         ## information about instantiation stack - "template/generic
                                                         ## 
                                                         ## instantiation of" message is constructed from this field. Right now
                                                         ## 
                                                         ## `.detail` field is only used in the 
                                                         ## `sem.semMacroExpr()`,
                                                         ## 
                                                         ## `seminst.generateInstance()` and 
                                                         ## `semexprs.semTemplateExpr()`. 
                                                         ## In
                                                         ## all other cases this field is left empty (SemReport is `skUnknown`)
  writtenSemReports*: ReportSet
  lastError*: TLineInfo
  filenameToIndexTbl*: Table[string, FileIndex]
  rawPathToIndexTbl*: Table[string, FileIndex] ## maps non-canonicalized
                                               ## paths of known-files to the corresponding file index
  fileInfos*: seq[TFileInfo] ## Information about all known source files
                             ## is stored in this field - full/relative paths, list of line etc.
                             ## (For full list see `TFileInfo`)
  systemFileIdx*: FileIndex
does not need to be stored in the incremental cache   Source   Edit
MsgFlag = enum
  msgStdout,                ## force writing to stdout, even stderr is default
  msgNoUnitSep               ## the message is a complete "paragraph".
flags altering msgWriteln behavior   Source   Edit
MsgFlags = set[MsgFlag]
  Source   Edit
NimVer = tuple[major: int, minor: int, patch: int]
  Source   Edit
PkgDesc = object
  case pkgKnown*: bool
  of true:
      pkgFile*: AbsoluteFile ## if applicable, package file
    
  of false:
      nil

  pkgRootName*: string       ## name of the package root
  pkgRoot*: AbsoluteDir      ## path to the root or project path if unknown pkg
  pkgSubpath*: string        ## if not empty, sub-package it's a part of
  pkgName*: string           ## fully escaped package name with any subpaths, same
                             ## as `pkgRootName` if no subpaths present
  
describes the package, and optional sub-package, used in conjunction with a module to determine its relationship to a package.   Source   Edit
ProjectInputMode = enum
  pimStdin,                 ## the contents of the main module are provided by stdin
  pimCmd, ## the contents of the main module are provided by a command-line
           ## argument
  pimFile                    ## the main module is a file
  Source   Edit
ReportHook = proc (conf: ConfigRef; report: Report): TErrorHandling {.closure.}
  Source   Edit
ReportSet = object
  ids: PackedSet[uint32]
  Source   Edit
ReportWritabilityKind = enum
  writeEnabled, writeDisabled, writeForceEnabled
  Source   Edit
StdOrrKind = enum
  stdOrrStdout, stdOrrStderr
  Source   Edit
Suggest = ref object
  section*: IdeCmd
  qualifiedPath*: seq[string]
  name*: string              ## display name
  filePath*: string
  line*: int                 ## Starts at 1
  column*: int               ## Starts at 0
  doc*: string               ## Unescaped documentation string
  forth*: string             ## type
  quality*: range[0 .. 100]  ## matching quality
  contextFits*: bool         ## type/non-type context matches
  prefix*: PrefixMatch
  symkind*: byte
  scope*: int
  localUsages*, globalUsages*: int
  tokenLen*: int
  flags*: set[SuggestFlag]
  Source   Edit
SuggestFlag {.pure.} = enum
  deprecated = 1, isGlobal = 2
  Source   Edit
Suggestions = seq[Suggest]
  Source   Edit
TCmdLinePass = enum
  passCmd1, passCmd2, passPP
  Source   Edit
TErrorHandling = enum
  doDefault, ## Default action, custom report hook can return this in
              ## order for automatic handing to decide appropriate
              ## reaction.
  doNothing,                ## Don't do anything
  doAbort,                  ## Immediately abort compilation
  doRaise                    ## Raise recoverable error
  Source   Edit
TStringSeq = seq[string]
  Source   Edit

Consts

ChecksOptions = {optObjCheck, optFieldCheck, optRangeCheck, optOverflowCheck,
                 optBoundsCheck, optAssert, optNaNCheck, optInfCheck,
                 optStyleCheck}
  Source   Edit
cmdBackends = {cmdCompileToC, cmdCompileToJS, cmdCompileToVM, cmdCrun}
  Source   Edit
cmdDocLike = {cmdDoc, cmdDoc2tex, cmdJsondoc, cmdCtags, cmdBuildindex}
  Source   Edit
commandLineDesc = "command line"
  Source   Edit
copyrightYear = "2022"
  Source   Edit
DefaultConfig = r"nim.cfg"
  Source   Edit
DefaultConfigNims = r"config.nims"
  Source   Edit
DefaultGlobalOptions = {optThreadAnalysis, optExcessiveStackTrace}
  Source   Edit
DefaultOptions = {optObjCheck, optFieldCheck, optRangeCheck, optBoundsCheck,
                  optOverflowCheck, optAssert, optWarns, optHints,
                  optStackTrace, optLineTrace, optTrMacros, optStyleCheck,
                  optCursorInference}
  Source   Edit
DocConfig = r"nimdoc.cfg"
  Source   Edit
docRootDefault = "@default"
  Source   Edit
DocTexConfig = r"nimdoc.tex.cfg"
  Source   Edit
genSubDir = r"nimskullcache"
  Source   Edit
harmlessOptions = {optForceFullMake, optNoLinking, optRun, optUseColors,
                   optStdout}
  Source   Edit
hasTinyCBackend = false
  Source   Edit
htmldocsDir = "htmldocs"
  Source   Edit
HtmlExt = "html"
  Source   Edit
IdeLocCmds = {ideSug, ideCon, ideDef, ideUse, ideDus}
IDE commands requiring source locations, related MsgConfig.trackPos   Source   Edit
IniExt = "ini"
  Source   Edit
JsonExt = "json"
  Source   Edit
nimEnableCovariance = false
  Source   Edit
NimExt = "nim"
  Source   Edit
NotesVerbosity = (main: [{rintUnreachable..rintSource,
                          rintQuitCalled..rintMissingStackTrace,
                          rintStackTrace..rextCmdRequiresFile,
                          rlexMalformedNumUnderscores..rlexLinterReport,
                          rparInvalidIndentation..rvmStackTrace,
                          rsemUserError..rsemMissingPragmaArg,
                          rsemEmptyAsm..rsemDotForModuleImport,
                          rsemStrictNotNilExpr..rsemStrictNotNilResult,
                          rsemWarnGcUnsafeListing..rsemProveInit,
                          rsemImplicitCstringConvert..rsemHoleEnumConvert,
                          rsemMethodLockMismatch..rsemResultShadowed,
                          rsemGenericMethodsDeprecated..rsemBindDeprecated,
                          rsemUnknownHint..rsemLinterReportUse,
                          rsemXDeclaredButNotUsed..rsemClosureWithoutEnv,
                          rsemExprAlwaysX..rsemConditionAlwaysFalse,
                          rsemEffectsListingHint..rsemNonMatchingCandidates,
                          rsemDiagnostics..rcmdFailedExecution,
                          rcmdRunnableExamplesSuccess,
                          rbackCannotWriteScript..rbackProducedAssembly}, {
    rintUnreachable..rintSource, rintQuitCalled..rextCmdRequiresFile,
    rlexMalformedNumUnderscores..rlexLinterReport,
    rparInvalidIndentation..rvmStackTrace, rsemUserError..rsemMissingPragmaArg,
    rsemEmptyAsm..rsemDotForModuleImport,
    rsemStrictNotNilExpr..rsemStrictNotNilResult,
    rsemWarnGcUnsafeListing..rsemProveInit,
    rsemImplicitCstringConvert..rsemHoleEnumConvert,
    rsemMethodLockMismatch..rsemResultShadowed,
    rsemGenericMethodsDeprecated..rsemBindDeprecated,
    rsemUnknownHint..rsemLinterReportUse,
    rsemXDeclaredButNotUsed..rsemProcessing, rsemExprAlwaysX..rsemPattern,
    rsemEffectsListingHint..rsemNonMatchingCandidates,
    rsemDiagnostics..rcmdFailedExecution,
    rcmdExecuting..rcmdRunnableExamplesSuccess,
    rbackCannotWriteScript..rbackProducedAssembly}, {
    rintUnreachable..rintMsgOrigin, rintQuitCalled..rextCmdRequiresFile,
    rextPath..rvmStackTrace, rsemUserError..rsemStrictNotNilResult,
    rsemWarnGcUnsafeListing..rsemProveInit,
    rsemImplicitCstringConvert..rsemHoleEnumConvert,
    rsemMethodLockMismatch..rsemResultShadowed,
    rsemGenericMethodsDeprecated..rsemBindDeprecated,
    rsemUnknownHint..rsemProcessing, rsemExprAlwaysX..rsemNonMatchingCandidates,
    rsemDiagnostics..rcmdFailedExecution,
    rcmdExecuting..rcmdRunnableExamplesSuccess,
    rbackCannotWriteScript..rbackProducedAssembly}, {
    rintUnreachable..rintMsgOrigin, rintQuitCalled..rvmStackTrace,
    rsemUserError..rsemHoleEnumConvert,
    rsemMethodLockMismatch..rsemResultShadowed,
    rsemGenericMethodsDeprecated..rsemBindDeprecated,
    rsemUnknownHint..rcmdFailedExecution,
    rcmdExecuting..rcmdRunnableExamplesSuccess,
    rbackCannotWriteScript..rbackProducedAssembly}], foreign: {
    rintUnreachable..rextCmdRequiresFile,
    rlexMalformedNumUnderscores..rlexUnclosedComment,
    rparInvalidIndentation..rparInvalidFilter,
    rvmOpcParseExpectedExpression..rvmStackTrace,
    rsemUserError..rsemUserWarning, rsemUserHint, rsemProcessing,
    rsemImplicitObjConv..rcmdFailedExecution,
    rbackCannotWriteScript..rbackCannotProduceAssembly}, base: {
    rintUnreachable..rextCmdRequiresFile,
    rlexMalformedNumUnderscores..rlexUnclosedComment,
    rparInvalidIndentation..rparInvalidFilter,
    rvmOpcParseExpectedExpression..rvmStackTrace, rsemUserError..rsemEmptyAsm,
    rcmdFailedExecution, rbackCannotWriteScript..rbackCannotProduceAssembly})
  Source   Edit
oldExperimentalFeatures = {dotOperators, callOperator}
  Source   Edit
RodExt = "rod"
  Source   Edit
TagsExt = "tags"
  Source   Edit
TexExt = "tex"
  Source   Edit
useEffectSystem = true
  Source   Edit
useWriteTracking = false
  Source   Edit

Procs

proc `$`(c: IdeCmd): string {....raises: [], tags: [].}
  Source   Edit
proc absOutFile(conf: ConfigRef): AbsoluteFile {....raises: [OSError],
    tags: [ReadDirEffect].}
  Source   Edit
proc asgn(conf: ConfigRef; nset: ConfNoteSet; notes: ReportKinds) {....raises: [],
    tags: [].}
Assign to specified note set   Source   Edit
proc asgn(conf: ConfigRef; sto, sfrom: ConfNoteSet) {....raises: [], tags: [].}
Assign between two specified note sets   Source   Edit
proc assignIfDefault[T](result: var T; val: T; def = default(T))
if result was already assigned to a value (that wasn't def), this is a noop.   Source   Edit
proc canonDynlibName(s: string): string {....raises: [], tags: [].}
Get 'canonical' dynamic library name - without optional lib prefix on linux and optional version pattern or extension. libgit2.so -> git2   Source   Edit
proc canonicalImport(conf: ConfigRef; file: AbsoluteFile): string {.
    ...raises: [KeyError, Exception], tags: [ReadDirEffect, RootEffect].}

Shows the canonical module import, e.g.: system, std/tables, fusion/pointers, system/assertions, std/private/asciitables

A canonical import path is:

  • typically pkgroot/pkgsubpath/module
  • if a module is at the base of a package, then pkgroot/module
  • if a module is within the project's package, pkgroot is skipped like so pkgsubpath/module or module (if the module is at the package root).
  Source   Edit
proc canonicalImportAux(conf: ConfigRef; file: AbsoluteFile): string {.
    ...raises: [KeyError, Exception], tags: [ReadDirEffect, RootEffect].}
canonical module import filename, e.g.: system.nim, std/tables.nim, system/assertions.nim, etc. Canonical module import filenames follow the same rules as canonical imports (see canonicalImport), except the module name is followed by a .nim file extension, and the directory separators are OS specific.   Source   Edit
proc canonicalizePath(conf: ConfigRef; path: AbsoluteFile): AbsoluteFile {.
    ...raises: [OSError], tags: [ReadDirEffect].}
  Source   Edit
proc canReport(conf: ConfigRef; id: NodeId): bool {....raises: [], tags: [].}
Check whether report with given ID can actually be written out, or it has already been seen. This check is used to prevent multiple reports from the nkError node.   Source   Edit
proc canReport(conf: ConfigRef; node: PNode): bool {....raises: [], tags: [].}
Check whether nkError node can be reported   Source   Edit
proc clearNimblePath(conf: ConfigRef) {....raises: [], tags: [].}
  Source   Edit
proc cmdlineNotes(conf: ConfigRef): ReportKinds {....raises: [], tags: [].}
Get list of report filters modified from the command line   Source   Edit
proc cmdlineNotes=(conf: ConfigRef; nset: ReportKinds) {....raises: [], tags: [].}
Set list of notes modified from the CLI   Source   Edit
proc completeGeneratedExtFilePath(conf: ConfigRef; f: AbsoluteFile): AbsoluteFile {.
    ...raises: [OSError, IOError],
    tags: [ReadEnvEffect, ReadIOEffect, WriteDirEffect, ReadDirEffect].}
Returns the absolute file path within the cache directory for file f. This procedure is meant to be used for external files with names not controlled by the compiler -- a sub-directory is used to prevent collisions.   Source   Edit
proc completeGeneratedFilePath(conf: ConfigRef; f: AbsoluteFile;
                               createSubDir: bool = true): AbsoluteFile {.
    ...raises: [OSError, IOError],
    tags: [ReadEnvEffect, ReadIOEffect, WriteDirEffect, ReadDirEffect].}
  Source   Edit
func contains(s: var ReportSet; id: NodeId): bool {....raises: [], tags: [].}
  Source   Edit
proc countDefinedSymbols(conf: ConfigRef): int {....raises: [], tags: [].}
  Source   Edit
proc cppDefine(c: ConfigRef; define: string) {....raises: [], tags: [].}
  Source   Edit
proc defineSymbol(conf: ConfigRef; symbol: string; value: string = "true") {.
    ...raises: [], tags: [].}
  Source   Edit
proc demanglePackageName(path: string): string {....raises: [], tags: [].}
  Source   Edit
proc disableNimblePath(conf: ConfigRef) {....raises: [], tags: [].}
  Source   Edit
proc excl(conf: ConfigRef; nset: ConfNoteSet; note: ReportKind) {....raises: [],
    tags: [].}
Exclude report kind from the specified note set   Source   Edit
proc existsConfigVar(conf: ConfigRef; key: string): bool {....raises: [], tags: [].}
  Source   Edit
proc fileInfoIdx(conf: ConfigRef; filename: AbsoluteFile): FileIndex {.
    ...raises: [KeyError, Exception], tags: [ReadDirEffect, RootEffect].}
  Source   Edit
proc fileInfoIdx(conf: ConfigRef; filename: AbsoluteFile; isKnownFile: var bool): FileIndex {.
    ...raises: [KeyError, Exception], tags: [ReadDirEffect, RootEffect].}
  Source   Edit
proc fileInfoKnown(conf: ConfigRef; filename: AbsoluteFile): bool {....raises: [],
    tags: [ReadDirEffect].}
  Source   Edit
proc findFile(conf: ConfigRef; f: string; suppressStdlib = false): AbsoluteFile {.
    ...raises: [OSError], tags: [ReadDirEffect].}
Find module file using search paths or lazy search paths (in that order). If suppress stdlib is used - do not try to return files that start with current conf.libpath prefix. First explicit search paths are queried, and then lazy load paths (generated from directories) are used.   Source   Edit
proc findModule(conf: ConfigRef; modulename, currentModule: string): AbsoluteFile {.
    ...raises: [OSError], tags: [ReadDirEffect].}

Return absolute path to the imported module modulename. Imported path can be relative to the currentModule, absolute one, std/ or pkg/-prefixed. In case of pkg/ prefix it is dropped and search is performed again, while ignoring stdlib.

Search priority is

  1. pkg/ prefix
  2. Stdlib prefix
  3. Relative to the current file
  4. Search in the --path (see findFile and rawFindFile)

If the module is found and exists module override, apply it last.

  Source   Edit
proc findProjectNimFile(conf: ConfigRef; pkg: string): string {.
    ...raises: [OSError], tags: [ReadDirEffect].}
Find configuration file for a current project   Source   Edit
proc flip(conf: ConfigRef; nset: ConfNoteSet; note: ReportKind; state: bool) {.
    ...raises: [], tags: [].}
Include or exlude node from the specified note set based on the state   Source   Edit
proc floatInt64Align(conf: ConfigRef): int16 {....raises: [], tags: [].}
Returns either 4 or 8 depending on reasons.   Source   Edit
proc foreignPackageNotes(conf: ConfigRef): ReportKinds {....raises: [], tags: [].}
Get list of reports for foreign packages   Source   Edit
proc foreignPackageNotes=(conf: ConfigRef; nset: ReportKinds) {....raises: [],
    tags: [].}
Set list of notes for foreign packages   Source   Edit
proc getClockStr(): string {....raises: [], tags: [ReadEnvEffect, TimeEffect].}
  Source   Edit
proc getCompileOptionsStr(conf: ConfigRef): string {....raises: [], tags: [].}

Returns the combination of the current C compile options and the global --passC options (combined in that exact order).

Global --passC options already present in the current C compile options are not include again.

  Source   Edit
proc getConfigVar(conf: ConfigRef; key: string; default = ""): string {.
    ...raises: [], tags: [].}
  Source   Edit
proc getDateStr(): string {....raises: [], tags: [ReadEnvEffect, TimeEffect].}
  Source   Edit
proc getDefined(conf: ConfigRef; sym: string): string {....raises: [KeyError],
    tags: [].}
  Source   Edit
proc getLinkOptionsStr(conf: ConfigRef): string {....raises: [], tags: [].}
Returns the combination of the current C linker options and the global --passL options (combined in that exact order).   Source   Edit
proc getNimcacheDir(conf: ConfigRef): AbsoluteDir {....raises: [OSError],
    tags: [ReadEnvEffect, ReadIOEffect].}
  Source   Edit
proc getNimcacheDir(conf: CurrentConf): AbsoluteDir {....raises: [OSError],
    tags: [ReadEnvEffect, ReadIOEffect].}
  Source   Edit
proc getOutFile(conf: ConfigRef; filename: RelativeFile; ext: string): AbsoluteFile {.
    ...raises: [OSError], tags: [].}
  Source   Edit
proc getPkgDesc(conf: ConfigRef; modulePath: string): PkgDesc {.
    ...raises: [KeyError, Exception], tags: [ReadDirEffect, RootEffect].}
get a description of a package for a given module path   Source   Edit
proc getPrefixDir(conf: ConfigRef): AbsoluteDir {....raises: [],
    tags: [ReadIOEffect].}

Gets the prefix dir, usually the parent directory where the binary resides.

This is overridden by some tools (namely nimsuggest) via the conf.prefixDir field. This should resolve to root of nim sources, whether running nim from a local clone or using installed nim, so that these exist: result/doc/advopt.txt and result/lib/system.nim

  Source   Edit
proc getRelativePathFromConfigPath(conf: ConfigRef; f: AbsoluteFile;
                                   isTitle = false): RelativeFile {.
    ...raises: [Exception], tags: [RootEffect].}
  Source   Edit
proc getReportHook(conf: ConfigRef): ReportHook {....raises: [], tags: [].}
Get active report hook   Source   Edit
proc getStdlibVersion(conf: ConfigRef): NimVer {....raises: [ValueError], tags: [].}
  Source   Edit
proc hasHint(conf: ConfigRef; note: ReportKind): bool {....raises: [], tags: [].}
  Source   Edit
proc hasWarn(conf: ConfigRef; note: ReportKind): bool {.inline, ...raises: [],
    tags: [].}
Check if warnings are enabled and specific report kind is contained in the notes   Source   Edit
proc hintsAsErrors(conf: ConfigRef): ReportKinds {....raises: [], tags: [].}
Get list of hint notes that are treated like errors   Source   Edit
proc hintsAsErrors=(conf: ConfigRef; nset: ReportKinds) {....raises: [], tags: [].}
Set list of hint notes that are treated like erorrs   Source   Edit
proc importantComments(conf: ConfigRef): bool {.inline, ...raises: [], tags: [].}
  Source   Edit
proc incl(conf: ConfigRef; nset: ConfNoteSet; note: ReportKind) {....raises: [],
    tags: [].}
Include report kind in specified note set   Source   Edit
func incl(s: var ReportSet; id: NodeId) {....raises: [], tags: [].}
  Source   Edit
proc inclDynlibOverride(conf: ConfigRef; lib: string) {....raises: [], tags: [].}
  Source   Edit
func inDebug(conf: ConfigRef): bool {....deprecated: "DEBUG proc, do not use in the final build!",
                                      noSideEffect, ...raises: [], tags: [].}
Deprecated: DEBUG proc, do not use in the final build!
Check whether 'nim compiler debug' is defined right now.   Source   Edit
proc inFile(conf: ConfigRef; info: TLineInfo; file: string;
            lrange: Slice[int] = low(int) .. high(int)): bool {.
    ...deprecated: "DEBUG proc, do not use in the final build!", noSideEffect,
    ...raises: [], tags: [].}
Deprecated: DEBUG proc, do not use in the final build!
true if info has filename and is within the specified line range (lrange), else false. Meant for debugging -- it's slow.   Source   Edit
proc initMsgConfig(): MsgConfig {....raises: [], tags: [].}
  Source   Edit
func isCodeError(conf: ConfigRef; report: Report): bool {....raises: [], tags: [].}
Check if report stores a regular code error, or warning/hint that has been configured to be treated as error under "warningAsError"   Source   Edit
proc isDefined(conf: ConfigRef; symbol: string): bool {....raises: [], tags: [].}
  Source   Edit
proc isDefined(conf: CurrentConf; symbol: string): bool {....raises: [], tags: [].}
  Source   Edit
proc isDynlibOverride(conf: ConfigRef; lib: string): bool {....raises: [], tags: [].}
  Source   Edit
func isEnabled(conf: ConfigRef; report: Report): bool {....raises: [], tags: [].}
Macro expansion configuration is done via --expandMacro=name configuration, and requires full report information to check.   Source   Edit
func isEnabled(conf: ConfigRef; report: ReportKind): bool {....raises: [], tags: [].}
Check whether report kind is allowed to be generated by the compiler. Uses options.hasHint, options.hasWarn to check whether particular report is enabled, otherwise use query global/local options.   Source   Edit
proc mainCommandArg(conf: ConfigRef): string {....raises: [], tags: [].}
This is intended for commands like check or parse which will work on the main project file unless explicitly given a specific file argument   Source   Edit
proc mainPackageNotes(conf: ConfigRef): ReportKinds {....raises: [], tags: [].}
Get list of notes for main package   Source   Edit
proc mainPackageNotes=(conf: ConfigRef; nset: ReportKinds) {....raises: [],
    tags: [].}
Set list of notes for main package   Source   Edit
proc makeCString(s: string): string {....raises: [], tags: [].}
  Source   Edit
proc modifiedyNotes(conf: ConfigRef): ReportKinds {....raises: [], tags: [].}
Get list of reports modified from the command line or config   Source   Edit
proc modifiedyNotes=(conf: ConfigRef; nset: ReportKinds) {....raises: [], tags: [].}
Set list of notes modified from the cli/config   Source   Edit
proc newConfigRef(hook: ReportHook): ConfigRef {....raises: [], tags: [].}
  Source   Edit
proc newLineInfo(conf: ConfigRef; filename: AbsoluteFile; line, col: int): TLineInfo {.
    inline, ...raises: [KeyError, Exception], tags: [ReadDirEffect, RootEffect].}
  Source   Edit
proc newPartialConfigRef(): ConfigRef {....raises: [], tags: [].}
create a new ConfigRef that is only good enough for error reporting.   Source   Edit
proc notes(conf: ConfigRef): ReportKinds {....raises: [], tags: [].}
Get list of active notes   Source   Edit
proc notes=(conf: ConfigRef; nset: ReportKinds) {....raises: [], tags: [].}
Set list of active notes   Source   Edit
func options(conf: ConfigRef): TOptions {....raises: [], tags: [].}
Get list of active local options   Source   Edit
proc options=(conf: ConfigRef; opts: TOptions) {....raises: [], tags: [].}
Assign to list of active local options   Source   Edit
proc parseIdeCmd(s: string): IdeCmd {....raises: [], tags: [].}
  Source   Edit
proc parseNimVersion(a: string): NimVer {....raises: [ValueError], tags: [].}
  Source   Edit
proc pathSubs(conf: ConfigRef; p, config: string): string {.
    ...raises: [ValueError, OSError], tags: [ReadEnvEffect, ReadIOEffect].}
Substitute text p with configuration paths, such as project name, nim cache directory, project directory etc. config is an argument of the configuration file path in case $config template is used.   Source   Edit
proc prepareToWriteOutput(conf: ConfigRef): AbsoluteFile {.
    ...raises: [OSError, IOError], tags: [ReadDirEffect, WriteDirEffect].}
Create the output directory and returns a full path to the output file   Source   Edit
proc removeTrailingDirSep(path: string): string {....raises: [], tags: [].}
  Source   Edit
proc report(conf: ConfigRef; inReport: Report): TErrorHandling {.
    ...raises: [Exception], tags: [RootEffect].}
Write inReport   Source   Edit
proc setConfigVar(conf: ConfigRef; key, val: string) {....raises: [], tags: [].}
  Source   Edit
proc setDefaultLibpath(conf: ConfigRef) {....raises: [OSError],
    tags: [ReadIOEffect, ReadDirEffect, ReadEnvEffect].}
set default value (can be overwritten):   Source   Edit
proc setFromProjectName(conf: ConfigRef; projectName: string) {.
    ...raises: [OSError], tags: [ReadDirEffect].}
  Source   Edit
proc setNote(conf: ConfigRef; note: ReportKind; enabled = true) {....raises: [],
    tags: [].}
see also prepareConfigNotes which sets notes   Source   Edit
proc setNoteDefaults(conf: ConfigRef; note: ReportKind; enabled = true) {.
    ...raises: [], tags: [].}
  Source   Edit
proc setReportHook(conf: ConfigRef; hook: ReportHook) {....raises: [], tags: [].}
Set active report hook. Must not be nil   Source   Edit
func severity(conf: ConfigRef; report: ReportTypes | Report): ReportSeverity
  Source   Edit
proc toCChar(c: char; result: var string) {.inline, ...raises: [], tags: [].}
  Source   Edit
proc toGeneratedFile(conf: CurrentConf | ConfigRef; path: AbsoluteFile;
                     ext: string): AbsoluteFile
converts "/home/a/mymodule.nim", "rod" to "/home/a/nimskullcache/mymodule.rod"   Source   Edit
proc toRodFile(conf: ConfigRef; f: AbsoluteFile; ext = RodExt): AbsoluteFile {.
    ...raises: [OSError, IOError, KeyError, Exception], tags: [ReadEnvEffect,
    ReadIOEffect, WriteDirEffect, ReadDirEffect, RootEffect].}
  Source   Edit
proc undefSymbol(conf: ConfigRef; symbol: string) {....raises: [], tags: [].}
  Source   Edit
func useColor(conf: ConfigRef): bool {....raises: [], tags: [].}
  Source   Edit
proc warningAsErrors(conf: ConfigRef): ReportKinds {....raises: [], tags: [].}
Get list of warning notes that are treated like errors   Source   Edit
proc warningAsErrors=(conf: ConfigRef; nset: ReportKinds) {....raises: [], tags: [].}
Set list of warning notes to be treated as errors   Source   Edit
proc withPackageName(conf: ConfigRef; path: AbsoluteFile): AbsoluteFile {.
    ...raises: [KeyError, OSError, Exception], tags: [ReadDirEffect, RootEffect].}
  Source   Edit
func writabilityKind(conf: ConfigRef; r: Report): ReportWritabilityKind {.
    ...raises: [], tags: [].}
  Source   Edit
proc write(conf: ConfigRef; args: varargs[string, `$`]) {....raises: [Exception],
    tags: [RootEffect].}
write hook overload for varargs   Source   Edit
proc writeHook(conf: ConfigRef; msg: string; flags: MsgFlags = {}) {.
    ...raises: [Exception], tags: [RootEffect].}
Write string using write hook   Source   Edit
proc writeln(conf: ConfigRef; args: varargs[string, `$`]) {....raises: [Exception],
    tags: [RootEffect].}
writeln hook overload for varargs   Source   Edit
proc writelnHook(conf: ConfigRef; msg: string; flags: MsgFlags = {}) {.
    ...raises: [Exception], tags: [RootEffect].}
Write string using writeln hook   Source   Edit

Iterators

iterator definedSymbolNames(conf: ConfigRef): string {....raises: [], tags: [].}
  Source   Edit
iterator nimbleSubs(conf: ConfigRef; p: string): string {....raises: [ValueError],
    tags: [].}
Iterate over possible interpolations of the path string p and known package directories.   Source   Edit

Templates

template `[]`(conf: ConfigRef; idx: FileIndex): TFileInfo
  Source   Edit
template arcToExpand(conf`gensym76: ConfigRef): StringTableRef
  Source   Edit
template arcToExpand=(conf`gensym76: ConfigRef; val`gensym76: StringTableRef)
  Source   Edit
template arcToExpandDel(conf`gensym75: ConfigRef; key`gensym75: string)
  Source   Edit
template arcToExpandGet(conf`gensym75: ConfigRef; key`gensym75: string): string
  Source   Edit
template arcToExpandSet(conf`gensym75: ConfigRef; key`gensym75: string;
                        value`gensym75: string)
  Source   Edit
template backend(conf`gensym22: ConfigRef): TBackend
  Source   Edit
template backend=(conf`gensym22: ConfigRef; val`gensym22: TBackend)
  Source   Edit
template cCompiler(conf`gensym32: ConfigRef): TSystemCC
  Source   Edit
template cCompiler=(conf`gensym32: ConfigRef; val`gensym32: TSystemCC)
  Source   Edit
template cIncludes(conf`gensym46: ConfigRef): seq[AbsoluteDir]
  Source   Edit
template cIncludes=(conf`gensym46: ConfigRef; val`gensym46: seq[AbsoluteDir])
  Source   Edit
template cIncludesAdd(conf`gensym45: ConfigRef;
                      item`gensym45: AbsoluteDir | seq[AbsoluteDir])
  Source   Edit
template cLibs(conf`gensym48: ConfigRef): seq[AbsoluteDir]
  Source   Edit
template cLibs=(conf`gensym48: ConfigRef; val`gensym48: seq[AbsoluteDir])
  Source   Edit
template cLibsAdd(conf`gensym47: ConfigRef;
                  item`gensym47: AbsoluteDir | seq[AbsoluteDir])
  Source   Edit
template cLinkedLibs(conf`gensym50: ConfigRef): seq[string]
  Source   Edit
template cLinkedLibs=(conf`gensym50: ConfigRef; val`gensym50: seq[string])
  Source   Edit
template cLinkedLibsAdd(conf`gensym49: ConfigRef;
                        item`gensym49: string | seq[string])
  Source   Edit
template cmd(conf`gensym29: ConfigRef): Command
  Source   Edit
template cmd=(conf`gensym29: ConfigRef; val`gensym29: Command)
  Source   Edit
template compilationCachePresent(conf: ConfigRef): untyped
  Source   Edit
template compileOptionsCmd(conf`gensym54: ConfigRef): seq[string]
  Source   Edit
template compileOptionsCmd=(conf`gensym54: ConfigRef;
                            val`gensym54: seq[string])
  Source   Edit
template compileOptionsCmdAdd(conf`gensym53: ConfigRef;
                              item`gensym53: string | seq[string])
  Source   Edit
template configVars(conf`gensym70: ConfigRef): StringTableRef
  Source   Edit
template configVars=(conf`gensym70: ConfigRef; val`gensym70: StringTableRef)
  Source   Edit
template configVarsDel(conf`gensym69: ConfigRef; key`gensym69: string)
  Source   Edit
template configVarsGet(conf`gensym69: ConfigRef; key`gensym69: string): string
  Source   Edit
template configVarsSet(conf`gensym69: ConfigRef; key`gensym69: string;
                       value`gensym69: string)
  Source   Edit
template cppDefines(conf`gensym28: ConfigRef): HashSet[string]
  Source   Edit
template cppDefines=(conf`gensym28: ConfigRef; val`gensym28: HashSet[string])
  Source   Edit
template depfile(conf`gensym37: ConfigRef): AbsoluteFile
  Source   Edit
template depfile=(conf`gensym37: ConfigRef; val`gensym37: AbsoluteFile)
  Source   Edit
template dllOverrides(conf`gensym68: ConfigRef): StringTableRef
  Source   Edit
template dllOverrides=(conf`gensym68: ConfigRef; val`gensym68: StringTableRef)
  Source   Edit
template dllOverridesDel(conf`gensym67: ConfigRef; key`gensym67: string)
  Source   Edit
template dllOverridesGet(conf`gensym67: ConfigRef; key`gensym67: string): string
  Source   Edit
template dllOverridesSet(conf`gensym67: ConfigRef; key`gensym67: string;
                         value`gensym67: string)
  Source   Edit
template exc(conf`gensym31: ConfigRef): ExceptionSystem
  Source   Edit
template exc=(conf`gensym31: ConfigRef; val`gensym31: ExceptionSystem)
  Source   Edit
template excl(conf`gensym61: ConfigRef; item`gensym61: TOption | TOptions)
  Source   Edit
template excl(conf`gensym63: ConfigRef;
              item`gensym63: TGlobalOption | TGlobalOptions)
  Source   Edit
template excl(conf`gensym65: ConfigRef; item`gensym65: Feature | set[Feature])
  Source   Edit
template features(conf`gensym66: ConfigRef): set[Feature]
  Source   Edit
template features=(conf`gensym66: ConfigRef; val`gensym66: set[Feature])
  Source   Edit
template filenameOption(conf`gensym33: ConfigRef): FilenameOption
  Source   Edit
template filenameOption=(conf`gensym33: ConfigRef; val`gensym33: FilenameOption)
  Source   Edit
template globalOptions(conf`gensym64: ConfigRef): TGlobalOptions
  Source   Edit
template globalOptions=(conf`gensym64: ConfigRef; val`gensym64: TGlobalOptions)
  Source   Edit
template implicitImports(conf`gensym42: ConfigRef): seq[string]
  Source   Edit
template implicitImports=(conf`gensym42: ConfigRef;
                          val`gensym42: seq[string])
  Source   Edit
template implicitImportsAdd(conf`gensym41: ConfigRef;
                            item`gensym41: string | seq[string])
  Source   Edit
template implicitIncludes(conf`gensym44: ConfigRef): seq[string]
  Source   Edit
template implicitIncludes=(conf`gensym44: ConfigRef;
                           val`gensym44: seq[string])
  Source   Edit
template implicitIncludesAdd(conf`gensym43: ConfigRef;
                             item`gensym43: string | seq[string])
  Source   Edit
template incl(conf`gensym61: ConfigRef; item`gensym61: TOption | TOptions)
  Source   Edit
template incl(conf`gensym63: ConfigRef;
              item`gensym63: TGlobalOption | TGlobalOptions)
  Source   Edit
template incl(conf`gensym65: ConfigRef; item`gensym65: Feature | set[Feature])
  Source   Edit
template isDebugEnabled(c: ConfigRef; ir: IrName; name: string): bool
Whether printing the ir IR is enabled specifically for the given name.   Source   Edit
template lazyPaths(conf`gensym60: ConfigRef): seq[AbsoluteDir]
  Source   Edit
template lazyPaths=(conf`gensym60: ConfigRef; val`gensym60: seq[AbsoluteDir])
  Source   Edit
template lazyPathsAdd(conf`gensym59: ConfigRef;
                      item`gensym59: AbsoluteDir | seq[AbsoluteDir])
  Source   Edit
template libpath(conf`gensym25: ConfigRef): AbsoluteDir
  Source   Edit
template libpath=(conf`gensym25: ConfigRef; val`gensym25: AbsoluteDir)
  Source   Edit
template linkOptionsCmd(conf`gensym52: ConfigRef): seq[string]
  Source   Edit
template linkOptionsCmd=(conf`gensym52: ConfigRef; val`gensym52: seq[string])
  Source   Edit
template linkOptionsCmdAdd(conf`gensym51: ConfigRef;
                           item`gensym51: string | seq[string])
  Source   Edit
template localOptions(conf`gensym62: ConfigRef): TOptions
  Source   Edit
template localOptions=(conf`gensym62: ConfigRef; val`gensym62: TOptions)
  Source   Edit
template macrosToExpand(conf`gensym74: ConfigRef): StringTableRef
  Source   Edit
template macrosToExpand=(conf`gensym74: ConfigRef; val`gensym74: StringTableRef)
  Source   Edit
template macrosToExpandDel(conf`gensym73: ConfigRef; key`gensym73: string)
  Source   Edit
template macrosToExpandGet(conf`gensym73: ConfigRef; key`gensym73: string): string
  Source   Edit
template macrosToExpandSet(conf`gensym73: ConfigRef; key`gensym73: string;
                           value`gensym73: string)
  Source   Edit
template newPackageCache(): untyped
  Source   Edit
template nimblePaths(conf`gensym56: ConfigRef): seq[AbsoluteDir]
  Source   Edit
template nimblePaths=(conf`gensym56: ConfigRef;
                      val`gensym56: seq[AbsoluteDir])
  Source   Edit
template nimblePathsAdd(conf`gensym55: ConfigRef;
                        item`gensym55: AbsoluteDir | seq[AbsoluteDir])
  Source   Edit
template nimcacheDir(conf`gensym26: ConfigRef): AbsoluteDir
  Source   Edit
template nimcacheDir=(conf`gensym26: ConfigRef; val`gensym26: AbsoluteDir)
  Source   Edit
template numberOfProcessors(conf`gensym34: ConfigRef): int
  Source   Edit
template numberOfProcessors=(conf`gensym34: ConfigRef; val`gensym34: int)
  Source   Edit
template optPreserveOrigSource(conf: ConfigRef): untyped
  Source   Edit
template outDir(conf`gensym36: ConfigRef): AbsoluteDir
  Source   Edit
template outDir=(conf`gensym36: ConfigRef; val`gensym36: AbsoluteDir)
  Source   Edit
template outFile(conf`gensym35: ConfigRef): RelativeFile
  Source   Edit
template outFile=(conf`gensym35: ConfigRef; val`gensym35: RelativeFile)
  Source   Edit
template prefixDir(conf`gensym24: ConfigRef): AbsoluteDir
  Source   Edit
template prefixDir=(conf`gensym24: ConfigRef; val`gensym24: AbsoluteDir)
  Source   Edit
template projectFull(conf`gensym40: ConfigRef): AbsoluteFile
  Source   Edit
template projectFull=(conf`gensym40: ConfigRef; val`gensym40: AbsoluteFile)
  Source   Edit
template projectName(conf`gensym39: ConfigRef): string
  Source   Edit
template projectName=(conf`gensym39: ConfigRef; val`gensym39: string)
  Source   Edit
template projectPath(conf`gensym38: ConfigRef): AbsoluteDir
  Source   Edit
template projectPath=(conf`gensym38: ConfigRef; val`gensym38: AbsoluteDir)
  Source   Edit
template quitOrRaise(conf: ConfigRef; msg = "")
  Source   Edit
template report[R: ReportTypes](conf: ConfigRef; inReport: R): TErrorHandling
Pass structured report object into conf.structuredReportHook, converting to Report variant and updaing instantiation info.   Source   Edit
template report[R: ReportTypes](conf: ConfigRef; tinfo: TLineInfo; inReport: R): TErrorHandling
Write out new report, updating it's location info using tinfo and it's instantiation info with instantiationInfo() of the template.   Source   Edit
template searchPaths(conf`gensym58: ConfigRef): seq[AbsoluteDir]
  Source   Edit
template searchPaths=(conf`gensym58: ConfigRef;
                      val`gensym58: seq[AbsoluteDir])
  Source   Edit
template searchPathsAdd(conf`gensym57: ConfigRef;
                        item`gensym57: AbsoluteDir | seq[AbsoluteDir])
  Source   Edit
template selectedGC(conf`gensym30: ConfigRef): TGCMode
  Source   Edit
template selectedGC=(conf`gensym30: ConfigRef; val`gensym30: TGCMode)
  Source   Edit
template setErrorMaxHighMaybe(conf: ConfigRef)
do not stop after first error (but honor --errorMax if provided)   Source   Edit
template symbolFiles(conf`gensym23: ConfigRef): SymbolFilesOption
  Source   Edit
template symbolFiles=(conf`gensym23: ConfigRef; val`gensym23: SymbolFilesOption)
  Source   Edit
template symbols(conf`gensym72: ConfigRef): StringTableRef
  Source   Edit
template symbols=(conf`gensym72: ConfigRef; val`gensym72: StringTableRef)
  Source   Edit
template symbolsDel(conf`gensym71: ConfigRef; key`gensym71: string)
  Source   Edit
template symbolsGet(conf`gensym71: ConfigRef; key`gensym71: string): string
  Source   Edit
template symbolsSet(conf`gensym71: ConfigRef; key`gensym71: string;
                    value`gensym71: string)
  Source   Edit
template target(conf`gensym27: ConfigRef): Target
  Source   Edit
template target=(conf`gensym27: ConfigRef; val`gensym27: Target)
  Source   Edit
template toFilename(conf: ConfigRef; fileIdx: FileIndex): string
  Source   Edit
template toFilename(conf: ConfigRef; info: TLineInfo): string
  Source   Edit