aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/lib-xref-spark_specific.adb
diff options
context:
space:
mode:
authorYannick Moy <moy@adacore.com>2014-05-21 12:56:05 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2014-05-21 14:56:05 +0200
commit63b5225b44626f58396430f11b1592f3b7f155f4 (patch)
tree56db786687dc97722095edb5588d9fc21cf0651a /gcc/ada/lib-xref-spark_specific.adb
parenta8a89b743d7f22120969402642b2375537c67243 (diff)
downloadgcc-63b5225b44626f58396430f11b1592f3b7f155f4.zip
gcc-63b5225b44626f58396430f11b1592f3b7f155f4.tar.gz
gcc-63b5225b44626f58396430f11b1592f3b7f155f4.tar.bz2
2014-05-21 Yannick Moy <moy@adacore.com>
* lib-xref-spark_specific.adb, lib-xref.ads, lib-xref.adb (Enclosing_Subprogram_Or_Package): Only return a library-level package. From-SVN: r210700
Diffstat (limited to 'gcc/ada/lib-xref-spark_specific.adb')
-rw-r--r--gcc/ada/lib-xref-spark_specific.adb39
1 files changed, 27 insertions, 12 deletions
diff --git a/gcc/ada/lib-xref-spark_specific.adb b/gcc/ada/lib-xref-spark_specific.adb
index 0b32aad..aea8b2c 100644
--- a/gcc/ada/lib-xref-spark_specific.adb
+++ b/gcc/ada/lib-xref-spark_specific.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2011-2013, Free Software Foundation, Inc. --
+-- Copyright (C) 2011-2014, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -23,10 +23,9 @@
-- --
------------------------------------------------------------------------------
-with SPARK_Xrefs; use SPARK_Xrefs;
-with Einfo; use Einfo;
-with Nmake; use Nmake;
-with Put_SPARK_Xrefs;
+with SPARK_Xrefs; use SPARK_Xrefs;
+with Einfo; use Einfo;
+with Nmake; use Nmake;
with GNAT.HTable;
@@ -972,7 +971,9 @@ package body SPARK_Specific is
-- Enclosing_Subprogram_Or_Package --
-------------------------------------
- function Enclosing_Subprogram_Or_Package (N : Node_Id) return Entity_Id is
+ function Enclosing_Subprogram_Or_Library_Package
+ (N : Node_Id) return Entity_Id
+ is
Result : Entity_Id;
begin
@@ -990,12 +991,26 @@ package body SPARK_Specific is
while Present (Result) loop
case Nkind (Result) is
when N_Package_Specification =>
- Result := Defining_Unit_Name (Result);
- exit;
+
+ -- Only return a library-level package
+
+ if Is_Library_Level_Entity (Defining_Entity (Result)) then
+ Result := Defining_Entity (Result);
+ exit;
+ else
+ Result := Parent (Result);
+ end if;
when N_Package_Body =>
- Result := Defining_Unit_Name (Result);
- exit;
+
+ -- Only return a library-level package
+
+ if Is_Library_Level_Entity (Defining_Entity (Result)) then
+ Result := Defining_Entity (Result);
+ exit;
+ else
+ Result := Parent (Result);
+ end if;
when N_Subprogram_Specification =>
Result := Defining_Unit_Name (Result);
@@ -1045,7 +1060,7 @@ package body SPARK_Specific is
end if;
return Result;
- end Enclosing_Subprogram_Or_Package;
+ end Enclosing_Subprogram_Or_Library_Package;
-----------------
-- Entity_Hash --
@@ -1107,7 +1122,7 @@ package body SPARK_Specific is
Create_Heap;
end if;
- Ref_Scope := Enclosing_Subprogram_Or_Package (N);
+ Ref_Scope := Enclosing_Subprogram_Or_Library_Package (N);
Deref.Ent := Heap;
Deref.Loc := Loc;