[clang] [clang][DependencyScanning] Track modules that resolve from "shared" locations (PR #130634)

Ben Langmuir via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 17 13:47:32 PDT 2025


================
@@ -739,6 +795,12 @@ ModuleDepCollectorPP::handleTopLevelModule(const Module *M) {
   MDC.ScanInstance.getASTReader()->visitInputFileInfos(
       *MF, /*IncludeSystem=*/true,
       [&](const serialization::InputFileInfo &IFI, bool IsSystem) {
+        if (MD.IsShareable) {
+          auto FullFilePath = ASTReader::ResolveImportedPath(
+              PathBuf, IFI.UnresolvedImportedFilename, MF->BaseDirectory);
+          MD.IsShareable = isPathInSharedDir(SharedDirs, *FullFilePath);
+          PathBuf.resize_for_overwrite(256);
----------------
benlangmuir wrote:

Why are you resizing the string here? `ResolveImportedPath` will `clear()` it before using it anyway.

https://github.com/llvm/llvm-project/pull/130634


More information about the cfe-commits mailing list