OSDN Git Service

gcc/ada/
[pf3gnuchains/gcc-fork.git] / gcc / ada / exp_ch4.adb
index c1b88be..30e08fd 100644 (file)
@@ -83,7 +83,7 @@ package body Exp_Ch4 is
      (N   : Node_Id;
       Op1 : Node_Id;
       Op2 : Node_Id);
-   --  If an boolean array assignment can be done in place, build call to
+   --  If a boolean array assignment can be done in place, build call to
    --  corresponding library procedure.
 
    procedure Displace_Allocator_Pointer (N : Node_Id);
@@ -382,6 +382,13 @@ package body Exp_Ch4 is
       PtrT      : Entity_Id;
 
    begin
+      --  Do nothing in case of VM targets: the virtual machine will handle
+      --  interfaces directly.
+
+      if VM_Target /= No_VM then
+         return;
+      end if;
+
       pragma Assert (Nkind (N) = N_Identifier
         and then Nkind (Orig_Node) = N_Allocator);
 
@@ -624,6 +631,7 @@ package body Exp_Ch4 is
 
             if Is_Class_Wide_Type (Etype (Exp))
               and then Is_Interface (Etype (Exp))
+              and then VM_Target = No_VM
             then
                Set_Expression
                  (Expression (N),
@@ -2816,8 +2824,8 @@ package body Exp_Ch4 is
          begin
             P := Parent (N);
             while Present (P) loop
-               if Nkind (P) = N_Extended_Return_Statement
-                 or else Nkind (P) = N_Simple_Return_Statement
+               if Nkind_In
+                   (P, N_Extended_Return_Statement, N_Simple_Return_Statement)
                then
                   return True;
 
@@ -3282,8 +3290,8 @@ package body Exp_Ch4 is
                               New_Occurrence_Of
                                 (Entity (Nam), Sloc (Nam)), T);
 
-                     elsif (Nkind (Nam) = N_Indexed_Component
-                             or else Nkind (Nam) = N_Selected_Component)
+                     elsif Nkind_In
+                             (Nam, N_Indexed_Component, N_Selected_Component)
                        and then Is_Entity_Name (Prefix (Nam))
                      then
                         Decls :=
@@ -4165,8 +4173,8 @@ package body Exp_Ch4 is
             if Nkind (Parnt) = N_Unchecked_Expression then
                null;
 
-            elsif Nkind (Parnt) = N_Object_Renaming_Declaration
-              or else Nkind (Parnt) = N_Procedure_Call_Statement
+            elsif Nkind_In (Parnt, N_Object_Renaming_Declaration,
+                                   N_Procedure_Call_Statement)
               or else (Nkind (Parnt) = N_Parameter_Association
                         and then
                           Nkind (Parent (Parnt)) =  N_Procedure_Call_Statement)
@@ -4206,8 +4214,7 @@ package body Exp_Ch4 is
             then
                return;
 
-            elsif (Nkind (Parnt) = N_Indexed_Component
-                    or else Nkind (Parnt) = N_Selected_Component)
+            elsif Nkind_In (Parnt, N_Indexed_Component, N_Selected_Component)
                and then Prefix (Parnt) = Child
             then
                null;
@@ -6247,11 +6254,9 @@ package body Exp_Ch4 is
 
          --  Special case the negation of a binary operation
 
-         elsif (Nkind (Opnd) = N_Op_And
-                 or else Nkind (Opnd) = N_Op_Or
-                 or else Nkind (Opnd) = N_Op_Xor)
+         elsif Nkind_In (Opnd, N_Op_And, N_Op_Or, N_Op_Xor)
            and then Safe_In_Place_Array_Op
-             (Name (Parent (N)), Left_Opnd (Opnd), Right_Opnd (Opnd))
+                      (Name (Parent (N)), Left_Opnd (Opnd), Right_Opnd (Opnd))
          then
             Build_Boolean_Array_Proc_Call (Parent (N), Opnd, Empty);
             return;
@@ -6974,9 +6979,9 @@ package body Exp_Ch4 is
             --  expression, since these are additional cases that do can
             --  appear on procedure actuals.
 
-            elsif Nkind (Par) = N_Type_Conversion
-              or else Nkind (Par) = N_Parameter_Association
-              or else Nkind (Par) = N_Qualified_Expression
+            elsif Nkind_In (Par, N_Type_Conversion,
+                                 N_Parameter_Association,
+                                 N_Qualified_Expression)
             then
                Par := Parent (Par);
 
@@ -8278,10 +8283,7 @@ package body Exp_Ch4 is
       --  For identifiers and indexed components, it is sufficent to have a
       --  constrained Unchecked_Union nominal subtype.
 
-      if Nkind (N) = N_Identifier
-           or else
-         Nkind (N) = N_Indexed_Component
-      then
+      if Nkind_In (N, N_Identifier, N_Indexed_Component) then
          return Is_Unchecked_Union (Base_Type (Etype (N)))
                   and then
                 Is_Constrained (Etype (N));
@@ -8944,9 +8946,7 @@ package body Exp_Ch4 is
          elsif Is_Entity_Name (Op) then
             return Is_Unaliased (Op);
 
-         elsif Nkind (Op) = N_Indexed_Component
-           or else Nkind (Op) = N_Selected_Component
-         then
+         elsif Nkind_In (Op, N_Indexed_Component, N_Selected_Component) then
             return Is_Unaliased (Prefix (Op));
 
          elsif Nkind (Op) = N_Slice then