pragma Elaborate_All
(Ada.Containers.Red_Black_Trees.Generic_Bounded_Set_Operations);
+with Ada.Unchecked_Deallocation;
+
with System; use type System.Address;
with System.Put_Images;
Is_Less_Key_Node => Is_Less_Key_Node,
Is_Greater_Key_Node => Is_Greater_Key_Node);
+ ------------
+ -- Adjust --
+ ------------
+
+ procedure Adjust (Control : in out Reference_Control_Type) is
+ begin
+ Impl.Reference_Control_Type (Control).Adjust;
+ if Control.Old_Key /= null then
+ Control.Old_Key := new Key_Type'(Control.Old_Key.all);
+ end if;
+ end Adjust;
+
-------------
-- Ceiling --
-------------
--------------
procedure Finalize (Control : in out Reference_Control_Type) is
+ procedure Deallocate is
+ new Ada.Unchecked_Deallocation (Key_Type, Key_Access);
begin
if Control.Container /= null then
Impl.Reference_Control_Type (Control).Finalize;
end if;
Control.Container := null;
+ Deallocate (Control.Old_Key);
end if;
end Finalize;
Old_Key : Key_Access;
end record;
+ overriding procedure Adjust (Control : in out Reference_Control_Type);
+ pragma Inline (Adjust);
+
overriding procedure Finalize (Control : in out Reference_Control_Type);
pragma Inline (Finalize);
Is_Less_Key_Node => Is_Less_Key_Node,
Is_Greater_Key_Node => Is_Greater_Key_Node);
+ ------------
+ -- Adjust --
+ ------------
+
+ procedure Adjust (Control : in out Reference_Control_Type) is
+ begin
+ Impl.Reference_Control_Type (Control).Adjust;
+ if Control.Old_Key /= null then
+ Control.Old_Key := new Key_Type'(Control.Old_Key.all);
+ end if;
+ end Adjust;
+
-------------
-- Ceiling --
-------------
--------------
procedure Finalize (Control : in out Reference_Control_Type) is
+ procedure Deallocate is
+ new Ada.Unchecked_Deallocation (Key_Type, Key_Access);
begin
if Control.Container /= null then
Impl.Reference_Control_Type (Control).Finalize;
end if;
Control.Container := null;
- Control.Old_Key := null;
+ Deallocate (Control.Old_Key);
end if;
end Finalize;
Old_Key : Key_Access;
end record;
+ overriding procedure Adjust (Control : in out Reference_Control_Type);
+ pragma Inline (Adjust);
+
overriding procedure Finalize (Control : in out Reference_Control_Type);
pragma Inline (Finalize);
Is_Less_Key_Node => Is_Less_Key_Node,
Is_Greater_Key_Node => Is_Greater_Key_Node);
+ ------------
+ -- Adjust --
+ ------------
+
+ procedure Adjust (Control : in out Reference_Control_Type) is
+ begin
+ Impl.Reference_Control_Type (Control).Adjust;
+ if Control.Old_Key /= null then
+ Control.Old_Key := new Key_Type'(Control.Old_Key.all);
+ end if;
+ end Adjust;
+
-------------
-- Ceiling --
-------------
--------------
procedure Finalize (Control : in out Reference_Control_Type) is
+ procedure Deallocate is
+ new Ada.Unchecked_Deallocation (Key_Type, Key_Access);
begin
if Control.Container /= null then
Impl.Reference_Control_Type (Control).Finalize;
end if;
Control.Container := null;
- Control.Old_Key := null;
+ Deallocate (Control.Old_Key);
end if;
end Finalize;
Old_Key : Key_Access;
end record;
+ overriding procedure Adjust (Control : in out Reference_Control_Type);
+ pragma Inline (Adjust);
+
overriding procedure Finalize (Control : in out Reference_Control_Type);
pragma Inline (Finalize);
elsif Is_Record_Type (Input_Typ) then
Comp := First_Component (Input_Typ);
while Present (Comp) loop
- if Needs_Finalization (Etype (Comp)) then
+ -- Skip _Parent component like Expand_Freeze_Record_Type
+
+ if Chars (Comp) /= Name_uParent
+ and then Needs_Finalization (Etype (Comp))
+ then
return True;
end if;