Changeset 2636
- Timestamp:
- 02/26/08 15:42:08 (11 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/tendra/src/producers/ada/asis/asis-compilation_units-relations.adb
r2634 r2636 104 104 105 105 function Add_Child 106 (This : in Root_Tree_Access;107 Node : in Tree_Node_Access;108 Spec_Unit : in Compilation_Unit)106 (This : in Root_Tree_Access; 107 Node : in Tree_Node_Access; 108 Unit : in Compilation_Unit) 109 109 return Tree_Node_Access; 110 110 … … 117 117 return Tree_Node_Access; 118 118 119 function Add_Subunit 120 (This : in Root_Tree_Access; 121 Node : in Tree_Node_Access; 122 Unit : in Compilation_Unit) 123 return Tree_Node_Access; 124 119 125 procedure Append 120 126 (This : in Root_Tree_Access; … … 221 227 Body_Consistent : Boolean := True; 222 228 223 -- завОÑОЌПÑÑО Ñела (with)229 -- завОÑОЌПÑÑО Ñела (with) 224 230 Body_Dependences : Tree_Node_Array_Access := null; 225 231 … … 760 766 Unit := List (Index); 761 767 762 if Find (Result, Unit) = null 763 then 768 if Find (Result, Unit) = null then 764 769 Kinds := Unit_Kind (Unit); 765 770 … … 811 816 Node : in Utils.Tree_Node_Access) 812 817 is 818 function Process 819 (Index : in List_Index) 820 return Boolean; 821 813 822 Exist_Node : Utils.Tree_Node_Access := null; 814 823 … … 818 827 -- Process -- 819 828 function Process 820 (Index : in List_Index)829 (Index : in List_Index) 821 830 return Boolean 822 831 is … … 944 953 Second_Unit := Corresponding_Body (Unit, The_Context); 945 954 946 if not Is_Nil (Second_Unit) 955 if not Is_Nil (Second_Unit) 947 956 and then not Is_Identical (Second_Unit, Unit) 948 957 then … … 981 990 Node : Tree_Node_Access := null; 982 991 983 Std : Compilation_Unit := Library_Unit_Declaration ("Standard", The_Context); 992 Std : Compilation_Unit := 993 Library_Unit_Declaration ("Standard", The_Context); 984 994 985 995 procedure Append_Unit … … 1190 1200 1191 1201 if Node /= null then 1192 Add_Body_Dependents (Result, Exist_Node, Node);1202 Add_Body_Dependents (Result, Exist_Node, Node); 1193 1203 end if; 1194 1204 … … 1196 1206 else 1197 1207 if Node /= null then 1198 Add_Body_Dependents (Result, Exist_Node, Node);1208 Add_Body_Dependents (Result, Exist_Node, Node); 1199 1209 end if; 1200 1210 end if; … … 1211 1221 For_Body : in Boolean := False) 1212 1222 is 1223 procedure Retrive_For_Body 1224 (Unit : in Compilation_Unit); 1225 1213 1226 Except : Compilation_Unit := Library_Unit_Declaration 1214 1227 ("Ada.Exceptions", The_Context); … … 1290 1303 is 1291 1304 use Utils; 1305 1306 procedure Append_To_Node 1307 (Unit : in Compilation_Unit; 1308 Node : in Tree_Node_Access; 1309 Glued : in out Tree_Node_Array_Access); 1310 1311 procedure Post_Operation 1312 (Element : in Asis.Element; 1313 Control : in out Traverse_Control; 1314 State : in out Boolean); 1315 1316 function Have_Except 1317 (Unit : in Compilation_Unit) 1318 return Boolean; 1319 1320 function Have_Sys 1321 (Unit : in Compilation_Unit) 1322 return Boolean; 1323 1324 procedure Retrive 1325 (Unit : in Compilation_Unit; 1326 Node : in Tree_Node_Access); 1292 1327 1293 1328 Result : Root_Tree_Access := new Root_Tree; … … 1393 1428 return Boolean 1394 1429 is 1430 procedure Pre_Operation 1431 (Element : in Asis.Element; 1432 Control : in out Traverse_Control; 1433 State : in out Boolean); 1434 1395 1435 Control : Traverse_Control := Continue; 1396 1436 State : Boolean := False; … … 1426 1466 return Boolean 1427 1467 is 1468 procedure Pre_Operation 1469 (Element : in Asis.Element; 1470 Control : in out Traverse_Control; 1471 State : in out Boolean); 1472 1428 1473 Control : Traverse_Control := Continue; 1429 1474 State : Boolean := False; … … 1645 1690 A_Procedure_Body .. A_Package_Body 1646 1691 then 1647 Get_Subunits (Result, Next_Unit, Next_Node, The_Context); 1692 Get_Subunits 1693 (Result, Next_Unit, Next_Node, The_Context); 1648 1694 end if; 1649 1695 end if; … … 1680 1726 1681 1727 elsif Kinds in A_Procedure_Body .. A_Protected_Body_Subunit then 1682 Get_Subunits (Result, Unit, Add_Child (Result, null, Unit), The_Context); 1728 Get_Subunits 1729 (Result, Unit, Add_Child (Result, null, Unit), The_Context); 1683 1730 end if; 1684 1731 end if; … … 1702 1749 is 1703 1750 use Utils; 1751 1752 procedure Retrive 1753 (Unit : in Compilation_Unit; 1754 Node : in Tree_Node_Access); 1704 1755 1705 1756 Result : Root_Tree_Access := new Root_Tree; … … 1828 1879 A_Procedure_Body .. A_Package_Body 1829 1880 then 1830 Get_Subunits (Result, Next_Unit, Next_Node, The_Context); 1881 Get_Subunits 1882 (Result, Next_Unit, Next_Node, The_Context); 1831 1883 end if; 1832 1884 end loop; … … 1884 1936 Kinds : Unit_Kinds; 1885 1937 1886 Std : Compilation_Unit := Library_Unit_Declaration ("Standard", The_Context); 1938 Std : Compilation_Unit := 1939 Library_Unit_Declaration ("Standard", The_Context); 1887 1940 1888 1941 procedure Append_Unit … … 1932 1985 if Exist_Node = null then 1933 1986 if Is_Identical (Unit, Std) then 1934 Node := Add_Child (Result, Node, Unit, Nil_Compilation_Unit, True); 1987 Node := Add_Child 1988 (Result, Node, Unit, Nil_Compilation_Unit, True); 1989 1935 1990 Node := null; 1936 1991 else … … 2090 2145 Exist_Node := Find (Result, Sub_Unit); 2091 2146 if Exist_Node = null then 2092 Exist_Node := Add_ Child(Result, Node, Sub_Unit);2147 Exist_Node := Add_Subunit (Result, Node, Sub_Unit); 2093 2148 Check_10_1_1_26c_26b (Unit, Exist_Node, True); 2094 2149 Retrive_With_Clause (Unit, Exist_Node, True); … … 2096 2151 Retrive_Subunits (Sub_Unit, Exist_Node); 2097 2152 else 2098 Glue_Nodes (Result, Node, Exist_Node);2153 Glue_Nodes (Result, Exist_Node, Node); 2099 2154 end if; 2100 2155 end if; … … 2127 2182 2128 2183 if Exist_Node = null then 2129 Body_Unit := Corresponding_Body (Internal_Unit, The_Context); 2184 Body_Unit := Corresponding_Body 2185 (Internal_Unit, The_Context); 2130 2186 2131 2187 if not Is_Identical (Body_Unit, Internal_Unit) then 2132 Exist_Node := Add_Child (Result, null, Internal_Unit, Body_Unit); 2188 Exist_Node := Add_Child 2189 (Result, null, Internal_Unit, Body_Unit); 2133 2190 else 2134 Exist_Node := Add_Child (Result, null, Internal_Unit); 2191 Exist_Node := Add_Child 2192 (Result, null, Internal_Unit); 2135 2193 end if; 2136 2194 2137 2195 if Node /= null then 2138 Add_Body_Dependents (Result, Exist_Node, Node);2196 Add_Body_Dependents (Result, Exist_Node, Node); 2139 2197 end if; 2140 2198 … … 2142 2200 else 2143 2201 if Node /= null then 2144 Add_Body_Dependents (Result, Exist_Node, Node);2202 Add_Body_Dependents (Result, Exist_Node, Node); 2145 2203 end if; 2146 2204 end if; … … 2157 2215 For_Body : in Boolean := False) 2158 2216 is 2217 procedure Retrive_For_Body 2218 (Unit : in Compilation_Unit); 2219 2159 2220 Except : Compilation_Unit := Library_Unit_Declaration 2160 2221 ("Ada.Exceptions", The_Context); … … 2238 2299 2239 2300 procedure Get_Subunits 2240 (Tree : in Utils. root_Tree_Access;2301 (Tree : in Utils.Root_Tree_Access; 2241 2302 Unit : in Compilation_Unit; 2242 2303 Node : in Utils.Tree_Node_Access; … … 2293 2354 2294 2355 if Assigned (Declaration) then 2295 Internal_Unit := Asis.Elements.Enclosing_Compilation_Unit (Declaration); 2356 Internal_Unit := 2357 Asis.Elements.Enclosing_Compilation_Unit (Declaration); 2296 2358 2297 2359 if Unit_Kind (Internal_Unit) in … … 2309 2371 if Result_List.all'Length > 1 then 2310 2372 Ada.Wide_Text_IO.Put_Line 2311 ("[Warning] Founded more then one unit for one with_clause in unit"2312 & Unit_Full_Name (Unit) & " clause number "2373 ("[Warning] Founded more then one unit for one with_clause " 2374 & "in unit " & Unit_Full_Name (Unit) & " clause number " 2313 2375 & List_Index'Wide_Image (Number)); 2314 2376 end if; … … 2379 2441 -- 10.1.1 (26.b) 2380 2442 2443 procedure Pre_Operation 2444 (Element : in Asis.Element; 2445 Control : in out Traverse_Control; 2446 State : in out Check_10_1_1_26c_26b_Information); 2447 2448 procedure Post_Operation 2449 (Element : in Asis.Element; 2450 Control : in out Traverse_Control; 2451 State : in out Check_10_1_1_26c_26b_Information); 2452 2381 2453 Except : Compilation_Unit := Library_Unit_Declaration 2382 2454 ("Ada.Exceptions", The_Context); … … 2479 2551 2480 2552 function Add_Child 2481 (This : in Root_Tree_Access;2482 Node : in Tree_Node_Access;2483 Spec_Unit : in Compilation_Unit)2553 (This : in Root_Tree_Access; 2554 Node : in Tree_Node_Access; 2555 Unit : in Compilation_Unit) 2484 2556 return Tree_Node_Access 2485 2557 is 2486 New_Node : Tree_Node_Access := new Tree_Node; 2487 begin 2488 New_Node.Unit := Spec_Unit; 2489 2490 if Node = null then 2491 This.Next := Add_Node (This.Next, New_Node.Self); 2492 else 2493 Node.Next := Add_Node (Node.Next, New_Node.Self); 2494 New_Node.Prevs := Add_Node (New_Node.Prevs, Node.Self); 2495 end if; 2496 2497 This.Units := Add_Node_Ordered (This.Units, New_Node.Self); 2498 return New_Node; 2558 Kinds : Unit_Kinds; 2559 begin 2560 if Is_Nil (Unit) then 2561 return Node; 2562 end if; 2563 2564 declare 2565 New_Node : Tree_Node_Access := new Tree_Node; 2566 begin 2567 Kinds := Unit_Kind (Unit); 2568 2569 if Kinds in A_Procedure .. A_Generic_Package_Renaming 2570 or else Kinds = A_Nonexistent_Declaration 2571 then 2572 New_Node.Unit := Unit; 2573 else 2574 New_Node.Unit_Body := Unit; 2575 end if; 2576 2577 if Node = null then 2578 This.Next := Add_Node (This.Next, New_Node.Self); 2579 else 2580 Node.Next := Add_Node (Node.Next, New_Node.Self); 2581 New_Node.Prevs := Add_Node (New_Node.Prevs, Node.Self); 2582 end if; 2583 2584 This.Units := Add_Node_Ordered (This.Units, New_Node.Self); 2585 return New_Node; 2586 end; 2499 2587 end Add_Child; 2500 2588 … … 2508 2596 return Tree_Node_Access 2509 2597 is 2510 New_Node : Tree_Node_Access := new Tree_Node; 2511 begin 2512 New_Node.Unit := Spec_Unit; 2513 New_Node.Unit_Body := Body_Unit; 2514 New_Node.Skip_Spec := Skip_Spec; 2515 2516 if Node = null then 2517 This.Next := Add_Node (This.Next, New_Node.Self); 2518 else 2519 Node.Next := Add_Node (Node.Next, New_Node.Self); 2520 New_Node.Prevs := Add_Node (New_Node.Prevs, Node.Self); 2521 end if; 2522 2523 This.Units := Add_Node_Ordered (This.Units, New_Node.Self); 2524 return New_Node; 2598 Kinds : Unit_Kinds; 2599 begin 2600 if Is_Nil (Spec_Unit) 2601 and then Is_Nil (Body_Unit) 2602 then 2603 return Node; 2604 end if; 2605 2606 if not Is_Nil (Spec_Unit) then 2607 Kinds := Unit_Kind (Spec_Unit); 2608 2609 if Kinds not in A_Procedure .. A_Generic_Package_Renaming 2610 and then Kinds = A_Nonexistent_Declaration 2611 then 2612 Asis.Implementation.Set_Status 2613 (Data_Error, "Add_Child - " 2614 & "invalid unit specification " 2615 & Unit_Full_Name (Spec_Unit)); 2616 2617 raise Asis.Exceptions.ASIS_Failed; 2618 end if; 2619 end if; 2620 2621 if not Is_Identical (Spec_Unit, Body_Unit) then 2622 if not Is_Nil (Body_Unit) then 2623 Kinds := Unit_Kind (Body_Unit); 2624 2625 if Kinds in A_Procedure .. A_Generic_Package_Renaming 2626 or else Kinds = A_Nonexistent_Declaration 2627 then 2628 Asis.Implementation.Set_Status 2629 (Data_Error, "Add_Child - " 2630 & "invalid unit body " & Unit_Full_Name (Body_Unit)); 2631 2632 raise Asis.Exceptions.ASIS_Failed; 2633 end if; 2634 end if; 2635 end if; 2636 2637 declare 2638 New_Node : Tree_Node_Access := new Tree_Node; 2639 begin 2640 New_Node.Unit := Spec_Unit; 2641 2642 if not Is_Identical (Spec_Unit, Body_Unit) then 2643 New_Node.Unit_Body := Body_Unit; 2644 end if; 2645 2646 New_Node.Skip_Spec := Skip_Spec; 2647 2648 if Node = null then 2649 This.Next := Add_Node (This.Next, New_Node.Self); 2650 else 2651 Node.Next := Add_Node (Node.Next, New_Node.Self); 2652 New_Node.Prevs := Add_Node (New_Node.Prevs, Node.Self); 2653 end if; 2654 2655 This.Units := Add_Node_Ordered (This.Units, New_Node.Self); 2656 return New_Node; 2657 end; 2525 2658 end Add_Child; 2659 2660 ----------------- 2661 -- Add_Subunit -- 2662 ----------------- 2663 2664 function Add_Subunit 2665 (This : in Root_Tree_Access; 2666 Node : in Tree_Node_Access; 2667 Unit : in Compilation_Unit) 2668 return Tree_Node_Access 2669 is 2670 Kinds : Unit_Kinds; 2671 begin 2672 if Is_Nil (Unit) then 2673 return Node; 2674 end if; 2675 2676 Kinds := Unit_Kind (Unit); 2677 2678 if Kinds not in 2679 A_Procedure_Body_Subunit .. A_Protected_Body_Subunit 2680 then 2681 Asis.Implementation.Set_Status 2682 (Data_Error, "Add_Subunit - " 2683 & "invalid subunit " & Unit_Full_Name (Unit)); 2684 2685 raise Asis.Exceptions.ASIS_Failed; 2686 end if; 2687 2688 declare 2689 New_Node : Tree_Node_Access := new Tree_Node; 2690 begin 2691 New_Node.Unit_Body := Unit; 2692 2693 if Node = null then 2694 This.Next := Add_Node (This.Next, New_Node.Self); 2695 else 2696 Node.Prevs := Add_Node (Node.Prevs, New_Node.Self); 2697 New_Node.Next := Add_Node (New_Node.Next, Node.Self); 2698 end if; 2699 2700 This.Units := Add_Node_Ordered (This.Units, New_Node.Self); 2701 return New_Node; 2702 end; 2703 end Add_Subunit; 2526 2704 2527 2705 ------------ … … 2534 2712 is 2535 2713 begin 2714 if Is_Nil (Unit) then 2715 return; 2716 end if; 2717 2536 2718 if Find (This, Unit) /= null then 2537 2719 Asis.Implementation.Set_Status … … 2543 2725 2544 2726 declare 2727 Kinds : Unit_Kinds; 2545 2728 New_Node : Tree_Node_Access := new Tree_Node; 2546 2729 begin 2547 New_Node.Unit := Unit; 2730 Kinds := Unit_Kind (Unit); 2731 2732 if Kinds in A_Procedure .. A_Generic_Package_Renaming 2733 or else Kinds = A_Nonexistent_Declaration 2734 then 2735 New_Node.Unit := Unit; 2736 else 2737 New_Node.Unit_Body := Unit; 2738 end if; 2548 2739 2549 2740 if This.Last_Node = null then … … 2611 2802 2612 2803 Node.Circular := Append (Node.Circular, Node.Unit); 2613 Node.Circular := Append (Node.Circular, Circular (Circular.all'Last)); 2804 Node.Circular := Append 2805 (Node.Circular, Circular (Circular.all'Last)); 2614 2806 2615 2807 Deallocate (Circular); … … 2617 2809 -- 2 pair (self and parent) 2618 2810 Node.Circular := Append 2619 (Node.Circular, (Prev_Node.Unit, Node.Unit, Prev_Node.Unit)); 2811 (Node.Circular, 2812 (Prev_Node.Unit, Node.Unit, Prev_Node.Unit)); 2620 2813 end if; 2621 2814 … … 2809 3002 2810 3003 if not Is_Nil (Node.Unit) then 2811 Kinds := Unit_Kind (Node.Unit); 2812 Parent_Kinds := Unit_Kind (Prev.Unit); 2813 2814 if Kinds in A_Procedure .. A_Generic_Package_Renaming then 2815 if Parent_Kinds in 2816 A_Procedure .. A_Generic_Package_Renaming 2817 then 2818 Node.Consistent := False; 2819 Result := Append (Result, (Prev.Unit, Node.Unit)); 2820 end if; 2821 end if; 3004 Node.Consistent := False; 3005 Result := Append (Result, (Prev.Unit, Node.Unit)); 2822 3006 end if; 2823 3007 … … 2845 3029 (Node : in Tree_Node_Access) 2846 3030 is 3031 procedure Check_Body 3032 (Target : in Tree_Node_Access); 3033 2847 3034 Prev_Unit : Compilation_Unit; 2848 3035 … … 2855 3042 Prev_Unit := Target.Unit_Body; 2856 3043 2857 if not Is_Inconsistent (Prev_Unit)then2858 Node. Consistent := False;3044 if not Target.Body_Consistent then 3045 Node.Body_Consistent := False; 2859 3046 2860 3047 Node.Inconsistent := Append 2861 (Node.Inconsistent, (Prev_Unit, Node.Unit ));3048 (Node.Inconsistent, (Prev_Unit, Node.Unit_Body)); 2862 3049 end if; 2863 2864 elsif not Is_Nil (Target.Unit) then2865 Prev_Unit := Target.Unit;2866 2867 if Unit_Kind (Prev_Unit) in2868 A_Procedure_Body .. A_Protected_Body_Subunit2869 then2870 if not Is_Inconsistent (Prev_Unit) then2871 Node.Consistent := False;2872 2873 Node.Inconsistent := Append2874 (Node.Inconsistent, (Prev_Unit, Node.Unit));2875 end if;2876 end if;2877 3050 end if; 2878 3051 end Check_Body; 2879 2880 -- Check_Spec --2881 procedure Check_Spec2882 (Target : in Tree_Node_Access)2883 is2884 begin2885 if Is_Nil (Target.Unit) then2886 return;2887 end if;2888 2889 Prev_Unit := Target.Unit;2890 2891 if Unit_Kind (Prev_Unit) in2892 A_Procedure .. A_Generic_Package_Renaming2893 then2894 if not Is_Inconsistent (Prev_Unit) then2895 Node.Consistent := False;2896 2897 Node.Inconsistent := Append2898 (Node.Inconsistent, (Prev_Unit, Node.Unit));2899 end if;2900 end if;2901 end Check_Spec;2902 3052 2903 3053 begin … … 2936 3086 end if; 2937 3087 2938 return; 2939 end if; 2940 2941 Kinds := Unit_Kind (Node.Unit); 2942 2943 if Kinds in A_Procedure .. A_Generic_Package_Renaming then 2944 return; 2945 end if; 2946 2947 if not Is_Inconsistent (Node.Unit) then 2948 Node.Consistent := False; 2949 2950 if Is_Source_Changed (Node.Unit) then 2951 Node.Inconsistent := Append 2952 (Node.Inconsistent, 2953 (Nil_Compilation_Unit, Node.Unit)); 2954 else 2955 Node.Inconsistent := Append 2956 (Node.Inconsistent, (Node.Unit, Node.Unit)); 2957 end if; 2958 end if; 2959 2960 if Kinds in A_Procedure_Body .. A_Package_Body then 2961 if Order = Ascending then 2962 if Node.Next /= null then 2963 for Index in Node.Next.all'Range loop 2964 Check_Spec (Node.Next (Index)); 2965 end loop; 3088 if Unit_Kind (Node.Unit_Body) in A_Subunit then 3089 if Order = Ascending then 3090 if Node.Next /= null then 3091 Check_Body (Node.Next (Node.Next'First)); 3092 end if; 3093 else 3094 if Node.Prevs /= null then 3095 Check_Body (Node.Prevs (Node.Prevs'First)); 3096 end if; 2966 3097 end if; 2967 else 2968 if Node.Prevs /= null then 2969 for Index in Node.Prevs.all'Range loop 2970 Check_Spec (Node.Prevs (Index)); 2971 end loop; 2972 end if; 2973 end if; 2974 2975 elsif Kinds in A_Subunit then 2976 if Order = Ascending then 2977 if Node.Next /= null then 2978 for Index in Node.Next.all'Range loop 2979 Check_Body (Node.Next (Index)); 2980 end loop; 2981 end if; 2982 else 2983 if Node.Prevs /= null then 2984 for Index in Node.Prevs.all'Range loop 2985 Check_Body (Node.Prevs (Index)); 2986 end loop; 2987 end if; 2988 end if; 2989 end if; 2990 2991 if Node.Body_Dependences /= null then 2992 for Index in Node.Body_Dependences.all'Range loop 2993 Prev_Unit := Node.Body_Dependences (Index).Unit; 2994 2995 if not Is_Inconsistent (Prev_Unit) then 2996 Node.Consistent := False; 2997 2998 Node.Inconsistent := Append 2999 (Node.Inconsistent, (Prev_Unit, Node.Unit)); 3000 end if; 3001 end loop; 3098 end if; 3099 end if; 3100 3101 if Order = Ascending then 3102 if Node.Next /= null then 3103 for Index in Node.Next.all'Range loop 3104 Check_Body_Consistent (Node.Next.all (Index)); 3105 end loop; 3106 end if; 3107 else 3108 if Node.Prevs /= null then 3109 for Index in Node.Prevs.all'Range loop 3110 Check_Body_Consistent (Node.Prevs.all (Index)); 3111 end loop; 3112 end if; 3002 3113 end if; 3003 3114 end Check_Body_Consistent; … … 3020 3131 Parent_Kinds := Unit_Kind (Target.Unit); 3021 3132 3022 if Parent_Kinds = A_Nonexistent_Declaration 3023 or else Parent_Kinds = A_Nonexistent_Body then 3133 if Parent_Kinds = A_Nonexistent_Declaration then 3024 3134 Node.Missing := Append 3025 3135 (Node.Missing, (Node.Unit, Target.Unit)); … … 3046 3156 end if; 3047 3157 3048 if not Is_Nil (Node.Unit_Body) then 3049 if Kinds = A_Nonexistent_Declaration then 3050 Node.Missing := Append 3051 (Node.Missing, (Node.Unit_Body, Node.Unit)); 3052 end if; 3053 3054 if Node.Body_Dependences /= null then 3055 for Index in Node.Body_Dependences.all'Range loop 3056 Parent_Kinds := Unit_Kind (Node.Body_Dependences (Index).Unit); 3057 3058 if Parent_Kinds = A_Nonexistent_Declaration 3059 or else Parent_Kinds = A_Nonexistent_Body then 3158 if Is_Nil (Node.Unit_Body) then 3159 return; 3160 end if; 3161 3162 if Unit_Kind (Node.Unit) = A_Nonexistent_Declaration then 3163 Node.Missing := Append 3164 (Node.Missing, (Node.Unit_Body, Node.Unit)); 3165 end if; 3166 3167 if Node.Body_Dependences /= null then 3168 for Index in Node.Body_Dependences.all'Range loop 3169 Parent_Kinds := 3170 Unit_Kind (Node.Body_Dependences (Index).Unit); 3171 3172 if Parent_Kinds = A_Nonexistent_Declaration then 3173 Node.Missing := Append 3174 (Node.Missing, 3175 (Node.Unit_Body, 3176 Node.Body_Dependences (Index).Unit)); 3177 end if; 3178 end loop; 3179 end if; 3180 3181 if Unit_Kind (Node.Unit_Body) in A_Subunit then 3182 if Order = Ascending then 3183 if Node.Next /= null then 3184 if Unit_Kind 3185 (Node.Next (Node.Next'First).Unit_Body) = 3186 A_Nonexistent_Body 3187 then 3060 3188 Node.Missing := Append 3061 (Node.Missing, (Node.Unit_Body, Node.Body_Dependences (Index).Unit)); 3189 (Node.Missing, 3190 (Node.Unit_Body, 3191 Node.Next (Node.Next'First).Unit_Body)); 3062 3192 end if; 3063 end loop; 3193 end if; 3194 else 3195 if Node.Prevs /= null then 3196 if Unit_Kind 3197 (Node.Prevs (Node.Prevs'First).Unit_Body) = 3198 A_Nonexistent_Body 3199 then 3200 Node.Missing := Append 3201 (Node.Missing, 3202 (Node.Unit_Body, 3203 Node.Prevs (Node.Prevs'First).Unit_Body)); 3204 end if; 3205 end if; 3064 3206 end if; 3065 3207 end if; … … 3081 3223 3082 3224 Check_Missing (Node); 3083 Check_Body_Consistent (Node);3084 3225 end if; 3085 3226 … … 3108 3249 3109 3250 Check_Missing (Node); 3110 Check_Body_Consistent (Node);3111 3251 end if; 3112 3252 … … 3118 3258 end Desc; 3119 3259 3260 Std_Node : Tree_Node_Access; 3120 3261 begin 3121 3262 Order := This.Order; 3122 3263 3123 3264 if This.Order = Ascending then 3124 Asc (Find (This, Library_Unit_Declaration 3125 ("Standard", The_Context))); 3265 Std_Node := Find 3266 (This, Library_Unit_Declaration ("Standard", The_Context)); 3267 3268 if Std_Node /= null then 3269 if Std_Node.Next /= null then 3270 for Index in Std_Node.Next.all'Range loop 3271 Asc (Std_Node.Next (Index)); 3272 end loop; 3273 3274 for Index in Std_Node.Next.all'Range loop 3275 Check_Body_Consistent (Std_Node.Next (Index)); 3276 end loop; 3277 end if; 3278 end if; 3279 3126 3280 else 3127 3281 if This.Next /= null then 3128 3282 for Index in This.Next.all'Range loop 3129 3283 Desc (This.Next (Index)); 3284 end loop; 3285 3286 for Index in This.Next.all'Range loop 3287 Check_Body_Consistent (This.Next (Index)); 3130 3288 end loop; 3131 3289 end if; … … 3348 3506 return Boolean 3349 3507 is 3508 function Process 3509 (Node : in Tree_Node_Access) 3510 return Boolean; 3511 3350 3512 Result : Boolean := False; 3351 3513 … … 3416 3578 procedure Elab_Body 3417 3579 (Node : in Tree_Node_Access; 3418 All_Bodys : in Boolean := False); 3580 All_Bodys : in Boolean := False; 3581 Only_Body : in Boolean := True); 3419 3582 3420 3583 procedure Elab_Subunits 3421 (Node : in Tree_Node_Access); 3584 (Node : in Tree_Node_Access; 3585 All_Bodys : in Boolean); 3422 3586 3423 3587 procedure Elab_Pragmed_Bodys … … 3425 3589 Unit : in Compilation_Unit); 3426 3590 3591 procedure Append_Inconsistent 3592 (Node : in Tree_Node_Access); 3593 3427 3594 Result : Root_Tree_Access := new Root_Tree; 3428 3595 … … 3432 3599 Library_Unit_Declaration ("Standard", The_Context); 3433 3600 3434 -- for circular elaboration order3601 -- for circular elaboration order 3435 3602 Elaboration_Line : Compilation_Unit_List_Access := null; 3436 3603 … … 3442 3609 and then Node.Consistent 3443 3610 and then not Is_Nil (Node.Unit) 3444 and then Unit_Kind (Node.Unit) in3445 A_Procedure .. A_Generic_Package_Renaming3446 3611 then 3447 3612 if Elaboration_Line /= null then … … 3481 3646 procedure Elab_Body 3482 3647 (Node : in Tree_Node_Access; 3483 All_Bodys : in Boolean := False) 3648 All_Bodys : in Boolean := False; 3649 Only_Body : in Boolean := True) 3484 3650 is 3485 Unit : Compilation_Unit := N il_Compilation_Unit;3651 Unit : Compilation_Unit := Node.Unit_Body; 3486 3652 begin 3487 if not Node.Body_Elaborated 3653 if Node.Body_Elaborated then 3654 Elab_Subunits (Node, All_Bodys); 3655 return; 3656 end if; 3657 3658 if not Node.Body_Consistent 3659 or else Is_Nil (Unit) 3488 3660 then 3489 if not Is_Nil (Node.Unit_Body) 3490 and then Node.Body_Consistent 3661 return; 3662 end if; 3663 3664 if Only_Body 3665 and then Unit_Kind (Unit) not in 3666 A_Procedure_Body .. A_Package_Body 3667 then 3668 return; 3669 end if; 3670 3671 if not Only_Body 3672 and then Unit_Kind (Unit) not in A_Subunit 3673 then 3674 Elab_Subunits (Node, All_Bodys); 3675 return; 3676 end if; 3677 3678 if Elaboration_Line /= null then 3679 -- test circular -- 3680 if In_List 3681 (Elaboration_Line, Elaboration_Line.all'Last, Unit) 3491 3682 then 3492 Unit := Node.Unit_Body; 3493 3494 elsif not Is_Nil (Node.Unit) 3495 and then Node.Consistent 3496 then 3497 Unit := Node.Unit; 3498 end if; 3499 3500 if Unit_Kind (Unit) in 3501 A_Procedure_Body .. A_Protected_Body_Subunit 3502 then 3503 if Elaboration_Line /= null then 3504 -- test circular -- 3505 if In_List 3506 (Elaboration_Line, Elaboration_Line.all'Last, Unit) 3507 then 3508 Node.Circular := Append 3509 (Node.Circular, Elaboration_Line.all); 3510 return; 3511