diff options
author | Araq <rumpf_a@web.de> | 2011-10-21 21:02:03 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2011-10-21 21:02:03 +0200 |
commit | d871cadbb3e0fa5a794a8dc3bb61cf7defe8469c (patch) | |
tree | 8b9842a1c06fc1e7d8645ca1d5229cc66c8e0a4e | |
parent | 43eace163a03170475b70a12b24c374daef7e43a (diff) | |
download | Nim-d871cadbb3e0fa5a794a8dc3bb61cf7defe8469c.tar.gz |
got rid of gGeneratedSyms
-rwxr-xr-x | compiler/cgen.nim | 25 | ||||
-rw-r--r-- | compiler/cgendata.nim | 1 |
2 files changed, 16 insertions, 10 deletions
diff --git a/compiler/cgen.nim b/compiler/cgen.nim index d621d2791..2cdbf9159 100755 --- a/compiler/cgen.nim +++ b/compiler/cgen.nim @@ -47,7 +47,11 @@ proc findPendingModule(m: BModule, s: PSym): BModule = for i in countup(0, high(gPendingModules)): result = gPendingModules[i] if result.module.id == ms.id: return - InternalError(s.info, "no pending module found for: " & s.name.s) + # else we found no pending module: This can happen for procs that are in + # a module that is already closed. This is fine, don't generate code for + # it then: + result = nil + #InternalError(s.info, "no pending module found for: " & s.name.s) proc initLoc(result: var TLoc, k: TLocKind, typ: PType, s: TStorageLoc) = result.k = k @@ -599,15 +603,17 @@ proc genProcNoForward(m: BModule, prc: PSym) = if lfNoDecl in prc.loc.Flags: nil elif prc.typ.callConv == ccInline: # We add inline procs to the calling module to enable C based inlining. - # This also means that a check with ``gGeneratedSyms`` is wrong, we need + # This also means that a check with ``q.declaredThings`` is wrong, we need # a check for ``m.declaredThings``. if not ContainsOrIncl(m.declaredThings, prc.id): genProcAux(m, prc) elif lfDynamicLib in prc.loc.flags: - if not ContainsOrIncl(gGeneratedSyms, prc.id): - SymInDynamicLib(findPendingModule(m, prc), prc) - elif sfImportc notin prc.flags: - if not ContainsOrIncl(gGeneratedSyms, prc.id): - genProcAux(findPendingModule(m, prc), prc) + var q = findPendingModule(m, prc) + if q != nil and not ContainsOrIncl(q.declaredThings, prc.id): + SymInDynamicLib(q, prc) + elif sfImportc notin prc.flags: + var q = findPendingModule(m, prc) + if q != nil and not ContainsOrIncl(q.declaredThings, prc.id): + genProcAux(q, prc) proc genProc(m: BModule, prc: PSym) = if sfBorrow in prc.flags: return @@ -659,7 +665,8 @@ proc getFileHeader(cfilenoext: string): PRope = "/* Compiled for: $2, $3, $4 */$n" & "/* Command for C compiler:$n $5 */$n", "; Generated by Nimrod Compiler v$1$n" & - "; (c) 2011 Andreas Rumpf$n" & "; Compiled for: $2, $3, $4$n" & + "; (c) 2011 Andreas Rumpf$n" & + "; Compiled for: $2, $3, $4$n" & "; Command for LLVM compiler:$n $5$n", [toRope(versionAsString), toRope(platform.OS[targetOS].name), toRope(platform.CPU[targetCPU].name), @@ -960,4 +967,4 @@ proc cgenPass(): TPass = result.close = myClose InitIiTable(gToTypeInfoId) -gGeneratedSyms = initIntSet() + diff --git a/compiler/cgendata.nim b/compiler/cgendata.nim index 144ab9304..ffaacb8e8 100644 --- a/compiler/cgendata.nim +++ b/compiler/cgendata.nim @@ -98,7 +98,6 @@ var mainModProcs*, mainModInit*: PRope # parts of the main module gMapping*: PRope # the generated mapping file (if requested) gProcProfile*: Natural # proc profile counter - gGeneratedSyms*: TIntSet # set of ID's of generated symbols gPendingModules*: seq[BModule] = @[] # list of modules that are not # finished with code generation gForwardedProcsCounter*: int = 0 |