summaryrefslogtreecommitdiff
path: root/gcc/ada/fname-uf.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/fname-uf.adb')
-rw-r--r--gcc/ada/fname-uf.adb42
1 files changed, 35 insertions, 7 deletions
diff --git a/gcc/ada/fname-uf.adb b/gcc/ada/fname-uf.adb
index 37fe82c5c43..3572d1a6f7a 100644
--- a/gcc/ada/fname-uf.adb
+++ b/gcc/ada/fname-uf.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- $Revision: 1.1 $
+-- $Revision$
-- --
-- Copyright (C) 1992-2001, Free Software Foundation, Inc. --
-- --
@@ -28,6 +28,7 @@
with Alloc;
with Debug; use Debug;
+with Fmap;
with Krunch;
with Namet; use Namet;
with Opt; use Opt;
@@ -137,6 +138,9 @@ package body Fname.UF is
N : Int;
+ Pname : File_Name_Type := No_File;
+ Fname : File_Name_Type := No_File;
+
begin
-- Null or error name means that some previous error occurred
-- This is an unrecoverable error, so signal it.
@@ -145,6 +149,19 @@ package body Fname.UF is
raise Unrecoverable_Error;
end if;
+ -- Look into the mapping from unit names to file names
+
+ Fname := Fmap.File_Name_Of (Uname);
+
+ -- If the unit name is already mapped, return the corresponding
+ -- file name.
+
+ if Fname /= No_File then
+ return Fname;
+ end if;
+
+ -- If there is a specific SFN pragma, return the corresponding file name
+
N := SFN_HTable.Get (Uname);
if N /= No_Entry then
@@ -367,14 +384,25 @@ package body Fname.UF is
-- Check if file exists and if so, return the entry
- elsif Find_File (Fnam, Source) /= No_File then
- return Fnam;
+ else
+ Pname := Find_File (Fnam, Source);
+
+ -- Check if file exists and if so, return the entry
- -- This entry does not match after all, because this is
- -- the first search loop, and the file does not exist.
+ if Pname /= No_File then
- else
- Fnam := No_File;
+ -- Add to mapping, so that we don't do another
+ -- path search in Find_File for this file name
+
+ Fmap.Add (Get_File_Name.Uname, Fnam, Pname);
+ return Fnam;
+
+ -- This entry does not match after all, because this is
+ -- the first search loop, and the file does not exist.
+
+ else
+ Fnam := No_File;
+ end if;
end if;
end if;