File tree Expand file tree Collapse file tree 4 files changed +8
-9
lines changed Expand file tree Collapse file tree 4 files changed +8
-9
lines changed Original file line number Diff line number Diff line change 856856 loc* : TLoc
857857 annex* : PLib # additional fields (seldom used, so we use a
858858 # reference to another object to save space)
859+ cname* : string # resolved C declaration name in importc decl, eg:
860+ # {.importc: "foo".} => cname = foo
859861 constraint* : PNode # additional constraints like 'lit|result'; also
860862 # misused for the codegenDecl pragma in the hope
861863 # it won't cause problems
Original file line number Diff line number Diff line change @@ -697,14 +697,10 @@ proc loadDynamicLib(m: BModule, lib: PLib) =
697697proc mangleDynLibProc (sym: PSym ): Rope =
698698 # we have to build this as a single rope in order not to trip the
699699 # optimization in genInfixCall, see test tests/cpp/t8241.nim
700- when not defined (windows) :
701- # mysterious bug that only affects windows, causing SIGSEGV in
700+ if sym.loc.r != nil :
701+ # `return rope($sym.loc.r)` would cause on windows a SIGSEGV in
702702 # stdlib_winleanDatInit000 () at generated_not_to_break_here
703- if sym.loc.r != nil :
704- if sym.loc.r.data.len > 0 :
705- return sym.loc.r
706- else :
707- return rope ($ sym.loc.r)
703+ if sym.cname.len == 0 : sym.cname = $ sym.loc.r
708704 if sfCompilerProc in sym.flags:
709705 # NOTE: sym.loc.r is the external name!
710706 result = rope (sym.name.s)
Original file line number Diff line number Diff line change 4747 nkPtrLit = nkIntLit # hopefully we can get rid of this hack soon
4848
4949proc importcSymbol * (conf: ConfigRef , sym: PSym ): PNode =
50- let name = $ sym.loc.r
50+ var name = $ sym.cname
51+ if name.len == 0 : name = $ sym.loc.r
5152 # the AST does not support untyped pointers directly, so we use an nkIntLit
5253 # that contains the address instead:
5354 result = newNodeIT (nkPtrLit, sym.info, sym.typ)
Original file line number Diff line number Diff line change @@ -281,7 +281,7 @@ proc putIntoReg(dest: var TFullReg; n: PNode) =
281281 if dest.kind == rkNode:
282282 dest.node = n
283283 return
284- elif n.typ.kind == tyPtr:
284+ elif n.typ != nil and n.typ .kind == tyPtr:
285285 dest = TFullReg (kind: rkNode, node: n)
286286 return
287287
You can’t perform that action at this time.
0 commit comments