implement passL and passC for the compilation cache

This commit is contained in:
Andreas Rumpf 2018-06-10 17:06:02 +02:00
commit 2662d713f7
3 changed files with 13 additions and 8 deletions

View file

@ -246,11 +246,7 @@ template depConfigFields*(fn) {.dirty.} =
fn(selectedGC) fn(selectedGC)
template serializeConfigFields(fn) {.dirty.} = template serializeConfigFields(fn) {.dirty.} =
fn(cppDefines) fn(cppDefines) # XXX TODO: Replay this.
fn(externalToLink)
fn(linkOptions)
fn(compileOptions)
fn(toCompile)
const oldExperimentalFeatures* = {implicitDeref, dotOperators, callOperator, parallel} const oldExperimentalFeatures* = {implicitDeref, dotOperators, callOperator, parallel}

View file

@ -82,7 +82,6 @@ proc getPragmaVal*(procAst: PNode; name: TSpecialWord): PNode =
return it[1] return it[1]
proc pragma*(c: PContext, sym: PSym, n: PNode, validPragmas: TSpecialWords) proc pragma*(c: PContext, sym: PSym, n: PNode, validPragmas: TSpecialWords)
# implementation
proc recordPragma(c: PContext; n: PNode; key, val: string; val2 = "") = proc recordPragma(c: PContext; n: PNode; key, val: string; val2 = "") =
var recorded = newNodeI(nkCommentStmt, n.info) var recorded = newNodeI(nkCommentStmt, n.info)
@ -933,8 +932,14 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: var int,
of wCompile: processCompile(c, it) of wCompile: processCompile(c, it)
of wLink: processCommonLink(c, it, linkNormal) of wLink: processCommonLink(c, it, linkNormal)
of wLinksys: processCommonLink(c, it, linkSys) of wLinksys: processCommonLink(c, it, linkSys)
of wPassl: extccomp.addLinkOption(c.config, expectStrLit(c, it)) of wPassl:
of wPassc: extccomp.addCompileOption(c.config, expectStrLit(c, it)) let s = expectStrLit(c, it)
extccomp.addLinkOption(c.config, s)
recordPragma(c, it, "passl", s)
of wPassc:
let s = expectStrLit(c, it)
extccomp.addCompileOption(c.config, s)
recordPragma(c, it, "passc", s)
of wBreakpoint: pragmaBreakpoint(c, it) of wBreakpoint: pragmaBreakpoint(c, it)
of wWatchPoint: pragmaWatchpoint(c, it) of wWatchPoint: pragmaWatchpoint(c, it)
of wPush: of wPush:

View file

@ -789,6 +789,10 @@ proc replay(g: ModuleGraph; module: PSym; n: PNode) =
extccomp.addExternalFileToCompile(g.config, cf) extccomp.addExternalFileToCompile(g.config, cf)
of "link": of "link":
extccomp.addExternalFileToLink(g.config, n[1].strVal) extccomp.addExternalFileToLink(g.config, n[1].strVal)
of "passl":
extccomp.addLinkOption(g.config, n[1].strVal)
of "passc":
extccomp.addCompileOption(g.config, n[1].strVal)
of "inc": of "inc":
let destKey = n[1].strVal let destKey = n[1].strVal
let by = n[2].intVal let by = n[2].intVal