# # # The Nim Compiler # (c) Copyright 2016 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. type FilenameHash* = uint32 FilenameMapping* = object package*, file*: string mangled*: FilenameHash EnumDesc* = object size*: int owner*: FilenameHash id*: int name*: string values*: seq[(string, int)] DebugInfo* = object version*: int files*: seq[FilenameMapping] enums*: seq[EnumDesc] conflicts*: bool proc sdbmHash(hash: FilenameHash, c: char): FilenameHash {.inline.} = return FilenameHash(c) + (hash shl 6) + (hash shl 16) - hash proc sdbmHash(package, file: string): FilenameHash = template `&=`(x, c) = x = sdbmHash(x, c) result = 0 for i in 0..