Skip to content

Commit 4a9adaa

Browse files
authored
Merge pull request #25 from akyrtzi/isknowfile-visibility
[Index] For `isKnownFile()` take into account visibility of unit files
2 parents 888b53c + 71b034d commit 4a9adaa

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/Index/FilePathIndex.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,14 @@ bool FileIndexImpl::isKnownFile(CanonicalFilePathRef filePath) {
136136
ReadTransaction reader(DBase);
137137
IDCode pathCode = reader.getFilePathCode(filePath);
138138
reader.foreachUnitContainingFile(pathCode, [&](ArrayRef<IDCode> unitCodes) -> bool {
139-
foundUnit = true;
140-
return false;
139+
for (IDCode unitCode: unitCodes) {
140+
auto unitInfo = reader.getUnitInfo(unitCode);
141+
if (unitInfo.isValid() && VisibilityChecker->isUnitVisible(unitInfo, reader)) {
142+
foundUnit = true;
143+
return false;
144+
}
145+
}
146+
return true;
141147
});
142148
}
143149

0 commit comments

Comments
 (0)