===================================================================
@@ -1154,12 +1154,29 @@ package body Prj is
function Is_Compilable (Source : Source_Id) return Boolean is
begin
- return Source.Language.Config.Compiler_Driver /= No_File
- and then Length_Of_Name (Source.Language.Config.Compiler_Driver) /= 0
- and then not Source.Locally_Removed
- and then (Source.Language.Config.Kind /= File_Based
- or else
- Source.Kind /= Spec);
+ case Source.Compilable is
+ when Unknown =>
+ if Source.Language.Config.Compiler_Driver /= No_File
+ and then
+ Length_Of_Name (Source.Language.Config.Compiler_Driver) /= 0
+ and then not Source.Locally_Removed
+ and then (Source.Language.Config.Kind /= File_Based
+ or else
+ Source.Kind /= Spec)
+ then
+ Source.Compilable := Yes;
+ return True;
+ else
+ Source.Compilable := No;
+ return False;
+ end if;
+
+ when Yes =>
+ return True;
+
+ when No =>
+ return False;
+ end case;
end Is_Compilable;
------------------------------
===================================================================
@@ -706,6 +706,10 @@ package Prj is
-- file). Index is 0 if there is either no unit or a single one, and
-- starts at 1 when there are multiple units
+ Compilable : Yes_No_Unknown := Unknown;
+ -- Updated at the first call to Is_Compilable. Yes if source file is
+ -- compilable.
+
Locally_Removed : Boolean := False;
-- True if the source has been "excluded"
@@ -788,6 +792,7 @@ package Prj is
Unit => No_Unit_Index,
Index => 0,
Locally_Removed => False,
+ Compilable => Unknown,
Replaced_By => No_Source,
File => No_File,
Display_File => No_File,