summary refs log tree commit diff stats
path: root/compiler/ic/cbackend.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2021-02-02 19:24:55 +0100
committerGitHub <noreply@github.com>2021-02-02 19:24:55 +0100
commitfb80d2ff85fc5db2996d6660075941e1256564fe (patch)
tree1b463d4213dec1a1b75f4cc3a83c6ee81a66ddc0 /compiler/ic/cbackend.nim
parent1d1c831efa7f9bfcc739b2d38a3a839187bc39c6 (diff)
downloadNim-fb80d2ff85fc5db2996d6660075941e1256564fe.tar.gz
IC: bugfixes (WIP) (#16836)
* minor improvements
* IC: added the required logic for compilerProcs
* LazySym ftw
* we need this testing logic
* reimplement the old way we use for module package creation
* fixes a regression; don't pick module names if you can avoid it
Diffstat (limited to 'compiler/ic/cbackend.nim')
-rw-r--r--compiler/ic/cbackend.nim10
1 files changed, 6 insertions, 4 deletions
diff --git a/compiler/ic/cbackend.nim b/compiler/ic/cbackend.nim
index fbc2d401e..7670b34a6 100644
--- a/compiler/ic/cbackend.nim
+++ b/compiler/ic/cbackend.nim
@@ -51,10 +51,12 @@ proc addFileToLink(config: ConfigRef; m: PSym) =
       elif config.backend == backendObjc: ".nim.m"
       else: ".nim.c"
   let cfile = changeFileExt(completeCfilePath(config, withPackageName(config, filename)), ext)
-  var cf = Cfile(nimname: m.name.s, cname: cfile,
-                 obj: completeCfilePath(config, toObjFile(config, cfile)),
-                 flags: {CfileFlag.Cached})
-  addFileToCompile(config, cf)
+  let objFile = completeCfilePath(config, toObjFile(config, cfile))
+  if fileExists(objFile):
+    var cf = Cfile(nimname: m.name.s, cname: cfile,
+                   obj: objFile,
+                   flags: {CfileFlag.Cached})
+    addFileToCompile(config, cf)
 
 proc aliveSymsChanged(config: ConfigRef; position: int; alive: AliveSyms): bool =
   let asymFile = toRodFile(config, AbsoluteFile toFullPath(config, position.FileIndex), ".alivesyms")