summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorJasper Jenkins <jasper.vs.jenkins@gmail.com>2019-05-07 11:33:10 -0700
committerAndreas Rumpf <rumpf_a@web.de>2019-05-07 20:33:09 +0200
commit425baeaec64cef226a31da830173b6b556d96944 (patch)
treef961765d74546e5ebdeb36aad5fcb19a60d3a2dd /compiler
parent6f7f043c9b8c782f81568c330200d6ae8addee69 (diff)
downloadNim-425baeaec64cef226a31da830173b6b556d96944.tar.gz
cleanup (#11192)
Diffstat (limited to 'compiler')
-rw-r--r--compiler/ccgexprs.nim10
-rw-r--r--compiler/ccgstmts.nim2
2 files changed, 3 insertions, 9 deletions
diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim
index d8c9255a7..1a262ddde 100644
--- a/compiler/ccgexprs.nim
+++ b/compiler/ccgexprs.nim
@@ -718,14 +718,10 @@ proc isCppRef(p: BProc; typ: PType): bool {.inline.} =
       tfVarIsPtr notin skipTypes(typ, abstractInstOwned).flags
 
 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:
+  let mt = mapType(p.config, e.sons[0].typ)
+  if mt in {ctArray, ctPtrToArray} and lfEnforceDeref notin d.flags:
     # XXX the amount of hacks for C's arrays is incredible, maybe we should
     # simply wrap them in a struct? --> Losing auto vectorization then?
-    #if e[0].kind != nkBracketExpr:
-    #  message(e.info, warnUser, "CAME HERE " & renderTree(e))
     expr(p, e.sons[0], d)
     if e.sons[0].typ.skipTypes(abstractInstOwned).kind == tyRef:
       d.storage = OnHeap
@@ -762,7 +758,7 @@ proc genDeref(p: BProc, e: PNode, d: var TLoc) =
            e.kind == nkHiddenDeref:
         putIntoDest(p, d, e, rdLoc(a), a.storage)
         return
-    if enforceDeref and mt == ctPtrToArray:
+    if mt == ctPtrToArray and lfEnforceDeref in d.flags:
       # we lie about the type for better C interop: 'ptr array[3,T]' is
       # translated to 'ptr T', but for deref'ing this produces wrong code.
       # See tmissingderef. So we get rid of the deref instead. The codegen
diff --git a/compiler/ccgstmts.nim b/compiler/ccgstmts.nim
index 2f8e1653f..81b87fd4a 100644
--- a/compiler/ccgstmts.nim
+++ b/compiler/ccgstmts.nim
@@ -123,8 +123,6 @@ proc genVarTuple(p: BProc, n: PNode) =
     if forHcr or isGlobalInBlock:
       hcrGlobals.add((loc: v.loc, tp: if traverseProc == nil: ~"NULL" else: traverseProc))
 
-proc genDeref(p: BProc, e: PNode, d: var TLoc)
-
 proc loadInto(p: BProc, le, ri: PNode, a: var TLoc) {.inline.} =
   if ri.kind in nkCallKinds and (ri.sons[0].kind != nkSym or
                                  ri.sons[0].sym.magic == mNone):