[clang] [clang][DependencyScanning] Track modules that resolve from sysroot. (PR #130634)

Cyndy Ishida via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 14 18:15:11 PDT 2025


================
@@ -739,6 +748,12 @@ ModuleDepCollectorPP::handleTopLevelModule(const Module *M) {
   MDC.ScanInstance.getASTReader()->visitInputFileInfos(
       *MF, /*IncludeSystem=*/true,
       [&](const serialization::InputFileInfo &IFI, bool IsSystem) {
+        if (MD.IsInSysroot) {
+          auto FullFilePath = ASTReader::ResolveImportedPath(
+              PathBuf, IFI.UnresolvedImportedFilename, MF->BaseDirectory);
+          MD.IsInSysroot = FullFilePath->starts_with(CurrSysroot);
----------------
cyndyishida wrote:

I modified the test case to handle a case like you described. https://github.com/llvm/llvm-project/pull/130634/files#diff-988370ab7ec8ac1b26c1fa07bda79906b52d097324dac9a9d04774debf330a6cR70

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


More information about the cfe-commits mailing list