parent
ec059240b0
commit
6fe2e8977d
1 changed files with 11 additions and 2 deletions
|
|
@ -64,7 +64,16 @@ proc canAlias(arg, ret: PType; marker: var IntSet): bool =
|
||||||
else:
|
else:
|
||||||
result = false
|
result = false
|
||||||
|
|
||||||
|
proc isValueOnlyType(t: PType): bool =
|
||||||
|
# t doesn't contain pointers and references
|
||||||
|
proc wrap(t: PType): bool {.nimcall.} = t.kind in {tyRef, tyPtr, tyVar, tyLent}
|
||||||
|
result = not types.searchTypeFor(t, wrap)
|
||||||
|
|
||||||
proc canAlias*(arg, ret: PType): bool =
|
proc canAlias*(arg, ret: PType): bool =
|
||||||
|
if isValueOnlyType(arg):
|
||||||
|
# can alias only with unsafeAddr(arg.x) and we don't care if it is not safe
|
||||||
|
result = false
|
||||||
|
else:
|
||||||
var marker = initIntSet()
|
var marker = initIntSet()
|
||||||
result = canAlias(arg, ret, marker)
|
result = canAlias(arg, ret, marker)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue