@@ -1037,15 +1037,15 @@ package body GNATCOLL.Projects is
10371037 function Is_Extending_All (P : Project_Type) return Boolean is
10381038 (Is_Extending_All (P.Data.Node, P.Data.Tree.Tree));
10391039
1040- function Find_Ada_In_Subtree
1041- (Map : Names_Files.Map;
1042- Key : GNATCOLL.VFS.Filesystem_String;
1043- Root : Project_Type)
1040+ function Find_Unit_In_Subtree
1041+ (Map : Names_Files.Map;
1042+ Key : GNATCOLL.VFS.Filesystem_String;
1043+ Root : Project_Type)
10441044 return Names_Files.Cursor;
1045- function Find_C_In_Subtree
1046- (Map : Names_Files.Map;
1047- Key : GNATCOLL.VFS.Filesystem_String;
1048- Root : Project_Type)
1045+ function Find_File_In_Subtree
1046+ (Map : Names_Files.Map;
1047+ Key : GNATCOLL.VFS.Filesystem_String;
1048+ Root : Project_Type)
10491049 return Names_Files.Cursor;
10501050 -- Searches for Source_File_Data with given base name and a project from
10511051 -- a project subtree that starts from Root.
@@ -1073,11 +1073,11 @@ package body GNATCOLL.Projects is
10731073 end if ;
10741074 end Get_Base_Name ;
10751075
1076- -- -----------------------
1077- -- Find_Ada_In_Subtree --
1078- -- -----------------------
1076+ -- ------------------------
1077+ -- Find_Unit_In_Subtree --
1078+ -- ------------------------
10791079
1080- function Find_Ada_In_Subtree
1080+ function Find_Unit_In_Subtree
10811081 (Map : Names_Files.Map;
10821082 Key : GNATCOLL.VFS.Filesystem_String;
10831083 Root : Project_Type) return Names_Files.Cursor
@@ -1095,7 +1095,11 @@ package body GNATCOLL.Projects is
10951095 SFD := Element (Cur);
10961096
10971097 loop
1098- if not (Get_String (SFD.Lang) in " c" | " cpp" ) then
1098+ if Get_Language_From_Name
1099+ (Get_View (SFD.Project),
1100+ Get_String (SFD.Lang))
1101+ .Config.Kind = Unit_Based
1102+ then
10991103
11001104 Iter := Start (Extending_Project (Root, True));
11011105 while Current (Iter) /= No_Project loop
@@ -1117,13 +1121,13 @@ package body GNATCOLL.Projects is
11171121 end loop ;
11181122
11191123 return Names_Files.No_Element;
1120- end Find_Ada_In_Subtree ;
1124+ end Find_Unit_In_Subtree ;
11211125
1122- -- ---------------------
1123- -- Find_C_In_Subtree --
1124- -- ---------------------
1126+ -- ------------------------
1127+ -- Find_File_In_Subtree --
1128+ -- ------------------------
11251129
1126- function Find_C_In_Subtree
1130+ function Find_File_In_Subtree
11271131 (Map : Names_Files.Map;
11281132 Key : GNATCOLL.VFS.Filesystem_String;
11291133 Root : Project_Type) return Names_Files.Cursor
@@ -1144,7 +1148,11 @@ package body GNATCOLL.Projects is
11441148 -- instead of an inner iterator, so that library projects aggregated
11451149 -- in a library aggregate are also considered
11461150 loop
1147- if Get_String (SFD.Lang) in " c" | " cpp" then
1151+ if Get_Language_From_Name
1152+ (Get_View (SFD.Project),
1153+ Get_String (SFD.Lang))
1154+ .Config.Kind = File_Based
1155+ then
11481156
11491157 -- We can have as much c/c++ files with same name as possible.
11501158 -- So what we need to do is only iterate through extended
@@ -1185,7 +1193,7 @@ package body GNATCOLL.Projects is
11851193 end loop ;
11861194
11871195 return Names_Files.No_Element;
1188- end Find_C_In_Subtree ;
1196+ end Find_File_In_Subtree ;
11891197
11901198 Seen, Added : Virtual_File_Sets.Set;
11911199
@@ -1234,7 +1242,7 @@ package body GNATCOLL.Projects is
12341242 P : Project_Type;
12351243
12361244 begin
1237- Info_Cursor := Find_Ada_In_Subtree
1245+ Info_Cursor := Find_Unit_In_Subtree
12381246 (Self.Data.Tree_For_Map.Objects_Basename,
12391247 B, Self);
12401248
@@ -1251,7 +1259,7 @@ package body GNATCOLL.Projects is
12511259 if Dot > B'First then
12521260 B_Last := Dot - 1 ;
12531261 Info_Cursor :=
1254- Find_C_In_Subtree
1262+ Find_File_In_Subtree
12551263 (Self.Data.Tree_For_Map.Objects_Basename,
12561264 B (B'First .. B_Last),
12571265 Project);
0 commit comments