diff options
author | Tristan Gingold | 2014-01-25 21:16:44 +0100 |
---|---|---|
committer | Tristan Gingold | 2014-01-25 21:16:44 +0100 |
commit | 2cc6d66e785130bb757bcb73e96cfffdc2c2f0b7 (patch) | |
tree | 0e1c76137b2da38b1b065d519f005a00a90c4ad9 /ortho/mcode/ortho_code-consts.adb | |
parent | 2bfd9df129c8517776455c6c402a63b79b841257 (diff) | |
download | ghdl-2cc6d66e785130bb757bcb73e96cfffdc2c2f0b7.tar.gz ghdl-2cc6d66e785130bb757bcb73e96cfffdc2c2f0b7.tar.bz2 ghdl-2cc6d66e785130bb757bcb73e96cfffdc2c2f0b7.zip |
new_offsetof: add argument for record type (llvm preliminary work).
Diffstat (limited to 'ortho/mcode/ortho_code-consts.adb')
-rw-r--r-- | ortho/mcode/ortho_code-consts.adb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/ortho/mcode/ortho_code-consts.adb b/ortho/mcode/ortho_code-consts.adb index 1122b8e..d09a13c 100644 --- a/ortho/mcode/ortho_code-consts.adb +++ b/ortho/mcode/ortho_code-consts.adb @@ -496,8 +496,12 @@ package body Ortho_Code.Consts is return To_Cnode_Sizeof (Cnodes.Table (Cst + 1)).Atype; end Get_Alignof_Type; - function New_Offsetof (Field : O_Fnode; Rtype : O_Tnode) return O_Cnode is + function New_Offsetof (Rec_Type : O_Tnode; Field : O_Fnode; Rtype : O_Tnode) + return O_Cnode is begin + if Get_Field_Parent (Field) /= Rec_Type then + raise Syntax_Error; + end if; return New_Unsigned_Literal (Rtype, Unsigned_64 (Get_Field_Offset (Field))); end New_Offsetof; |