aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2018-12-20 07:57:49 +0100
committerTristan Gingold <tgingold@free.fr>2018-12-21 06:08:42 +0100
commit23e70671cc68dea9def3bd22f2a173c4581464ae (patch)
tree760595c49a0c5570ed4437842027f18ffc4a6ceb /src/vhdl
parent3b5fe48263e0a8cc065e7a06cdcd892694062b28 (diff)
downloadghdl-23e70671cc68dea9def3bd22f2a173c4581464ae.tar.gz
ghdl-23e70671cc68dea9def3bd22f2a173c4581464ae.tar.bz2
ghdl-23e70671cc68dea9def3bd22f2a173c4581464ae.zip
Analysis: tolerate more parse errors.
Diffstat (limited to 'src/vhdl')
-rw-r--r--src/vhdl/sem.adb62
-rw-r--r--src/vhdl/sem_names.adb7
-rw-r--r--src/vhdl/sem_scopes.adb6
-rw-r--r--src/vhdl/sem_specs.adb14
4 files changed, 64 insertions, 25 deletions
diff --git a/src/vhdl/sem.adb b/src/vhdl/sem.adb
index 9afb1f1d4..8729a97e0 100644
--- a/src/vhdl/sem.adb
+++ b/src/vhdl/sem.adb
@@ -100,6 +100,11 @@ package body Sem is
-- Resolve the name.
Name := Get_Entity_Name (Library_Unit);
+ if Name = Null_Iir then
+ pragma Assert (Flags.Flag_Force_Analysis);
+ return Null_Iir;
+ end if;
+
if Get_Kind (Name) = Iir_Kind_Simple_Name then
-- LRM93 10.1 Declarative Region
-- LRM08 12.1 Declarative Region
@@ -2570,7 +2575,8 @@ package body Sem is
when Iir_Kind_Terminal_Declaration =>
null;
when others =>
- Error_Kind ("package_need_body_p", El);
+ pragma Assert (Flags.Flag_Force_Analysis);
+ null;
end case;
El := Get_Chain (El);
end loop;
@@ -2905,6 +2911,11 @@ package body Sem is
-- declarations that will potentialy become directly visible.
Name := Get_Selected_Name (Clause);
+ if Name = Null_Iir then
+ pragma Assert (Flags.Flag_Force_Analysis);
+ return;
+ end if;
+
case Get_Kind (Name) is
when Iir_Kind_Selected_By_All_Name
| Iir_Kind_Selected_Name =>
@@ -3217,11 +3228,13 @@ package body Sem is
-- If there is already a unit with the same name, mark it as being
-- replaced.
- if Get_Kind (Library_Unit) in Iir_Kinds_Primary_Unit then
- Prev_Unit := Libraries.Find_Primary_Unit
- (Library, Get_Identifier (Library_Unit));
- if Is_Valid (Prev_Unit) and then Prev_Unit /= Design_Unit then
- Set_Date (Prev_Unit, Date_Replacing);
+ if Library_Unit /= Null_Iir then
+ if Get_Kind (Library_Unit) in Iir_Kinds_Primary_Unit then
+ Prev_Unit := Libraries.Find_Primary_Unit
+ (Library, Get_Identifier (Library_Unit));
+ if Is_Valid (Prev_Unit) and then Prev_Unit /= Design_Unit then
+ Set_Date (Prev_Unit, Date_Replacing);
+ end if;
end if;
end if;
@@ -3262,22 +3275,27 @@ package body Sem is
Sem_Context_Clauses (Design_Unit);
-- Analyze the library unit.
- case Iir_Kinds_Library_Unit (Get_Kind (Library_Unit)) is
- when Iir_Kind_Entity_Declaration =>
- Sem_Entity_Declaration (Library_Unit);
- when Iir_Kind_Architecture_Body =>
- Sem_Architecture_Body (Library_Unit);
- when Iir_Kind_Package_Declaration =>
- Sem_Package_Declaration (Library_Unit);
- when Iir_Kind_Package_Body =>
- Sem_Package_Body (Library_Unit);
- when Iir_Kind_Configuration_Declaration =>
- Sem_Configuration_Declaration (Library_Unit);
- when Iir_Kind_Package_Instantiation_Declaration =>
- Sem_Package_Instantiation_Declaration (Library_Unit);
- when Iir_Kind_Context_Declaration =>
- Sem_Context_Declaration (Library_Unit);
- end case;
+ if Library_Unit /= Null_Iir then
+ case Iir_Kinds_Library_Unit (Get_Kind (Library_Unit)) is
+ when Iir_Kind_Entity_Declaration =>
+ Sem_Entity_Declaration (Library_Unit);
+ when Iir_Kind_Architecture_Body =>
+ Sem_Architecture_Body (Library_Unit);
+ when Iir_Kind_Package_Declaration =>
+ Sem_Package_Declaration (Library_Unit);
+ when Iir_Kind_Package_Body =>
+ Sem_Package_Body (Library_Unit);
+ when Iir_Kind_Configuration_Declaration =>
+ Sem_Configuration_Declaration (Library_Unit);
+ when Iir_Kind_Package_Instantiation_Declaration =>
+ Sem_Package_Instantiation_Declaration (Library_Unit);
+ when Iir_Kind_Context_Declaration =>
+ Sem_Context_Declaration (Library_Unit);
+ end case;
+ else
+ pragma Assert (Flags.Flag_Force_Analysis);
+ null;
+ end if;
Close_Declarative_Region;
diff --git a/src/vhdl/sem_names.adb b/src/vhdl/sem_names.adb
index f64e1209d..b6470914d 100644
--- a/src/vhdl/sem_names.adb
+++ b/src/vhdl/sem_names.adb
@@ -889,6 +889,13 @@ package body Sem_Names is
Atype : Iir;
Res : Iir;
begin
+ if Name = Null_Iir then
+ pragma Assert (Flags.Flag_Force_Analysis);
+ Res := Create_Error_Type (Null_Iir);
+ Set_Type (Res, Res);
+ return Res;
+ end if;
+
-- The name must not have been analyzed.
pragma Assert (Get_Type (Name) = Null_Iir);
diff --git a/src/vhdl/sem_scopes.adb b/src/vhdl/sem_scopes.adb
index f99273ef9..e4f780961 100644
--- a/src/vhdl/sem_scopes.adb
+++ b/src/vhdl/sem_scopes.adb
@@ -454,7 +454,11 @@ package body Sem_Scopes is
Last_In_Region := Ident;
end Add_New_Interpretation;
begin
- pragma Assert (Ident /= Null_Identifier);
+ if Ident = Null_Identifier then
+ -- Missing identifier can happen only in case of parse error.
+ pragma Assert (Flags.Flag_Force_Analysis);
+ return;
+ end if;
if not Valid_Interpretation (Raw_Inter) then
-- Very simple: no hidding, no overloading.
diff --git a/src/vhdl/sem_specs.adb b/src/vhdl/sem_specs.adb
index 7f91d38b1..91a4ac169 100644
--- a/src/vhdl/sem_specs.adb
+++ b/src/vhdl/sem_specs.adb
@@ -1359,7 +1359,12 @@ package body Sem_Specs is
Inst_Unit : Iir;
begin
Primary_Entity_Aspect := Null_Iir;
- Comp_Name := Sem_Denoting_Name (Get_Component_Name (Spec));
+ Comp_Name := Get_Component_Name (Spec);
+ if Comp_Name = Null_Iir then
+ pragma Assert (Flags.Flag_Force_Analysis);
+ return;
+ end if;
+ Comp_Name := Sem_Denoting_Name (Comp_Name);
Set_Component_Name (Spec, Comp_Name);
Comp := Get_Named_Entity (Comp_Name);
if Get_Kind (Comp) /= Iir_Kind_Component_Declaration then
@@ -1461,7 +1466,12 @@ package body Sem_Specs is
Component : Iir;
begin
Sem_Component_Specification (Parent_Stmts, Conf, Primary_Entity_Aspect);
- Component := Get_Named_Entity (Get_Component_Name (Conf));
+ Component := Get_Component_Name (Conf);
+ if Component = Null_Iir then
+ pragma Assert (Flags.Flag_Force_Analysis);
+ return;
+ end if;
+ Component := Get_Named_Entity (Component);
-- Return now in case of error.
if Get_Kind (Component) /= Iir_Kind_Component_Declaration then