diff options
author | Andreas Rumpf <andreas@andreas-laptop> | 2010-08-14 15:46:07 +0200 |
---|---|---|
committer | Andreas Rumpf <andreas@andreas-laptop> | 2010-08-14 15:46:07 +0200 |
commit | fc0b66a7ff1c17fae66e604279524e757451bd1d (patch) | |
tree | 6d3c17703fe5b5beb6db6df58b9de674ec60fc02 /rod | |
parent | fee8e328efa97680efbcfdb72fa4a7b34ee5b564 (diff) | |
download | Nim-fc0b66a7ff1c17fae66e604279524e757451bd1d.tar.gz |
accurate file/line information
Diffstat (limited to 'rod')
-rwxr-xr-x | rod/c2nim/manual.txt | 2 | ||||
-rwxr-xr-x | rod/ccgstmts.nim | 9 | ||||
-rwxr-xr-x | rod/cgen.nim | 7 |
3 files changed, 8 insertions, 10 deletions
diff --git a/rod/c2nim/manual.txt b/rod/c2nim/manual.txt index 7aa8b557b..c485a57f1 100755 --- a/rod/c2nim/manual.txt +++ b/rod/c2nim/manual.txt @@ -211,7 +211,7 @@ identifier should be converted: .. code-block:: C #mangle "'GTK_'{.*}" "TGtk$1" -For convenience the PEG pattern and the replacement can be a single identifiers +For convenience the PEG pattern and the replacement can be single identifiers too, there is no need to quote them: .. code-block:: C diff --git a/rod/ccgstmts.nim b/rod/ccgstmts.nim index 348615cce..f07dfb7e4 100755 --- a/rod/ccgstmts.nim +++ b/rod/ccgstmts.nim @@ -24,10 +24,8 @@ proc genLineDir(p: BProc, t: PNode) = elif ({optLineTrace, optStackTrace} * p.Options == {optLineTrace, optStackTrace}) and ((p.prc == nil) or not (sfPure in p.prc.flags)): - inc(p.labels) - appff(p.s[cpsStmts], "F.line = $1;$n", - "%LOC$2 = getelementptr %TF %F, %NI 2$n" & - "store %NI $1, %NI* %LOC$2$n", [toRope(line), toRope(p.labels)]) + appf(p.s[cpsStmts], "F.line = $1;F.filename = $2;$n", + [toRope(line), makeCString(toFilename(t.info).extractFilename)]) proc finishTryStmt(p: BProc, howMany: int) = for i in countup(1, howMany): @@ -265,14 +263,15 @@ proc getRaiseFrmt(p: BProc): string = result = "#raiseException((#E_Base*)$1, $2);$n" proc genRaiseStmt(p: BProc, t: PNode) = - genLineDir(p, t) if t.sons[0] != nil: var a: TLoc InitLocExpr(p, t.sons[0], a) var e = rdLoc(a) var typ = skipTypes(t.sons[0].typ, abstractPtrs) + genLineDir(p, t) appcg(p, cpsStmts, getRaiseFrmt(p), [e, makeCString(typ.sym.name.s)]) else: + genLineDir(p, t) # reraise the last exception: if gCmd == cmdCompileToCpp: appcg(p, cpsStmts, "throw;" & tnl) diff --git a/rod/cgen.nim b/rod/cgen.nim index 562b660eb..691fb29fb 100755 --- a/rod/cgen.nim +++ b/rod/cgen.nim @@ -563,8 +563,7 @@ proc genProcAux(m: BModule, prc: PSym) = if optStackTrace in prc.options: getFrameDecl(p) app(generatedProc, p.s[cpsLocals]) - procname = CStringLit(p, generatedProc, - prc.owner.name.s & '.' & prc.name.s) + procname = CStringLit(p, generatedProc, prc.name.s) filename = CStringLit(p, generatedProc, toFilename(prc.info)) app(generatedProc, initFrame(p, procname, filename)) else: @@ -577,7 +576,7 @@ proc genProcAux(m: BModule, prc: PSym) = if prc.loc.a < 0: appf(m.s[cfsDebugInit], "profileData[$1].procname = $2;$n", [ toRope(gProcProfile), - makeCString(prc.owner.name.s & '.' & prc.name.s)]) + makeCString(prc.name.s)]) prc.loc.a = gProcProfile inc(gProcProfile) prepend(p.s[cpsInit], toRope("NIM_profilingStart = getticks();" & tnl)) @@ -782,7 +781,7 @@ proc genInitCode(m: BModule) = getFrameDecl(m.initProc) app(prc, m.initProc.s[cpsLocals]) app(prc, m.s[cfsTypeInit1]) - procname = CStringLit(m.initProc, prc, "module " & m.module.name.s) + procname = CStringLit(m.initProc, prc, m.module.name.s) filename = CStringLit(m.initProc, prc, toFilename(m.module.info)) app(prc, initFrame(m.initProc, procname, filename)) else: |