Fixes for ptr array deref codegen (#11191)
* fixes for ptr array derefence codegen * fix comments, make diff nicer
This commit is contained in:
parent
7804b5c558
commit
a6ba3116b2
4 changed files with 36 additions and 40 deletions
|
|
@ -717,8 +717,10 @@ proc isCppRef(p: BProc; typ: PType): bool {.inline.} =
|
|||
skipTypes(typ, abstractInstOwned).kind == tyVar and
|
||||
tfVarIsPtr notin skipTypes(typ, abstractInstOwned).flags
|
||||
|
||||
proc genDeref(p: BProc, e: PNode, d: var TLoc; enforceDeref=false) =
|
||||
let mt = mapType(p.config, e.sons[0].typ)
|
||||
proc genDeref(p: BProc, e: PNode, d: var TLoc) =
|
||||
let
|
||||
enforceDeref = lfEnforceDeref in d.flags
|
||||
mt = mapType(p.config, e.sons[0].typ)
|
||||
if mt in {ctArray, ctPtrToArray} and not enforceDeref:
|
||||
# XXX the amount of hacks for C's arrays is incredible, maybe we should
|
||||
# simply wrap them in a struct? --> Losing auto vectorization then?
|
||||
|
|
@ -2343,6 +2345,7 @@ proc genTupleConstr(p: BProc, n: PNode, d: var TLoc) =
|
|||
if it.kind == nkExprColonExpr: it = it.sons[1]
|
||||
initLoc(rec, locExpr, it, d.storage)
|
||||
rec.r = "$1.Field$2" % [rdLoc(d), rope(i)]
|
||||
rec.flags.incl(lfEnforceDeref)
|
||||
expr(p, it, rec)
|
||||
|
||||
proc isConstClosure(n: PNode): bool {.inline.} =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue