reduce openArray-related C undefined behavior (#20795)
This commit is contained in:
parent
25cb19a8fe
commit
6894a00409
3 changed files with 25 additions and 10 deletions
|
|
@ -322,6 +322,12 @@ proc lenExpr(p: BProc; a: TLoc): Rope =
|
|||
else:
|
||||
result = "($1 ? $1->$2 : 0)" % [rdLoc(a), lenField(p)]
|
||||
|
||||
proc dataFieldAccessor(p: BProc, sym: Rope): Rope =
|
||||
if optSeqDestructors in p.config.globalOptions:
|
||||
result = "(" & sym & ").p"
|
||||
else:
|
||||
result = sym
|
||||
|
||||
proc dataField(p: BProc): Rope =
|
||||
if optSeqDestructors in p.config.globalOptions:
|
||||
result = rope".p->data"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue