diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-02-25 19:53:00 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-02-25 19:53:00 +0000 |
commit | 20e31e42626c109b96cb044d39a574ef6f18986e (patch) | |
tree | 2eee449e7a4167a1bc1ec3b3986113b2a1923516 /gcc/ada/atree.adb | |
parent | 7b7f33670b97cb646d94435df4e390e4f9264bd4 (diff) | |
download | gcc-20e31e42626c109b96cb044d39a574ef6f18986e.tar.gz |
2014-02-25 Basile Starynkevitch <basile@starynkevitch.net>
{{merge using svnmerge.py with trunk GCC 4.9 svn
rev.208153. Notice that svn 1.8.8 crashes while doing this, so
merged with svn 1.7.14... All is well compiled.}}
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@208154 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/atree.adb')
-rw-r--r-- | gcc/ada/atree.adb | 56 |
1 files changed, 53 insertions, 3 deletions
diff --git a/gcc/ada/atree.adb b/gcc/ada/atree.adb index 35e8a7a09ff..19517734867 100644 --- a/gcc/ada/atree.adb +++ b/gcc/ada/atree.adb @@ -793,6 +793,8 @@ package body Atree is New_Ent : Entity_Id; begin + -- Build appropriate node + case N_Entity (Nkind (E)) is when N_Defining_Identifier => New_Ent := New_Entity (N_Defining_Identifier, Sloc (E)); @@ -847,7 +849,8 @@ package body Atree is begin if Field in Node_Range then - New_N := Union_Id (Copy_Separate_Tree (Node_Id (Field))); + New_N := + Union_Id (Copy_Separate_Tree (Node_Id (Field))); if Parent (Node_Id (Field)) = Source then Set_Parent (Node_Id (New_N), New_Id); @@ -898,6 +901,42 @@ package body Atree is Set_Entity (New_Id, Empty); end if; + -- Reset all Etype fields and Analyzed flags, because input tree may + -- have been fully or partially analyzed. + + if Nkind (New_Id) in N_Has_Etype then + Set_Etype (New_Id, Empty); + end if; + + Set_Analyzed (New_Id, False); + + -- Rather special case, if we have an expanded name, then change + -- it back into a selected component, so that the tree looks the + -- way it did coming out of the parser. This will change back + -- when we analyze the selected component node. + + if Nkind (New_Id) = N_Expanded_Name then + + -- The following code is a bit kludgy. It would be cleaner to + -- Add an entry Change_Expanded_Name_To_Selected_Component to + -- Sinfo.CN, but that's an earthquake, because it has the wrong + -- license, and Atree is used outside the compiler, e.g. in the + -- binder and in ASIS, so we don't want to add that dependency. + + -- Consequently we have no choice but to hold our noses and do + -- the change manually. At least we are Atree, so this odd use + -- of Atree.Unchecked_Access is at least all in the family. + + -- Change the node type + + Atree.Unchecked_Access.Set_Nkind (New_Id, N_Selected_Component); + + -- Clear the Chars field which is not present in a selected + -- component node, so we don't want a junk value around. + + Set_Node1 (New_Id, Empty); + end if; + -- All done, return copied node return New_Id; @@ -1870,8 +1909,7 @@ package body Atree is -- Both the old and new copies of the node will share the same list -- of aspect specifications if aspect specifications are present. - if Has_Aspects (Sav_Node) then - Set_Has_Aspects (Sav_Node, False); + if Old_Has_Aspects then Set_Aspect_Specifications (Sav_Node, Aspect_Specifications (Old_Node)); end if; @@ -2644,6 +2682,12 @@ package body Atree is return Node_Id (Nodes.Table (N + 5).Field10); end Node34; + function Node35 (N : Node_Id) return Node_Id is + begin + pragma Assert (Nkind (N) in N_Entity); + return Node_Id (Nodes.Table (N + 5).Field11); + end Node35; + function List1 (N : Node_Id) return List_Id is begin pragma Assert (N <= Nodes.Last); @@ -5408,6 +5452,12 @@ package body Atree is Nodes.Table (N + 5).Field10 := Union_Id (Val); end Set_Node34; + procedure Set_Node35 (N : Node_Id; Val : Node_Id) is + begin + pragma Assert (Nkind (N) in N_Entity); + Nodes.Table (N + 5).Field11 := Union_Id (Val); + end Set_Node35; + procedure Set_List1 (N : Node_Id; Val : List_Id) is begin pragma Assert (N <= Nodes.Last); |