summary refs log tree commit diff stats
path: root/compiler/options.nim
Commit message (Expand)AuthorAgeFilesLines
* fix #6583, fix #14376, index+search now generated for all projects, many bug ...Timothee Cour2020-05-251-3/+5
* change the [Processing] messages into dots (#14418)Andreas Rumpf2020-05-211-0/+1
* fix some issues with --backend (#14363)Timothee Cour2020-05-161-2/+2
* `nim doc --backend:js`, `nim doc --doccmd:-d:foo`, `nim r --backend:js`, `--d...Timothee Cour2020-05-111-6/+26
* added a new feature: --cc:env so that you can use any C compiler as long as i...Andreas Rumpf2020-05-061-1/+1
* cleanup the CC setting, only leave in there what is at least semi-officially ...Andreas Rumpf2020-05-061-2/+2
* fixes #14112, tests for #12892, #12671, #11697 (#14125)hlaaftana2020-04-261-1/+2
* new cmd: `nim r main [args...]` to compile & run, saving binary under $nimcac...Timothee Cour2020-04-231-7/+9
* remove the nilChecks switch; refs #11570Araq2020-04-201-3/+3
* add `--experimental:vmopsDanger`; add generic conversion for vmops (#13813)Timothee Cour2020-04-201-0/+1
* Add support for `zig cc` as C compiler. (#13757)Hessam Mehr2020-04-081-1/+1
* new feature: ability to turn specific warnings to errorsAndreas Rumpf2020-04-041-0/+1
* sourcemaps for the JS codegen (#7508)Alexander Ivanov2020-04-031-0/+2
* stacktraces can now show custom runtime msgs per frame (#13351)Timothee Cour2020-03-301-2/+4
* '.push raises: []' now also affects proc types (#13776)Andreas Rumpf2020-03-291-0/+1
* bump copyright year to 2020 (#13753)Miran2020-03-251-1/+1
* new feature: --staticBoundChecks:on to enforce static array index checking (#...Andreas Rumpf2020-03-181-2/+2
* fix #13218: avoid some irrelevant warnings for nim doc,rst2html,--app:lib, + ...Timothee Cour2020-03-131-0/+8
* catchable defects (#13626)Andreas Rumpf2020-03-121-4/+7
* sink parameter inference for types that have destructors (#13544)Andreas Rumpf2020-03-041-3/+4
* properly handle note override logic/verbosity/config/cmdline using modifiedyN...Timothee Cour2020-02-271-5/+7
* remove isCmdLine; use passCmd1Timothee Cour2020-02-271-2/+0
* correctly honor cmdline --hint:conf:on/off ; correctly show Conf hints in orderTimothee Cour2020-02-271-0/+4
* fix #8312 --hints:off and --warnings:off now honored everywhere (#13489)Timothee Cour2020-02-261-0/+6
* fix #13150 `nim doc --project` now works reliably (#13223)Timothee Cour2020-02-061-0/+19
* make goto based exceptions available for 'nim cpp' (#13244)Andreas Rumpf2020-01-251-0/+1
* VM: allow overriding MaxLoopIterations without rebuilding nim (#13233)Timothee Cour2020-01-231-1/+3
* fixes #12998 nim doc regression (#13117)Timothee Cour2020-01-161-0/+3
* successX now correctly shows html output for `nim doc`, `nim jsondoc`; fix #1...Timothee Cour2020-01-151-2/+0
* make SuccessX show project file + output file (#13043)Timothee Cour2020-01-081-0/+2
* --exception:goto switch for deterministic exception handling (#12977)Andreas Rumpf2020-01-011-1/+7
* fixes #12735 on osx, call dsymutil for debug builds (#12931)Timothee Cour2019-12-211-0/+1
* ARC: cycle detector (#12823)Andreas Rumpf2019-12-171-1/+1
* Path substitution for --out and --outdir (#12796)genotrance2019-12-031-3/+1
* Fixes #12767 (#12768)genotrance2019-11-291-0/+2
* Cosmetic compiler cleanup (#12718)Clyybber2019-11-281-5/+5
* Substitute $nimbleDir in --path flags (#12750)genotrance2019-11-281-0/+10
* implemented a new localPassc pragma (#12706)Andreas Rumpf2019-11-221-1/+2
* added the --asm command line option for inspection of the produced assember c...Andreas Rumpf2019-11-211-0/+1
* conversions to unsigned numbers are not checked anymore; implements /… (#12...Andreas Rumpf2019-11-201-0/+4
* add --clearNimblePath; fixes #12601 (#12609)Andy Davidoff2019-11-061-0/+3
* --os:ios needs to imply defined(macosx) [backport] (#12585)Andreas Rumpf2019-11-041-1/+1
* --gc:destructors now means Nim uses pure refcounting (#12557)Andreas Rumpf2019-10-301-0/+1
* refactoring: --newruntime consists of 3 different switchesAraq2019-10-201-1/+5
* compiler/options: only check the last folder for a candidate (#12421)alaviss2019-10-161-9/+8
* compiler/options: improve project file detection (#12404)alaviss2019-10-111-6/+26
* nimsuggest: add a command that returns the project file (#12411)alaviss2019-10-111-1/+3
* added cpuTime to VM (#12346)Ico Doornekamp2019-10-041-0/+1
* Fix spellings (#12277) [backport]Federico Ceratto2019-09-271-1/+1
* fixes the --verbosity:2 regression [backport]Andreas Rumpf2019-09-241-1/+1
'alt'>
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78


                            
                                         




                                                   


                                                                             
 

                
    

                           
                     

                    
                   








                                
                                               






                           
                                                                     
                                  
                      

                                                        
                           
           
                                                                                
 
                                                                              
                       

                                                                          

                                                       
 



                                 





                          
                                                         



                                      
                                                                     
 
                                                        



                                     
                                                                   
#
#
#           The Nim Compiler
#        (c) Copyright 2017 Andreas Rumpf
#
#    See the file "copying.txt", included in this
#    distribution, for details about the copyright.
#

## The compiler can generate debuginfo to help debuggers in translating back
## from C/C++/JS code to Nim. The data structure has been designed to produce
## something useful with Nim's marshal module.

import sighashes

type
  FilenameMapping* = object
    package*, file*: string
    mangled*: SigHash
  EnumDesc* = object
    size*: int
    owner*: SigHash
    id*: int
    name*: string
    values*: seq[(string, int)]
  DebugInfo* = object
    version*: int
    files*: seq[FilenameMapping]
    enums*: seq[EnumDesc]
    conflicts*: bool

proc sdbmHash(package, file: string): SigHash =
  result = 0
  for i in 0..<package.len:
    result &= package[i]
  result &= '.'
  for i in 0..<file.len:
    result &= file[i]

proc register*(self: var DebugInfo; package, file: string): SigHash =
  result = sdbmHash(package, file)
  for f in self.files:
    if f.mangled == result:
      if f.package == package and f.file == file: return
      self.conflicts = true
      break
  self.files.add(FilenameMapping(package: package, file: file, mangled: result))

proc hasEnum*(self: DebugInfo; ename: string; id: int; owner: SigHash): bool =
  for en in self.enums:
    if en.owner == owner and en.name == ename and en.id == id: return true

proc registerEnum*(self: var DebugInfo; ed: EnumDesc) =
  self.enums.add ed

proc init*(self: var DebugInfo) =
  self.version = 1
  self.files = @[]
  self.enums = @[]

var gDebugInfo*: DebugInfo
debuginfo.init gDebugInfo

import marshal, streams

proc writeDebugInfo*(self: var DebugInfo; file: string) =
  let s = newFileStream(file, fmWrite)
  store(s, self)
  s.close

proc writeDebugInfo*(file: string) = writeDebugInfo(gDebugInfo, file)

proc loadDebugInfo*(self: var DebugInfo; file: string) =
  let s = newFileStream(file, fmRead)
  load(s, self)
  s.close

proc loadDebugInfo*(file: string) = loadDebugInfo(gDebugInfo, file)