Unverified Commit 576b518d authored by Jerome Hugues's avatar Jerome Hugues Committed by GitHub
Browse files

Merge pull request #219 from bouazizrahma/fix_bug_in_analysis_of_for_construct

Fix bug in analysis of for construct
For openaadl/ocarina#189
parents 14556b45 92fa416c
...@@ -1207,10 +1207,16 @@ package body Ocarina.Backends.C_Common.BA is ...@@ -1207,10 +1207,16 @@ package body Ocarina.Backends.C_Common.BA is
Statement_Exist : Boolean := False; Statement_Exist : Boolean := False;
Stat : Node_Id; Stat : Node_Id;
Request_Name : Name_Id; Request_Name : Name_Id;
Idt : Name_Id;
begin begin
Request_Name := Make_Request_Variable_Name_From_Port_Name if BATN.Kind (Node) = BATN.K_Identifier then
(BATN.Display_Name (BATN.First_Node Idt := BATN.Display_Name (Node);
(BATN.Idt (Node)))); else
Idt := BATN.Display_Name (BATN.First_Node
(BATN.Idt (Node)));
end if;
Request_Name := Make_Request_Variable_Name_From_Port_Name (Idt);
Stat := CTN.First_Node (Statements); Stat := CTN.First_Node (Statements);
while Present (Stat) loop while Present (Stat) loop
...@@ -1272,9 +1278,7 @@ package body Ocarina.Backends.C_Common.BA is ...@@ -1272,9 +1278,7 @@ package body Ocarina.Backends.C_Common.BA is
Make_List_Id Make_List_Id
(Make_Defining_Identifier (Make_Defining_Identifier
(Map_Thread_Port_Variable_Name (S)), (Map_Thread_Port_Variable_Name (S)),
Make_Defining_Identifier Make_Defining_Identifier (Idt)))),
(BATN.Display_Name (BATN.First_Node
(BATN.Idt (Node))))))),
Statements); Statements);
end if; end if;
...@@ -2513,10 +2517,40 @@ package body Ocarina.Backends.C_Common.BA is ...@@ -2513,10 +2517,40 @@ package body Ocarina.Backends.C_Common.BA is
N := BATN.Corresponding_Entity (Node); N := BATN.Corresponding_Entity (Node);
if Present (N) then if Present (N) then
if AAN.kind (N) = AAN.K_Port_Spec if AAN.kind (N) = AAN.K_Port_Spec
and then AAN.Is_Data (N) and then AAN.Is_In (N) and then AAN.Is_Data (N)
then then
result := Make_Get_Value_of_Port if AAN.Is_In (N) then
(Node, Subprogram_Root, Declarations, Statements); result := Make_Get_Value_of_Port
(Node, Subprogram_Root, Declarations, Statements);
else
-- i.e the identifier is an out port
Make_Request_Variable_Declaration
(Declarations,
BATN.Display_Name (Node));
Make_Output_Port_Name
(Node => Node,
S => Subprogram_Root,
Statements => Statements);
N := Make_Call_Profile
(RE (RE_PORT_VARIABLE),
Make_List_Id
(Make_Defining_Identifier
(Map_Thread_Port_Variable_Name (Subprogram_Root)),
Make_Defining_Identifier
(BATN.Display_Name (Node))));
result := CTU.Make_Member_Designator
(Defining_Identifier => N,
Aggregate_Name =>
Make_Defining_Identifier
(Make_Request_Variable_Name_From_Port_Name
(BATN.Display_Name (Node))));
end if;
end if; end if;
end if; end if;
......
...@@ -1261,6 +1261,24 @@ package body Ocarina.Analyzer.AADL_BA is ...@@ -1261,6 +1261,24 @@ package body Ocarina.Analyzer.AADL_BA is
end if; end if;
end if; end if;
if Present (In_Element_Values (Node)) then
if BATN.Kind (In_Element_Values (Node)) = BATN.K_Integer_Range then
Success := Success and then Analyze_BA_Integer_Value
(Node => BATN.Lower_Int_Val
(In_Element_Values (Node)),
Root => Root,
BA_Root => BA_Root,
Parent_Component => Parent_Component)
and then Analyze_BA_Integer_Value
(Node => BATN.Upper_Int_Val
(In_Element_Values (Node)),
Root => Root,
BA_Root => BA_Root,
Parent_Component => Parent_Component);
end if;
end if;
if Is_Empty (Scope_BA_Entities) then if Is_Empty (Scope_BA_Entities) then
L := New_List (BATN.K_BA_Entity_List, No_Location); L := New_List (BATN.K_BA_Entity_List, No_Location);
else else
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment