diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2011-08-29 16:40:11 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2011-08-29 16:40:11 +0200 |
commit | 226a7fa431fc3f9fd533abf6078a1aa9adb9a718 (patch) | |
tree | e32b257f259965d95e0d8e66ce84cc867c98918a /gcc/ada/lib-xref.adb | |
parent | dfbcb149aa59ef88a254489d2c3aa9c105562490 (diff) | |
download | gcc-226a7fa431fc3f9fd533abf6078a1aa9adb9a718.zip gcc-226a7fa431fc3f9fd533abf6078a1aa9adb9a718.tar.gz gcc-226a7fa431fc3f9fd533abf6078a1aa9adb9a718.tar.bz2 |
[multiple changes]
2011-08-29 Robert Dewar <dewar@adacore.com>
* sem_ch10.adb, a-coorse.adb, exp_dist.adb, exp_ch3.adb: Minor
reformatting.
* gcc-interface/Make-lang.in: Update dependencies.
2011-08-29 Yannick Moy <moy@adacore.com>
* alfa.ads (Name_Of_Heap_Variable): New constant name.
* lib-xref-alfa.adb, lib-xref.adb, lib-xref.ads (Drefs): New global
table to hold dereferences.
(Add_ALFA_Xrefs): Take into account dereferences as special
reads/writes to the variable "HEAP".
(Enclosing_Subprogram_Or_Package): Move subprogram here.
(Generate_Dereference): New procedure to store a read/write dereferencew
in the table Drefs.
* put_alfa.adb (Put_ALFA): Use different default than (0,0) used for
the special "HEAP" var.
* sem_ch4.adb (Analyze_Explicit_Dereference): Store read dereference
in ALFA mode.
* sem_util.adb (Note_Possible_Modification): Store write dereference
in ALFA mode.
From-SVN: r178252
Diffstat (limited to 'gcc/ada/lib-xref.adb')
-rw-r--r-- | gcc/ada/lib-xref.adb | 85 |
1 files changed, 2 insertions, 83 deletions
diff --git a/gcc/ada/lib-xref.adb b/gcc/ada/lib-xref.adb index b503273..b280ce5 100644 --- a/gcc/ada/lib-xref.adb +++ b/gcc/ada/lib-xref.adb @@ -112,9 +112,6 @@ package body Lib.Xref is -- Local Subprograms -- ------------------------ - function Enclosing_Subprogram_Or_Package (N : Node_Id) return Entity_Id; - -- Return the closest enclosing subprogram of package - procedure Generate_Prim_Op_References (Typ : Entity_Id); -- For a tagged type, generate implicit references to its primitive -- operations, for source navigation. This is done right before emitting @@ -124,84 +121,6 @@ package body Lib.Xref is function Lt (T1, T2 : Xref_Entry) return Boolean; -- Order cross-references - ------------------------------------- - -- Enclosing_Subprogram_Or_Package -- - ------------------------------------- - - function Enclosing_Subprogram_Or_Package (N : Node_Id) return Entity_Id is - Result : Entity_Id; - - begin - -- If N is the defining identifier for a subprogram, then return the - -- enclosing subprogram or package, not this subprogram. - - if Nkind_In (N, N_Defining_Identifier, N_Defining_Operator_Symbol) - and then Nkind (Parent (N)) in N_Subprogram_Specification - then - Result := Parent (Parent (Parent (N))); - else - Result := N; - end if; - - loop - exit when No (Result); - - case Nkind (Result) is - when N_Package_Specification => - Result := Defining_Unit_Name (Result); - exit; - - when N_Package_Body => - Result := Defining_Unit_Name (Result); - exit; - - when N_Subprogram_Specification => - Result := Defining_Unit_Name (Result); - exit; - - when N_Subprogram_Declaration => - Result := Defining_Unit_Name (Specification (Result)); - exit; - - when N_Subprogram_Body => - Result := Defining_Unit_Name (Specification (Result)); - exit; - - -- The enclosing subprogram for a pre- or postconditions should be - -- the subprogram to which the pragma is attached. This is not - -- always the case in the AST, as the pragma may be declared after - -- the declaration of the subprogram. Return Empty in this case. - - when N_Pragma => - if Get_Pragma_Id (Result) = Pragma_Precondition - or else - Get_Pragma_Id (Result) = Pragma_Postcondition - then - return Empty; - else - Result := Parent (Result); - end if; - - when others => - Result := Parent (Result); - end case; - end loop; - - if Nkind (Result) = N_Defining_Program_Unit_Name then - Result := Defining_Identifier (Result); - end if; - - -- Do no return a scope without a proper location - - if Present (Result) - and then Sloc (Result) = No_Location - then - return Empty; - end if; - - return Result; - end Enclosing_Subprogram_Or_Package; - ------------------------- -- Generate_Definition -- ------------------------- @@ -946,8 +865,8 @@ package body Lib.Xref is Ref := Original_Location (Sloc (Nod)); Def := Original_Location (Sloc (Ent)); - Ref_Scope := Enclosing_Subprogram_Or_Package (N); - Ent_Scope := Enclosing_Subprogram_Or_Package (Ent); + Ref_Scope := ALFA.Enclosing_Subprogram_Or_Package (N); + Ent_Scope := ALFA.Enclosing_Subprogram_Or_Package (Ent); Xrefs.Increment_Last; Indx := Xrefs.Last; |