diff options
author | Tristan Gingold <tgingold@free.fr> | 2016-10-18 02:31:27 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2016-10-18 02:36:56 +0200 |
commit | db113af86a8a7fc04775d585feb2b7b432212368 (patch) | |
tree | fe8e8b349923a3adbaa9a24a49ce2300c5a6f863 | |
parent | b42b707e1f1977abe82d0d6a8ecce5fbee38faa8 (diff) | |
download | ghdl-db113af86a8a7fc04775d585feb2b7b432212368.tar.gz ghdl-db113af86a8a7fc04775d585feb2b7b432212368.tar.bz2 ghdl-db113af86a8a7fc04775d585feb2b7b432212368.zip |
iirs: add an assert on Get_Kind.
-rw-r--r-- | src/vhdl/iirs.adb | 7 | ||||
-rw-r--r-- | src/vhdl/iirs.adb.in | 7 | ||||
-rw-r--r-- | src/vhdl/iirs.ads | 14 |
3 files changed, 15 insertions, 13 deletions
diff --git a/src/vhdl/iirs.adb b/src/vhdl/iirs.adb index 4db20bded..db662b8bb 100644 --- a/src/vhdl/iirs.adb +++ b/src/vhdl/iirs.adb @@ -124,18 +124,19 @@ package body Iirs is return Res; end Create_Iir_Error; - procedure Location_Copy (Target: Iir; Src: Iir) is + procedure Location_Copy (Target : Iir; Src : Iir) is begin Set_Location (Target, Get_Location (Src)); end Location_Copy; -- Get kind - function Get_Kind (An_Iir: Iir) return Iir_Kind + function Get_Kind (N : Iir) return Iir_Kind is -- Speed up: avoid to check that nkind is in the bounds of Iir_Kind. pragma Suppress (Range_Check); begin - return Iir_Kind'Val (Get_Nkind (An_Iir)); + pragma Assert (N /= Null_Iir); + return Iir_Kind'Val (Get_Nkind (N)); end Get_Kind; function Time_Stamp_Id_To_Iir is new Ada.Unchecked_Conversion diff --git a/src/vhdl/iirs.adb.in b/src/vhdl/iirs.adb.in index 7f04a1a15..b5f06705e 100644 --- a/src/vhdl/iirs.adb.in +++ b/src/vhdl/iirs.adb.in @@ -124,18 +124,19 @@ package body Iirs is return Res; end Create_Iir_Error; - procedure Location_Copy (Target: Iir; Src: Iir) is + procedure Location_Copy (Target : Iir; Src : Iir) is begin Set_Location (Target, Get_Location (Src)); end Location_Copy; -- Get kind - function Get_Kind (An_Iir: Iir) return Iir_Kind + function Get_Kind (N : Iir) return Iir_Kind is -- Speed up: avoid to check that nkind is in the bounds of Iir_Kind. pragma Suppress (Range_Check); begin - return Iir_Kind'Val (Get_Nkind (An_Iir)); + pragma Assert (N /= Null_Iir); + return Iir_Kind'Val (Get_Nkind (N)); end Get_Kind; function Time_Stamp_Id_To_Iir is new Ada.Unchecked_Conversion diff --git a/src/vhdl/iirs.ads b/src/vhdl/iirs.ads index 56edca1b6..9d1ee61fe 100644 --- a/src/vhdl/iirs.ads +++ b/src/vhdl/iirs.ads @@ -161,7 +161,7 @@ package Iirs is -- -- Get the kind of the iir. -- See below for the (public) list of kinds. - -- function Get_Kind (An_Iir: Iir) return Iir_Kind; + -- function Get_Kind (N : Iir) return Iir_Kind; -- Get the location of the node: ie the current position in the source -- file when the node was created. This is a little bit fuzzy. @@ -5566,23 +5566,23 @@ package Iirs is -- General methods. -- Get the kind of the iir. - function Get_Kind (An_Iir: Iir) return Iir_Kind; + function Get_Kind (N : Iir) return Iir_Kind; pragma Inline (Get_Kind); -- Create a new IIR of kind NEW_KIND, and copy fields from SRC to this -- iir. Src fields are cleaned. --function Clone_Iir (Src: Iir; New_Kind : Iir_Kind) return Iir; - procedure Set_Location (Target: Iir; Location: Location_Type) + procedure Set_Location (Target : Iir; Location : Location_Type) renames Nodes.Set_Location; - function Get_Location (Target: Iir) return Location_Type + function Get_Location (Target : Iir) return Location_Type renames Nodes.Get_Location; - procedure Location_Copy (Target: Iir; Src: Iir); + procedure Location_Copy (Target : Iir; Src : Iir); - function Create_Iir (Kind: Iir_Kind) return Iir; + function Create_Iir (Kind : Iir_Kind) return Iir; function Create_Iir_Error return Iir; - procedure Free_Iir (Target: Iir) renames Nodes.Free_Node; + procedure Free_Iir (Target : Iir) renames Nodes.Free_Node; -- Disp statistics about node usage. procedure Disp_Stats; |