This is an archive of the discontinued LLVM Phabricator instance.

[clang/HeaderSearch] Make sure `loadSubdirectoryModuleMaps` doesn't cause loading of regular files
ClosedPublic

Authored by akyrtzi on Jun 23 2023, 3:42 PM.

Details

Summary

HeaderSearch::loadSubdirectoryModuleMaps stats all the files in a directory which causes the dependency scanning
service to load and cache their contents. This is problematic because a file may be in the process of being generated
and could be cached by the dep-scan service while it is still incomplete.

To address this change loadSubdirectoryModuleMaps to ignore regular files.

Diff Detail

Event Timeline

akyrtzi created this revision.Jun 23 2023, 3:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 23 2023, 3:42 PM
akyrtzi requested review of this revision.Jun 23 2023, 3:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 23 2023, 3:42 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
benlangmuir added inline comments.Jun 23 2023, 3:52 PM
clang/unittests/Tooling/DependencyScannerTest.cpp
274

Should we add status override as well? I think we don't want to stat it either.

akyrtzi updated this revision to Diff 534123.Jun 23 2023, 5:00 PM

For the test also check for unnecessary stat call.

akyrtzi marked an inline comment as done.Jun 23 2023, 5:02 PM
akyrtzi added inline comments.
clang/unittests/Tooling/DependencyScannerTest.cpp
274

Good idea, see updated patch.

akyrtzi marked an inline comment as done.Jun 23 2023, 5:03 PM
benlangmuir accepted this revision.Jun 26 2023, 9:10 AM
This revision is now accepted and ready to land.Jun 26 2023, 9:10 AM