@@ -76,9 +76,6 @@ class FileIndexImpl {
7676 bool foreachFileIncludedByFile (CanonicalFilePathRef sourcePath,
7777 function_ref<bool (CanonicalFilePathRef targetPath, unsigned line)> Receiver);
7878
79- bool foreachIncludeOfUnit (StringRef unitName,
80- function_ref<bool (CanonicalFilePathRef sourcePath, CanonicalFilePathRef targetPath, unsigned line)> receiver);
81-
8279 bool foreachIncludeOfStoreUnitContainingFile (CanonicalFilePathRef filePath,
8380 function_ref<bool (CanonicalFilePathRef sourcePath, CanonicalFilePathRef targetPath, unsigned line)> receiver);
8481};
@@ -226,23 +223,6 @@ bool FileIndexImpl::foreachFileIncludedByFile(CanonicalFilePathRef inputSourcePa
226223 });
227224}
228225
229- bool FileIndexImpl::foreachIncludeOfUnit (StringRef unitName,
230- function_ref<bool (CanonicalFilePathRef sourcePath, CanonicalFilePathRef targetPath, unsigned line)> receiver) {
231- std::string error;
232- IndexUnitReader storeUnit (*IdxStore, unitName, error);
233- if (!storeUnit.isValid ())
234- return true ;
235- StringRef workDir = storeUnit.getWorkingDirectory ();
236- return storeUnit.foreachInclude ([&](IndexUnitInclude inc) -> bool {
237- StringRef sourcePath = inc.getSourcePath ();
238- StringRef targetPath = inc.getTargetPath ();
239- unsigned line = inc.getSourceLine ();
240- CanonicalFilePath fullSourcePath = getCanonicalPath (sourcePath, workDir);
241- CanonicalFilePath fullTargetPath = getCanonicalPath (targetPath, workDir);
242- return receiver (fullSourcePath, fullTargetPath, line);
243- });
244- }
245-
246226bool FileIndexImpl::foreachIncludeOfStoreUnitContainingFile (CanonicalFilePathRef filePath,
247227 function_ref<bool (CanonicalFilePathRef sourcePath, CanonicalFilePathRef targetPath, unsigned line)> receiver) {
248228 SmallVector<std::string, 32 > allUnitNames;
@@ -261,7 +241,19 @@ bool FileIndexImpl::foreachIncludeOfStoreUnitContainingFile(CanonicalFilePathRef
261241 }
262242
263243 for (auto &unitName: allUnitNames) {
264- bool cont = foreachIncludeOfUnit (unitName, receiver);
244+ std::string error;
245+ IndexUnitReader storeUnit (*IdxStore, unitName, error);
246+ if (!storeUnit.isValid ())
247+ continue ;
248+ StringRef workDir = storeUnit.getWorkingDirectory ();
249+ bool cont = storeUnit.foreachInclude ([&](IndexUnitInclude inc) -> bool {
250+ StringRef sourcePath = inc.getSourcePath ();
251+ StringRef targetPath = inc.getTargetPath ();
252+ unsigned line = inc.getSourceLine ();
253+ CanonicalFilePath fullSourcePath = getCanonicalPath (sourcePath, workDir);
254+ CanonicalFilePath fullTargetPath = getCanonicalPath (targetPath, workDir);
255+ return receiver (fullSourcePath, fullTargetPath, line);
256+ });
265257 if (!cont)
266258 return false ;
267259 }
@@ -322,7 +314,3 @@ bool FilePathIndex::foreachFileIncludingFile(CanonicalFilePathRef TargetPath, fu
322314bool FilePathIndex::foreachFileIncludedByFile (CanonicalFilePathRef SourcePath, function_ref<bool (CanonicalFilePathRef, unsigned int )> Receiver) {
323315 return IMPL->foreachFileIncludedByFile (SourcePath, Receiver);
324316}
325-
326- bool FilePathIndex::foreachIncludeOfUnit (StringRef unitName, function_ref<bool (CanonicalFilePathRef sourcePath, CanonicalFilePathRef targetPath, unsigned line)> receiver) {
327- return IMPL->foreachIncludeOfUnit (unitName, receiver);
328- }
0 commit comments