add compiler/debugutils.nim to help debugging compiler (#17652)
* add compiler/debugutils.nim * address comments
This commit is contained in:
parent
020c0a3344
commit
6ab5816866
2 changed files with 35 additions and 7 deletions
19
compiler/debugutils.nim
Normal file
19
compiler/debugutils.nim
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
##[
|
||||
Utilities to help with debugging nim compiler.
|
||||
|
||||
Experimental API, subject to change.
|
||||
]##
|
||||
|
||||
import options
|
||||
|
||||
var conf0: ConfigRef
|
||||
|
||||
proc onNewConfigRef*(conf: ConfigRef) {.inline.} =
|
||||
## Caches `conf`, which can be retrieved with `getConfigRef`.
|
||||
## This avoids having to forward `conf` all the way down the call chain to
|
||||
## procs that need it during a debugging session.
|
||||
conf0 = conf
|
||||
|
||||
proc getConfigRef*(): ConfigRef =
|
||||
## nil, if -d:nimDebugUtils wasn't specified
|
||||
result = conf0
|
||||
Loading…
Add table
Add a link
Reference in a new issue