sizeof alignof offsetof macros api (#10855)

This commit is contained in:
Arne Döring 2019-03-19 08:23:00 +01:00 • committed by Andreas Rumpf
commit 188870648a
7 changed files with 93 additions and 1 deletions

View file

@ -1236,6 +1236,12 @@ proc genMagic(c: PCtx; n: PNode; dest: var TDest; m: TMagic) =
c.gABC(n, opcNGetType, dest, tmp, rc)
c.freeTemp(tmp)
#genUnaryABC(c, n, dest, opcNGetType)
of mNSizeOf:
let imm = case n[0].sym.name.s:
of "getSize": 0
of "getAlign": 1
else: 2 # "getOffset"
c.genUnaryABI(n, dest, opcNGetSize, imm)
of mNStrVal: genUnaryABC(c, n, dest, opcNStrVal)
of mNSigHash: genUnaryABC(c, n , dest, opcNSigHash)
of mNSetIntVal: