summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2016-10-26 14:38:44 +0200
committerGitHub <noreply@github.com>2016-10-26 14:38:44 +0200
commitb6807b547d8655e33f986bf70cecfab6e7a7c8a9 (patch)
tree2bfa5a1f45028540dd2dd1950b9117b00100a57e
parenta612e1b24912623ddca4ea39c5ebc606e977f372 (diff)
parent29d31edc0ba4ea3c0666bda719c2551f824c7270 (diff)
downloadNim-b6807b547d8655e33f986bf70cecfab6e7a7c8a9.tar.gz
Merge pull request #4955 from cheatfate/debugcommit1
Generate `NimMainModule` name for main module.
-rw-r--r--compiler/cgen.nim10
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler/cgen.nim b/compiler/cgen.nim
index d80a68609..5acdcd9cb 100644
--- a/compiler/cgen.nim
+++ b/compiler/cgen.nim
@@ -870,7 +870,7 @@ proc genMainProc(m: BModule) =
     NimMainInner = "N_CDECL(void, NimMainInner)(void) {$N" &
         "$1" &
       "}$N$N"
-      
+
     NimMainProc =
       "N_CDECL(void, NimMain)(void) {$N" &
         "\tvoid (*volatile inner)();$N" &
@@ -972,7 +972,13 @@ proc getSomeInitName(m: PSym, suffix: string): Rope =
   result.add m.name.s
   result.add suffix
 
-proc getInitName(m: PSym): Rope = getSomeInitName(m, "Init000")
+proc getInitName(m: PSym): Rope =
+  if sfMainModule in m.flags:
+    # generate constant name for main module, for "easy" debugging.
+    result = rope"NimMainModule"
+  else:
+    result = getSomeInitName(m, "Init000")
+
 proc getDatInitName(m: PSym): Rope = getSomeInitName(m, "DatInit000")
 
 proc registerModuleToMain(m: PSym) =